cfg80211.h 320 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. #ifndef __NET_CFG80211_H
  3. #define __NET_CFG80211_H
  4. /*
  5. * 802.11 device and configuration interface
  6. *
  7. * Copyright 2006-2010 Johannes Berg <[email protected]>
  8. * Copyright 2013-2014 Intel Mobile Communications GmbH
  9. * Copyright 2015-2017 Intel Deutschland GmbH
  10. * Copyright (C) 2018-2021 Intel Corporation
  11. */
  12. #include <linux/ethtool.h>
  13. #include <uapi/linux/rfkill.h>
  14. #include <linux/netdevice.h>
  15. #include <linux/debugfs.h>
  16. #include <linux/list.h>
  17. #include <linux/bug.h>
  18. #include <linux/netlink.h>
  19. #include <linux/skbuff.h>
  20. #include <linux/nl80211.h>
  21. #include <linux/if_ether.h>
  22. #include <linux/ieee80211.h>
  23. #include <linux/net.h>
  24. #include <linux/rfkill.h>
  25. #include <linux/android_kabi.h>
  26. #include <net/regulatory.h>
  27. /**
  28. * DOC: Introduction
  29. *
  30. * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
  31. * userspace and drivers, and offers some utility functionality associated
  32. * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
  33. * by all modern wireless drivers in Linux, so that they offer a consistent
  34. * API through nl80211. For backward compatibility, cfg80211 also offers
  35. * wireless extensions to userspace, but hides them from drivers completely.
  36. *
  37. * Additionally, cfg80211 contains code to help enforce regulatory spectrum
  38. * use restrictions.
  39. */
  40. /**
  41. * DOC: Device registration
  42. *
  43. * In order for a driver to use cfg80211, it must register the hardware device
  44. * with cfg80211. This happens through a number of hardware capability structs
  45. * described below.
  46. *
  47. * The fundamental structure for each device is the 'wiphy', of which each
  48. * instance describes a physical wireless device connected to the system. Each
  49. * such wiphy can have zero, one, or many virtual interfaces associated with
  50. * it, which need to be identified as such by pointing the network interface's
  51. * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
  52. * the wireless part of the interface, normally this struct is embedded in the
  53. * network interface's private data area. Drivers can optionally allow creating
  54. * or destroying virtual interfaces on the fly, but without at least one or the
  55. * ability to create some the wireless device isn't useful.
  56. *
  57. * Each wiphy structure contains device capability information, and also has
  58. * a pointer to the various operations the driver offers. The definitions and
  59. * structures here describe these capabilities in detail.
  60. */
  61. struct wiphy;
  62. /*
  63. * wireless hardware capability structures
  64. */
  65. /**
  66. * enum ieee80211_channel_flags - channel flags
  67. *
  68. * Channel flags set by the regulatory control code.
  69. *
  70. * @IEEE80211_CHAN_DISABLED: This channel is disabled.
  71. * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
  72. * sending probe requests or beaconing.
  73. * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
  74. * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
  75. * is not permitted.
  76. * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
  77. * is not permitted.
  78. * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
  79. * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
  80. * this flag indicates that an 80 MHz channel cannot use this
  81. * channel as the control or any of the secondary channels.
  82. * This may be due to the driver or due to regulatory bandwidth
  83. * restrictions.
  84. * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
  85. * this flag indicates that an 160 MHz channel cannot use this
  86. * channel as the control or any of the secondary channels.
  87. * This may be due to the driver or due to regulatory bandwidth
  88. * restrictions.
  89. * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
  90. * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
  91. * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
  92. * on this channel.
  93. * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
  94. * on this channel.
  95. * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
  96. * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
  97. * on this channel.
  98. * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
  99. * on this channel.
  100. * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
  101. * on this channel.
  102. * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
  103. * on this channel.
  104. * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
  105. * on this channel.
  106. * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band,
  107. * this flag indicates that a 320 MHz channel cannot use this
  108. * channel as the control or any of the secondary channels.
  109. * This may be due to the driver or due to regulatory bandwidth
  110. * restrictions.
  111. * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel.
  112. */
  113. enum ieee80211_channel_flags {
  114. IEEE80211_CHAN_DISABLED = 1<<0,
  115. IEEE80211_CHAN_NO_IR = 1<<1,
  116. /* hole at 1<<2 */
  117. IEEE80211_CHAN_RADAR = 1<<3,
  118. IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
  119. IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
  120. IEEE80211_CHAN_NO_OFDM = 1<<6,
  121. IEEE80211_CHAN_NO_80MHZ = 1<<7,
  122. IEEE80211_CHAN_NO_160MHZ = 1<<8,
  123. IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
  124. IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
  125. IEEE80211_CHAN_NO_20MHZ = 1<<11,
  126. IEEE80211_CHAN_NO_10MHZ = 1<<12,
  127. IEEE80211_CHAN_NO_HE = 1<<13,
  128. IEEE80211_CHAN_1MHZ = 1<<14,
  129. IEEE80211_CHAN_2MHZ = 1<<15,
  130. IEEE80211_CHAN_4MHZ = 1<<16,
  131. IEEE80211_CHAN_8MHZ = 1<<17,
  132. IEEE80211_CHAN_16MHZ = 1<<18,
  133. IEEE80211_CHAN_NO_320MHZ = 1<<19,
  134. IEEE80211_CHAN_NO_EHT = 1<<20,
  135. };
  136. #define IEEE80211_CHAN_NO_HT40 \
  137. (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
  138. #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
  139. #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
  140. /**
  141. * struct ieee80211_channel - channel definition
  142. *
  143. * This structure describes a single channel for use
  144. * with cfg80211.
  145. *
  146. * @center_freq: center frequency in MHz
  147. * @freq_offset: offset from @center_freq, in KHz
  148. * @hw_value: hardware-specific value for the channel
  149. * @flags: channel flags from &enum ieee80211_channel_flags.
  150. * @orig_flags: channel flags at registration time, used by regulatory
  151. * code to support devices with additional restrictions
  152. * @band: band this channel belongs to.
  153. * @max_antenna_gain: maximum antenna gain in dBi
  154. * @max_power: maximum transmission power (in dBm)
  155. * @max_reg_power: maximum regulatory transmission power (in dBm)
  156. * @beacon_found: helper to regulatory code to indicate when a beacon
  157. * has been found on this channel. Use regulatory_hint_found_beacon()
  158. * to enable this, this is useful only on 5 GHz band.
  159. * @orig_mag: internal use
  160. * @orig_mpwr: internal use
  161. * @dfs_state: current state of this channel. Only relevant if radar is required
  162. * on this channel.
  163. * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
  164. * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
  165. */
  166. struct ieee80211_channel {
  167. enum nl80211_band band;
  168. u32 center_freq;
  169. u16 freq_offset;
  170. u16 hw_value;
  171. u32 flags;
  172. int max_antenna_gain;
  173. int max_power;
  174. int max_reg_power;
  175. bool beacon_found;
  176. u32 orig_flags;
  177. int orig_mag, orig_mpwr;
  178. enum nl80211_dfs_state dfs_state;
  179. unsigned long dfs_state_entered;
  180. unsigned int dfs_cac_ms;
  181. };
  182. /**
  183. * enum ieee80211_rate_flags - rate flags
  184. *
  185. * Hardware/specification flags for rates. These are structured
  186. * in a way that allows using the same bitrate structure for
  187. * different bands/PHY modes.
  188. *
  189. * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
  190. * preamble on this bitrate; only relevant in 2.4GHz band and
  191. * with CCK rates.
  192. * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
  193. * when used with 802.11a (on the 5 GHz band); filled by the
  194. * core code when registering the wiphy.
  195. * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
  196. * when used with 802.11b (on the 2.4 GHz band); filled by the
  197. * core code when registering the wiphy.
  198. * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
  199. * when used with 802.11g (on the 2.4 GHz band); filled by the
  200. * core code when registering the wiphy.
  201. * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
  202. * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
  203. * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
  204. */
  205. enum ieee80211_rate_flags {
  206. IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
  207. IEEE80211_RATE_MANDATORY_A = 1<<1,
  208. IEEE80211_RATE_MANDATORY_B = 1<<2,
  209. IEEE80211_RATE_MANDATORY_G = 1<<3,
  210. IEEE80211_RATE_ERP_G = 1<<4,
  211. IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
  212. IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
  213. };
  214. /**
  215. * enum ieee80211_bss_type - BSS type filter
  216. *
  217. * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
  218. * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
  219. * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
  220. * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
  221. * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
  222. */
  223. enum ieee80211_bss_type {
  224. IEEE80211_BSS_TYPE_ESS,
  225. IEEE80211_BSS_TYPE_PBSS,
  226. IEEE80211_BSS_TYPE_IBSS,
  227. IEEE80211_BSS_TYPE_MBSS,
  228. IEEE80211_BSS_TYPE_ANY
  229. };
  230. /**
  231. * enum ieee80211_privacy - BSS privacy filter
  232. *
  233. * @IEEE80211_PRIVACY_ON: privacy bit set
  234. * @IEEE80211_PRIVACY_OFF: privacy bit clear
  235. * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
  236. */
  237. enum ieee80211_privacy {
  238. IEEE80211_PRIVACY_ON,
  239. IEEE80211_PRIVACY_OFF,
  240. IEEE80211_PRIVACY_ANY
  241. };
  242. #define IEEE80211_PRIVACY(x) \
  243. ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
  244. /**
  245. * struct ieee80211_rate - bitrate definition
  246. *
  247. * This structure describes a bitrate that an 802.11 PHY can
  248. * operate with. The two values @hw_value and @hw_value_short
  249. * are only for driver use when pointers to this structure are
  250. * passed around.
  251. *
  252. * @flags: rate-specific flags
  253. * @bitrate: bitrate in units of 100 Kbps
  254. * @hw_value: driver/hardware value for this rate
  255. * @hw_value_short: driver/hardware value for this rate when
  256. * short preamble is used
  257. */
  258. struct ieee80211_rate {
  259. u32 flags;
  260. u16 bitrate;
  261. u16 hw_value, hw_value_short;
  262. };
  263. /**
  264. * struct ieee80211_he_obss_pd - AP settings for spatial reuse
  265. *
  266. * @enable: is the feature enabled.
  267. * @sr_ctrl: The SR Control field of SRP element.
  268. * @non_srg_max_offset: non-SRG maximum tx power offset
  269. * @min_offset: minimal tx power offset an associated station shall use
  270. * @max_offset: maximum tx power offset an associated station shall use
  271. * @bss_color_bitmap: bitmap that indicates the BSS color values used by
  272. * members of the SRG
  273. * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
  274. * used by members of the SRG
  275. */
  276. struct ieee80211_he_obss_pd {
  277. bool enable;
  278. u8 sr_ctrl;
  279. u8 non_srg_max_offset;
  280. u8 min_offset;
  281. u8 max_offset;
  282. u8 bss_color_bitmap[8];
  283. u8 partial_bssid_bitmap[8];
  284. };
  285. /**
  286. * struct cfg80211_he_bss_color - AP settings for BSS coloring
  287. *
  288. * @color: the current color.
  289. * @enabled: HE BSS color is used
  290. * @partial: define the AID equation.
  291. */
  292. struct cfg80211_he_bss_color {
  293. u8 color;
  294. bool enabled;
  295. bool partial;
  296. };
  297. /**
  298. * struct ieee80211_sta_ht_cap - STA's HT capabilities
  299. *
  300. * This structure describes most essential parameters needed
  301. * to describe 802.11n HT capabilities for an STA.
  302. *
  303. * @ht_supported: is HT supported by the STA
  304. * @cap: HT capabilities map as described in 802.11n spec
  305. * @ampdu_factor: Maximum A-MPDU length factor
  306. * @ampdu_density: Minimum A-MPDU spacing
  307. * @mcs: Supported MCS rates
  308. */
  309. struct ieee80211_sta_ht_cap {
  310. u16 cap; /* use IEEE80211_HT_CAP_ */
  311. bool ht_supported;
  312. u8 ampdu_factor;
  313. u8 ampdu_density;
  314. struct ieee80211_mcs_info mcs;
  315. };
  316. /**
  317. * struct ieee80211_sta_vht_cap - STA's VHT capabilities
  318. *
  319. * This structure describes most essential parameters needed
  320. * to describe 802.11ac VHT capabilities for an STA.
  321. *
  322. * @vht_supported: is VHT supported by the STA
  323. * @cap: VHT capabilities map as described in 802.11ac spec
  324. * @vht_mcs: Supported VHT MCS rates
  325. */
  326. struct ieee80211_sta_vht_cap {
  327. bool vht_supported;
  328. u32 cap; /* use IEEE80211_VHT_CAP_ */
  329. struct ieee80211_vht_mcs_info vht_mcs;
  330. };
  331. #define IEEE80211_HE_PPE_THRES_MAX_LEN 25
  332. /**
  333. * struct ieee80211_sta_he_cap - STA's HE capabilities
  334. *
  335. * This structure describes most essential parameters needed
  336. * to describe 802.11ax HE capabilities for a STA.
  337. *
  338. * @has_he: true iff HE data is valid.
  339. * @he_cap_elem: Fixed portion of the HE capabilities element.
  340. * @he_mcs_nss_supp: The supported NSS/MCS combinations.
  341. * @ppe_thres: Holds the PPE Thresholds data.
  342. */
  343. struct ieee80211_sta_he_cap {
  344. bool has_he;
  345. struct ieee80211_he_cap_elem he_cap_elem;
  346. struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
  347. u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
  348. };
  349. /**
  350. * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS
  351. *
  352. * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS
  353. * and NSS Set field"
  354. *
  355. * @only_20mhz: MCS/NSS support for 20 MHz-only STA.
  356. * @bw: MCS/NSS support for 80, 160 and 320 MHz
  357. * @bw._80: MCS/NSS support for BW <= 80 MHz
  358. * @bw._160: MCS/NSS support for BW = 160 MHz
  359. * @bw._320: MCS/NSS support for BW = 320 MHz
  360. */
  361. struct ieee80211_eht_mcs_nss_supp {
  362. union {
  363. struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
  364. struct {
  365. struct ieee80211_eht_mcs_nss_supp_bw _80;
  366. struct ieee80211_eht_mcs_nss_supp_bw _160;
  367. struct ieee80211_eht_mcs_nss_supp_bw _320;
  368. } __packed bw;
  369. } __packed;
  370. } __packed;
  371. #define IEEE80211_EHT_PPE_THRES_MAX_LEN 32
  372. /**
  373. * struct ieee80211_sta_eht_cap - STA's EHT capabilities
  374. *
  375. * This structure describes most essential parameters needed
  376. * to describe 802.11be EHT capabilities for a STA.
  377. *
  378. * @has_eht: true iff EHT data is valid.
  379. * @eht_cap_elem: Fixed portion of the eht capabilities element.
  380. * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
  381. * @eht_ppe_thres: Holds the PPE Thresholds data.
  382. */
  383. struct ieee80211_sta_eht_cap {
  384. bool has_eht;
  385. struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
  386. struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
  387. u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
  388. };
  389. /**
  390. * struct ieee80211_sband_iftype_data - sband data per interface type
  391. *
  392. * This structure encapsulates sband data that is relevant for the
  393. * interface types defined in @types_mask. Each type in the
  394. * @types_mask must be unique across all instances of iftype_data.
  395. *
  396. * @types_mask: interface types mask
  397. * @he_cap: holds the HE capabilities
  398. * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
  399. * 6 GHz band channel (and 0 may be valid value).
  400. * @eht_cap: STA's EHT capabilities
  401. * @vendor_elems: vendor element(s) to advertise
  402. * @vendor_elems.data: vendor element(s) data
  403. * @vendor_elems.len: vendor element(s) length
  404. */
  405. struct ieee80211_sband_iftype_data {
  406. u16 types_mask;
  407. struct ieee80211_sta_he_cap he_cap;
  408. struct ieee80211_he_6ghz_capa he_6ghz_capa;
  409. struct ieee80211_sta_eht_cap eht_cap;
  410. struct {
  411. const u8 *data;
  412. unsigned int len;
  413. } vendor_elems;
  414. };
  415. /**
  416. * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
  417. *
  418. * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
  419. * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
  420. * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
  421. * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
  422. * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
  423. * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
  424. * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
  425. * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
  426. * 2.16GHz+2.16GHz
  427. * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
  428. * 4.32GHz + 4.32GHz
  429. * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
  430. * 4.32GHz + 4.32GHz
  431. * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
  432. * and 4.32GHz + 4.32GHz
  433. * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
  434. * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
  435. */
  436. enum ieee80211_edmg_bw_config {
  437. IEEE80211_EDMG_BW_CONFIG_4 = 4,
  438. IEEE80211_EDMG_BW_CONFIG_5 = 5,
  439. IEEE80211_EDMG_BW_CONFIG_6 = 6,
  440. IEEE80211_EDMG_BW_CONFIG_7 = 7,
  441. IEEE80211_EDMG_BW_CONFIG_8 = 8,
  442. IEEE80211_EDMG_BW_CONFIG_9 = 9,
  443. IEEE80211_EDMG_BW_CONFIG_10 = 10,
  444. IEEE80211_EDMG_BW_CONFIG_11 = 11,
  445. IEEE80211_EDMG_BW_CONFIG_12 = 12,
  446. IEEE80211_EDMG_BW_CONFIG_13 = 13,
  447. IEEE80211_EDMG_BW_CONFIG_14 = 14,
  448. IEEE80211_EDMG_BW_CONFIG_15 = 15,
  449. };
  450. /**
  451. * struct ieee80211_edmg - EDMG configuration
  452. *
  453. * This structure describes most essential parameters needed
  454. * to describe 802.11ay EDMG configuration
  455. *
  456. * @channels: bitmap that indicates the 2.16 GHz channel(s)
  457. * that are allowed to be used for transmissions.
  458. * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
  459. * Set to 0 indicate EDMG not supported.
  460. * @bw_config: Channel BW Configuration subfield encodes
  461. * the allowed channel bandwidth configurations
  462. */
  463. struct ieee80211_edmg {
  464. u8 channels;
  465. enum ieee80211_edmg_bw_config bw_config;
  466. };
  467. /**
  468. * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
  469. *
  470. * This structure describes most essential parameters needed
  471. * to describe 802.11ah S1G capabilities for a STA.
  472. *
  473. * @s1g: is STA an S1G STA
  474. * @cap: S1G capabilities information
  475. * @nss_mcs: Supported NSS MCS set
  476. */
  477. struct ieee80211_sta_s1g_cap {
  478. bool s1g;
  479. u8 cap[10]; /* use S1G_CAPAB_ */
  480. u8 nss_mcs[5];
  481. };
  482. /**
  483. * struct ieee80211_supported_band - frequency band definition
  484. *
  485. * This structure describes a frequency band a wiphy
  486. * is able to operate in.
  487. *
  488. * @channels: Array of channels the hardware can operate with
  489. * in this band.
  490. * @band: the band this structure represents
  491. * @n_channels: Number of channels in @channels
  492. * @bitrates: Array of bitrates the hardware can operate with
  493. * in this band. Must be sorted to give a valid "supported
  494. * rates" IE, i.e. CCK rates first, then OFDM.
  495. * @n_bitrates: Number of bitrates in @bitrates
  496. * @ht_cap: HT capabilities in this band
  497. * @vht_cap: VHT capabilities in this band
  498. * @s1g_cap: S1G capabilities in this band
  499. * @edmg_cap: EDMG capabilities in this band
  500. * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
  501. * @n_iftype_data: number of iftype data entries
  502. * @iftype_data: interface type data entries. Note that the bits in
  503. * @types_mask inside this structure cannot overlap (i.e. only
  504. * one occurrence of each type is allowed across all instances of
  505. * iftype_data).
  506. */
  507. struct ieee80211_supported_band {
  508. struct ieee80211_channel *channels;
  509. struct ieee80211_rate *bitrates;
  510. enum nl80211_band band;
  511. int n_channels;
  512. int n_bitrates;
  513. struct ieee80211_sta_ht_cap ht_cap;
  514. struct ieee80211_sta_vht_cap vht_cap;
  515. struct ieee80211_sta_s1g_cap s1g_cap;
  516. struct ieee80211_edmg edmg_cap;
  517. u16 n_iftype_data;
  518. const struct ieee80211_sband_iftype_data *iftype_data;
  519. };
  520. /**
  521. * ieee80211_get_sband_iftype_data - return sband data for a given iftype
  522. * @sband: the sband to search for the STA on
  523. * @iftype: enum nl80211_iftype
  524. *
  525. * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
  526. */
  527. static inline const struct ieee80211_sband_iftype_data *
  528. ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
  529. u8 iftype)
  530. {
  531. int i;
  532. if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
  533. return NULL;
  534. if (iftype == NL80211_IFTYPE_AP_VLAN)
  535. iftype = NL80211_IFTYPE_AP;
  536. for (i = 0; i < sband->n_iftype_data; i++) {
  537. const struct ieee80211_sband_iftype_data *data =
  538. &sband->iftype_data[i];
  539. if (data->types_mask & BIT(iftype))
  540. return data;
  541. }
  542. return NULL;
  543. }
  544. /**
  545. * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
  546. * @sband: the sband to search for the iftype on
  547. * @iftype: enum nl80211_iftype
  548. *
  549. * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
  550. */
  551. static inline const struct ieee80211_sta_he_cap *
  552. ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
  553. u8 iftype)
  554. {
  555. const struct ieee80211_sband_iftype_data *data =
  556. ieee80211_get_sband_iftype_data(sband, iftype);
  557. if (data && data->he_cap.has_he)
  558. return &data->he_cap;
  559. return NULL;
  560. }
  561. /**
  562. * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
  563. * @sband: the sband to search for the STA on
  564. * @iftype: the iftype to search for
  565. *
  566. * Return: the 6GHz capabilities
  567. */
  568. static inline __le16
  569. ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
  570. enum nl80211_iftype iftype)
  571. {
  572. const struct ieee80211_sband_iftype_data *data =
  573. ieee80211_get_sband_iftype_data(sband, iftype);
  574. if (WARN_ON(!data || !data->he_cap.has_he))
  575. return 0;
  576. return data->he_6ghz_capa.capa;
  577. }
  578. /**
  579. * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype
  580. * @sband: the sband to search for the iftype on
  581. * @iftype: enum nl80211_iftype
  582. *
  583. * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found
  584. */
  585. static inline const struct ieee80211_sta_eht_cap *
  586. ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,
  587. enum nl80211_iftype iftype)
  588. {
  589. const struct ieee80211_sband_iftype_data *data =
  590. ieee80211_get_sband_iftype_data(sband, iftype);
  591. if (data && data->eht_cap.has_eht)
  592. return &data->eht_cap;
  593. return NULL;
  594. }
  595. /**
  596. * wiphy_read_of_freq_limits - read frequency limits from device tree
  597. *
  598. * @wiphy: the wireless device to get extra limits for
  599. *
  600. * Some devices may have extra limitations specified in DT. This may be useful
  601. * for chipsets that normally support more bands but are limited due to board
  602. * design (e.g. by antennas or external power amplifier).
  603. *
  604. * This function reads info from DT and uses it to *modify* channels (disable
  605. * unavailable ones). It's usually a *bad* idea to use it in drivers with
  606. * shared channel data as DT limitations are device specific. You should make
  607. * sure to call it only if channels in wiphy are copied and can be modified
  608. * without affecting other devices.
  609. *
  610. * As this function access device node it has to be called after set_wiphy_dev.
  611. * It also modifies channels so they have to be set first.
  612. * If using this helper, call it before wiphy_register().
  613. */
  614. #ifdef CONFIG_OF
  615. void wiphy_read_of_freq_limits(struct wiphy *wiphy);
  616. #else /* CONFIG_OF */
  617. static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
  618. {
  619. }
  620. #endif /* !CONFIG_OF */
  621. /*
  622. * Wireless hardware/device configuration structures and methods
  623. */
  624. /**
  625. * DOC: Actions and configuration
  626. *
  627. * Each wireless device and each virtual interface offer a set of configuration
  628. * operations and other actions that are invoked by userspace. Each of these
  629. * actions is described in the operations structure, and the parameters these
  630. * operations use are described separately.
  631. *
  632. * Additionally, some operations are asynchronous and expect to get status
  633. * information via some functions that drivers need to call.
  634. *
  635. * Scanning and BSS list handling with its associated functionality is described
  636. * in a separate chapter.
  637. */
  638. #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
  639. WLAN_USER_POSITION_LEN)
  640. /**
  641. * struct vif_params - describes virtual interface parameters
  642. * @flags: monitor interface flags, unchanged if 0, otherwise
  643. * %MONITOR_FLAG_CHANGED will be set
  644. * @use_4addr: use 4-address frames
  645. * @macaddr: address to use for this virtual interface.
  646. * If this parameter is set to zero address the driver may
  647. * determine the address as needed.
  648. * This feature is only fully supported by drivers that enable the
  649. * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
  650. ** only p2p devices with specified MAC.
  651. * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
  652. * belonging to that MU-MIMO groupID; %NULL if not changed
  653. * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
  654. * MU-MIMO packets going to the specified station; %NULL if not changed
  655. */
  656. struct vif_params {
  657. u32 flags;
  658. int use_4addr;
  659. u8 macaddr[ETH_ALEN];
  660. const u8 *vht_mumimo_groups;
  661. const u8 *vht_mumimo_follow_addr;
  662. };
  663. /**
  664. * struct key_params - key information
  665. *
  666. * Information about a key
  667. *
  668. * @key: key material
  669. * @key_len: length of key material
  670. * @cipher: cipher suite selector
  671. * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
  672. * with the get_key() callback, must be in little endian,
  673. * length given by @seq_len.
  674. * @seq_len: length of @seq.
  675. * @vlan_id: vlan_id for VLAN group key (if nonzero)
  676. * @mode: key install mode (RX_TX, NO_TX or SET_TX)
  677. */
  678. struct key_params {
  679. const u8 *key;
  680. const u8 *seq;
  681. int key_len;
  682. int seq_len;
  683. u16 vlan_id;
  684. u32 cipher;
  685. enum nl80211_key_mode mode;
  686. };
  687. /**
  688. * struct cfg80211_chan_def - channel definition
  689. * @chan: the (control) channel
  690. * @width: channel width
  691. * @center_freq1: center frequency of first segment
  692. * @center_freq2: center frequency of second segment
  693. * (only with 80+80 MHz)
  694. * @edmg: define the EDMG channels configuration.
  695. * If edmg is requested (i.e. the .channels member is non-zero),
  696. * chan will define the primary channel and all other
  697. * parameters are ignored.
  698. * @freq1_offset: offset from @center_freq1, in KHz
  699. */
  700. struct cfg80211_chan_def {
  701. struct ieee80211_channel *chan;
  702. enum nl80211_chan_width width;
  703. u32 center_freq1;
  704. u32 center_freq2;
  705. struct ieee80211_edmg edmg;
  706. u16 freq1_offset;
  707. };
  708. /*
  709. * cfg80211_bitrate_mask - masks for bitrate control
  710. */
  711. struct cfg80211_bitrate_mask {
  712. struct {
  713. u32 legacy;
  714. u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
  715. u16 vht_mcs[NL80211_VHT_NSS_MAX];
  716. u16 he_mcs[NL80211_HE_NSS_MAX];
  717. enum nl80211_txrate_gi gi;
  718. enum nl80211_he_gi he_gi;
  719. enum nl80211_he_ltf he_ltf;
  720. } control[NUM_NL80211_BANDS];
  721. };
  722. /**
  723. * struct cfg80211_tid_cfg - TID specific configuration
  724. * @config_override: Flag to notify driver to reset TID configuration
  725. * of the peer.
  726. * @tids: bitmap of TIDs to modify
  727. * @mask: bitmap of attributes indicating which parameter changed,
  728. * similar to &nl80211_tid_config_supp.
  729. * @noack: noack configuration value for the TID
  730. * @retry_long: retry count value
  731. * @retry_short: retry count value
  732. * @ampdu: Enable/Disable MPDU aggregation
  733. * @rtscts: Enable/Disable RTS/CTS
  734. * @amsdu: Enable/Disable MSDU aggregation
  735. * @txrate_type: Tx bitrate mask type
  736. * @txrate_mask: Tx bitrate to be applied for the TID
  737. */
  738. struct cfg80211_tid_cfg {
  739. bool config_override;
  740. u8 tids;
  741. u64 mask;
  742. enum nl80211_tid_config noack;
  743. u8 retry_long, retry_short;
  744. enum nl80211_tid_config ampdu;
  745. enum nl80211_tid_config rtscts;
  746. enum nl80211_tid_config amsdu;
  747. enum nl80211_tx_rate_setting txrate_type;
  748. struct cfg80211_bitrate_mask txrate_mask;
  749. };
  750. /**
  751. * struct cfg80211_tid_config - TID configuration
  752. * @peer: Station's MAC address
  753. * @n_tid_conf: Number of TID specific configurations to be applied
  754. * @tid_conf: Configuration change info
  755. */
  756. struct cfg80211_tid_config {
  757. const u8 *peer;
  758. u32 n_tid_conf;
  759. struct cfg80211_tid_cfg tid_conf[];
  760. };
  761. /**
  762. * struct cfg80211_fils_aad - FILS AAD data
  763. * @macaddr: STA MAC address
  764. * @kek: FILS KEK
  765. * @kek_len: FILS KEK length
  766. * @snonce: STA Nonce
  767. * @anonce: AP Nonce
  768. */
  769. struct cfg80211_fils_aad {
  770. const u8 *macaddr;
  771. const u8 *kek;
  772. u8 kek_len;
  773. const u8 *snonce;
  774. const u8 *anonce;
  775. };
  776. /**
  777. * cfg80211_get_chandef_type - return old channel type from chandef
  778. * @chandef: the channel definition
  779. *
  780. * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
  781. * chandef, which must have a bandwidth allowing this conversion.
  782. */
  783. static inline enum nl80211_channel_type
  784. cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
  785. {
  786. switch (chandef->width) {
  787. case NL80211_CHAN_WIDTH_20_NOHT:
  788. return NL80211_CHAN_NO_HT;
  789. case NL80211_CHAN_WIDTH_20:
  790. return NL80211_CHAN_HT20;
  791. case NL80211_CHAN_WIDTH_40:
  792. if (chandef->center_freq1 > chandef->chan->center_freq)
  793. return NL80211_CHAN_HT40PLUS;
  794. return NL80211_CHAN_HT40MINUS;
  795. default:
  796. WARN_ON(1);
  797. return NL80211_CHAN_NO_HT;
  798. }
  799. }
  800. /**
  801. * cfg80211_chandef_create - create channel definition using channel type
  802. * @chandef: the channel definition struct to fill
  803. * @channel: the control channel
  804. * @chantype: the channel type
  805. *
  806. * Given a channel type, create a channel definition.
  807. */
  808. void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
  809. struct ieee80211_channel *channel,
  810. enum nl80211_channel_type chantype);
  811. /**
  812. * cfg80211_chandef_identical - check if two channel definitions are identical
  813. * @chandef1: first channel definition
  814. * @chandef2: second channel definition
  815. *
  816. * Return: %true if the channels defined by the channel definitions are
  817. * identical, %false otherwise.
  818. */
  819. static inline bool
  820. cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
  821. const struct cfg80211_chan_def *chandef2)
  822. {
  823. return (chandef1->chan == chandef2->chan &&
  824. chandef1->width == chandef2->width &&
  825. chandef1->center_freq1 == chandef2->center_freq1 &&
  826. chandef1->freq1_offset == chandef2->freq1_offset &&
  827. chandef1->center_freq2 == chandef2->center_freq2);
  828. }
  829. /**
  830. * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
  831. *
  832. * @chandef: the channel definition
  833. *
  834. * Return: %true if EDMG defined, %false otherwise.
  835. */
  836. static inline bool
  837. cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
  838. {
  839. return chandef->edmg.channels || chandef->edmg.bw_config;
  840. }
  841. /**
  842. * cfg80211_chandef_compatible - check if two channel definitions are compatible
  843. * @chandef1: first channel definition
  844. * @chandef2: second channel definition
  845. *
  846. * Return: %NULL if the given channel definitions are incompatible,
  847. * chandef1 or chandef2 otherwise.
  848. */
  849. const struct cfg80211_chan_def *
  850. cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
  851. const struct cfg80211_chan_def *chandef2);
  852. /**
  853. * cfg80211_chandef_valid - check if a channel definition is valid
  854. * @chandef: the channel definition to check
  855. * Return: %true if the channel definition is valid. %false otherwise.
  856. */
  857. bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
  858. /**
  859. * cfg80211_chandef_usable - check if secondary channels can be used
  860. * @wiphy: the wiphy to validate against
  861. * @chandef: the channel definition to check
  862. * @prohibited_flags: the regulatory channel flags that must not be set
  863. * Return: %true if secondary channels are usable. %false otherwise.
  864. */
  865. bool cfg80211_chandef_usable(struct wiphy *wiphy,
  866. const struct cfg80211_chan_def *chandef,
  867. u32 prohibited_flags);
  868. /**
  869. * cfg80211_chandef_dfs_required - checks if radar detection is required
  870. * @wiphy: the wiphy to validate against
  871. * @chandef: the channel definition to check
  872. * @iftype: the interface type as specified in &enum nl80211_iftype
  873. * Returns:
  874. * 1 if radar detection is required, 0 if it is not, < 0 on error
  875. */
  876. int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
  877. const struct cfg80211_chan_def *chandef,
  878. enum nl80211_iftype iftype);
  879. /**
  880. * ieee80211_chanwidth_rate_flags - return rate flags for channel width
  881. * @width: the channel width of the channel
  882. *
  883. * In some channel types, not all rates may be used - for example CCK
  884. * rates may not be used in 5/10 MHz channels.
  885. *
  886. * Returns: rate flags which apply for this channel width
  887. */
  888. static inline enum ieee80211_rate_flags
  889. ieee80211_chanwidth_rate_flags(enum nl80211_chan_width width)
  890. {
  891. switch (width) {
  892. case NL80211_CHAN_WIDTH_5:
  893. return IEEE80211_RATE_SUPPORTS_5MHZ;
  894. case NL80211_CHAN_WIDTH_10:
  895. return IEEE80211_RATE_SUPPORTS_10MHZ;
  896. default:
  897. break;
  898. }
  899. return 0;
  900. }
  901. /**
  902. * ieee80211_chandef_rate_flags - returns rate flags for a channel
  903. * @chandef: channel definition for the channel
  904. *
  905. * See ieee80211_chanwidth_rate_flags().
  906. *
  907. * Returns: rate flags which apply for this channel
  908. */
  909. static inline enum ieee80211_rate_flags
  910. ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
  911. {
  912. return ieee80211_chanwidth_rate_flags(chandef->width);
  913. }
  914. /**
  915. * ieee80211_chandef_max_power - maximum transmission power for the chandef
  916. *
  917. * In some regulations, the transmit power may depend on the configured channel
  918. * bandwidth which may be defined as dBm/MHz. This function returns the actual
  919. * max_power for non-standard (20 MHz) channels.
  920. *
  921. * @chandef: channel definition for the channel
  922. *
  923. * Returns: maximum allowed transmission power in dBm for the chandef
  924. */
  925. static inline int
  926. ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
  927. {
  928. switch (chandef->width) {
  929. case NL80211_CHAN_WIDTH_5:
  930. return min(chandef->chan->max_reg_power - 6,
  931. chandef->chan->max_power);
  932. case NL80211_CHAN_WIDTH_10:
  933. return min(chandef->chan->max_reg_power - 3,
  934. chandef->chan->max_power);
  935. default:
  936. break;
  937. }
  938. return chandef->chan->max_power;
  939. }
  940. /**
  941. * cfg80211_any_usable_channels - check for usable channels
  942. * @wiphy: the wiphy to check for
  943. * @band_mask: which bands to check on
  944. * @prohibited_flags: which channels to not consider usable,
  945. * %IEEE80211_CHAN_DISABLED is always taken into account
  946. */
  947. bool cfg80211_any_usable_channels(struct wiphy *wiphy,
  948. unsigned long band_mask,
  949. u32 prohibited_flags);
  950. /**
  951. * enum survey_info_flags - survey information flags
  952. *
  953. * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
  954. * @SURVEY_INFO_IN_USE: channel is currently being used
  955. * @SURVEY_INFO_TIME: active time (in ms) was filled in
  956. * @SURVEY_INFO_TIME_BUSY: busy time was filled in
  957. * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
  958. * @SURVEY_INFO_TIME_RX: receive time was filled in
  959. * @SURVEY_INFO_TIME_TX: transmit time was filled in
  960. * @SURVEY_INFO_TIME_SCAN: scan time was filled in
  961. * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
  962. *
  963. * Used by the driver to indicate which info in &struct survey_info
  964. * it has filled in during the get_survey().
  965. */
  966. enum survey_info_flags {
  967. SURVEY_INFO_NOISE_DBM = BIT(0),
  968. SURVEY_INFO_IN_USE = BIT(1),
  969. SURVEY_INFO_TIME = BIT(2),
  970. SURVEY_INFO_TIME_BUSY = BIT(3),
  971. SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
  972. SURVEY_INFO_TIME_RX = BIT(5),
  973. SURVEY_INFO_TIME_TX = BIT(6),
  974. SURVEY_INFO_TIME_SCAN = BIT(7),
  975. SURVEY_INFO_TIME_BSS_RX = BIT(8),
  976. };
  977. /**
  978. * struct survey_info - channel survey response
  979. *
  980. * @channel: the channel this survey record reports, may be %NULL for a single
  981. * record to report global statistics
  982. * @filled: bitflag of flags from &enum survey_info_flags
  983. * @noise: channel noise in dBm. This and all following fields are
  984. * optional
  985. * @time: amount of time in ms the radio was turn on (on the channel)
  986. * @time_busy: amount of time the primary channel was sensed busy
  987. * @time_ext_busy: amount of time the extension channel was sensed busy
  988. * @time_rx: amount of time the radio spent receiving data
  989. * @time_tx: amount of time the radio spent transmitting data
  990. * @time_scan: amount of time the radio spent for scanning
  991. * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
  992. *
  993. * Used by dump_survey() to report back per-channel survey information.
  994. *
  995. * This structure can later be expanded with things like
  996. * channel duty cycle etc.
  997. */
  998. struct survey_info {
  999. struct ieee80211_channel *channel;
  1000. u64 time;
  1001. u64 time_busy;
  1002. u64 time_ext_busy;
  1003. u64 time_rx;
  1004. u64 time_tx;
  1005. u64 time_scan;
  1006. u64 time_bss_rx;
  1007. u32 filled;
  1008. s8 noise;
  1009. };
  1010. #define CFG80211_MAX_WEP_KEYS 4
  1011. #define CFG80211_MAX_NUM_AKM_SUITES 10
  1012. /**
  1013. * struct cfg80211_crypto_settings - Crypto settings
  1014. * @wpa_versions: indicates which, if any, WPA versions are enabled
  1015. * (from enum nl80211_wpa_versions)
  1016. * @cipher_group: group key cipher suite (or 0 if unset)
  1017. * @n_ciphers_pairwise: number of AP supported unicast ciphers
  1018. * @ciphers_pairwise: unicast key cipher suites
  1019. * @n_akm_suites: number of AKM suites
  1020. * @akm_suites: AKM suites
  1021. * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
  1022. * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
  1023. * required to assume that the port is unauthorized until authorized by
  1024. * user space. Otherwise, port is marked authorized by default.
  1025. * @control_port_ethertype: the control port protocol that should be
  1026. * allowed through even on unauthorized ports
  1027. * @control_port_no_encrypt: TRUE to prevent encryption of control port
  1028. * protocol frames.
  1029. * @control_port_over_nl80211: TRUE if userspace expects to exchange control
  1030. * port frames over NL80211 instead of the network interface.
  1031. * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
  1032. * port for mac80211
  1033. * @wep_keys: static WEP keys, if not NULL points to an array of
  1034. * CFG80211_MAX_WEP_KEYS WEP keys
  1035. * @wep_tx_key: key index (0..3) of the default TX static WEP key
  1036. * @psk: PSK (for devices supporting 4-way-handshake offload)
  1037. * @sae_pwd: password for SAE authentication (for devices supporting SAE
  1038. * offload)
  1039. * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
  1040. * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
  1041. *
  1042. * NL80211_SAE_PWE_UNSPECIFIED
  1043. * Not-specified, used to indicate userspace did not specify any
  1044. * preference. The driver should follow its internal policy in
  1045. * such a scenario.
  1046. *
  1047. * NL80211_SAE_PWE_HUNT_AND_PECK
  1048. * Allow hunting-and-pecking loop only
  1049. *
  1050. * NL80211_SAE_PWE_HASH_TO_ELEMENT
  1051. * Allow hash-to-element only
  1052. *
  1053. * NL80211_SAE_PWE_BOTH
  1054. * Allow either hunting-and-pecking loop or hash-to-element
  1055. */
  1056. struct cfg80211_crypto_settings {
  1057. u32 wpa_versions;
  1058. u32 cipher_group;
  1059. int n_ciphers_pairwise;
  1060. u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
  1061. int n_akm_suites;
  1062. u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];
  1063. bool control_port;
  1064. __be16 control_port_ethertype;
  1065. bool control_port_no_encrypt;
  1066. bool control_port_over_nl80211;
  1067. bool control_port_no_preauth;
  1068. struct key_params *wep_keys;
  1069. int wep_tx_key;
  1070. const u8 *psk;
  1071. const u8 *sae_pwd;
  1072. u8 sae_pwd_len;
  1073. enum nl80211_sae_pwe_mechanism sae_pwe;
  1074. ANDROID_KABI_RESERVE(1);
  1075. };
  1076. /**
  1077. * struct cfg80211_mbssid_config - AP settings for multi bssid
  1078. *
  1079. * @tx_wdev: pointer to the transmitted interface in the MBSSID set
  1080. * @index: index of this AP in the multi bssid group.
  1081. * @ema: set to true if the beacons should be sent out in EMA mode.
  1082. */
  1083. struct cfg80211_mbssid_config {
  1084. struct wireless_dev *tx_wdev;
  1085. u8 index;
  1086. bool ema;
  1087. };
  1088. /**
  1089. * struct cfg80211_mbssid_elems - Multiple BSSID elements
  1090. *
  1091. * @cnt: Number of elements in array %elems.
  1092. *
  1093. * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
  1094. * @elem.data: Data for multiple BSSID elements.
  1095. * @elem.len: Length of data.
  1096. */
  1097. struct cfg80211_mbssid_elems {
  1098. u8 cnt;
  1099. struct {
  1100. const u8 *data;
  1101. size_t len;
  1102. } elem[];
  1103. };
  1104. /**
  1105. * struct cfg80211_beacon_data - beacon data
  1106. * @link_id: the link ID for the AP MLD link sending this beacon
  1107. * @head: head portion of beacon (before TIM IE)
  1108. * or %NULL if not changed
  1109. * @tail: tail portion of beacon (after TIM IE)
  1110. * or %NULL if not changed
  1111. * @head_len: length of @head
  1112. * @tail_len: length of @tail
  1113. * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
  1114. * @beacon_ies_len: length of beacon_ies in octets
  1115. * @proberesp_ies: extra information element(s) to add into Probe Response
  1116. * frames or %NULL
  1117. * @proberesp_ies_len: length of proberesp_ies in octets
  1118. * @assocresp_ies: extra information element(s) to add into (Re)Association
  1119. * Response frames or %NULL
  1120. * @assocresp_ies_len: length of assocresp_ies in octets
  1121. * @probe_resp_len: length of probe response template (@probe_resp)
  1122. * @probe_resp: probe response template (AP mode only)
  1123. * @mbssid_ies: multiple BSSID elements
  1124. * @ftm_responder: enable FTM responder functionality; -1 for no change
  1125. * (which also implies no change in LCI/civic location data)
  1126. * @lci: Measurement Report element content, starting with Measurement Token
  1127. * (measurement type 8)
  1128. * @civicloc: Measurement Report element content, starting with Measurement
  1129. * Token (measurement type 11)
  1130. * @lci_len: LCI data length
  1131. * @civicloc_len: Civic location data length
  1132. * @he_bss_color: BSS Color settings
  1133. * @he_bss_color_valid: indicates whether bss color
  1134. * attribute is present in beacon data or not.
  1135. */
  1136. struct cfg80211_beacon_data {
  1137. unsigned int link_id;
  1138. const u8 *head, *tail;
  1139. const u8 *beacon_ies;
  1140. const u8 *proberesp_ies;
  1141. const u8 *assocresp_ies;
  1142. const u8 *probe_resp;
  1143. const u8 *lci;
  1144. const u8 *civicloc;
  1145. struct cfg80211_mbssid_elems *mbssid_ies;
  1146. s8 ftm_responder;
  1147. size_t head_len, tail_len;
  1148. size_t beacon_ies_len;
  1149. size_t proberesp_ies_len;
  1150. size_t assocresp_ies_len;
  1151. size_t probe_resp_len;
  1152. size_t lci_len;
  1153. size_t civicloc_len;
  1154. struct cfg80211_he_bss_color he_bss_color;
  1155. bool he_bss_color_valid;
  1156. ANDROID_KABI_RESERVE(1);
  1157. };
  1158. struct mac_address {
  1159. u8 addr[ETH_ALEN];
  1160. };
  1161. /**
  1162. * struct cfg80211_acl_data - Access control list data
  1163. *
  1164. * @acl_policy: ACL policy to be applied on the station's
  1165. * entry specified by mac_addr
  1166. * @n_acl_entries: Number of MAC address entries passed
  1167. * @mac_addrs: List of MAC addresses of stations to be used for ACL
  1168. */
  1169. struct cfg80211_acl_data {
  1170. enum nl80211_acl_policy acl_policy;
  1171. int n_acl_entries;
  1172. /* Keep it last */
  1173. struct mac_address mac_addrs[];
  1174. };
  1175. /**
  1176. * struct cfg80211_fils_discovery - FILS discovery parameters from
  1177. * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
  1178. *
  1179. * @min_interval: Minimum packet interval in TUs (0 - 10000)
  1180. * @max_interval: Maximum packet interval in TUs (0 - 10000)
  1181. * @tmpl_len: Template length
  1182. * @tmpl: Template data for FILS discovery frame including the action
  1183. * frame headers.
  1184. */
  1185. struct cfg80211_fils_discovery {
  1186. u32 min_interval;
  1187. u32 max_interval;
  1188. size_t tmpl_len;
  1189. const u8 *tmpl;
  1190. };
  1191. /**
  1192. * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
  1193. * response parameters in 6GHz.
  1194. *
  1195. * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
  1196. * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
  1197. * scanning
  1198. * @tmpl_len: Template length
  1199. * @tmpl: Template data for probe response
  1200. */
  1201. struct cfg80211_unsol_bcast_probe_resp {
  1202. u32 interval;
  1203. size_t tmpl_len;
  1204. const u8 *tmpl;
  1205. };
  1206. /**
  1207. * struct cfg80211_ap_settings - AP configuration
  1208. *
  1209. * Used to configure an AP interface.
  1210. *
  1211. * @chandef: defines the channel to use
  1212. * @beacon: beacon data
  1213. * @beacon_interval: beacon interval
  1214. * @dtim_period: DTIM period
  1215. * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
  1216. * user space)
  1217. * @ssid_len: length of @ssid
  1218. * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
  1219. * @crypto: crypto settings
  1220. * @privacy: the BSS uses privacy
  1221. * @auth_type: Authentication type (algorithm)
  1222. * @smps_mode: SMPS mode
  1223. * @inactivity_timeout: time in seconds to determine station's inactivity.
  1224. * @p2p_ctwindow: P2P CT Window
  1225. * @p2p_opp_ps: P2P opportunistic PS
  1226. * @acl: ACL configuration used by the drivers which has support for
  1227. * MAC address based access control
  1228. * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
  1229. * networks.
  1230. * @beacon_rate: bitrate to be used for beacons
  1231. * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
  1232. * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
  1233. * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
  1234. * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)
  1235. * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)
  1236. * @ht_required: stations must support HT
  1237. * @vht_required: stations must support VHT
  1238. * @twt_responder: Enable Target Wait Time
  1239. * @he_required: stations must support HE
  1240. * @sae_h2e_required: stations must support direct H2E technique in SAE
  1241. * @flags: flags, as defined in enum cfg80211_ap_settings_flags
  1242. * @he_obss_pd: OBSS Packet Detection settings
  1243. * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
  1244. * @fils_discovery: FILS discovery transmission parameters
  1245. * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
  1246. * @mbssid_config: AP settings for multiple bssid
  1247. * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
  1248. * a 20 MHz channel, lowest bit corresponding to the lowest channel.
  1249. * Bit set to 1 indicates that the channel is punctured.
  1250. */
  1251. struct cfg80211_ap_settings {
  1252. struct cfg80211_chan_def chandef;
  1253. struct cfg80211_beacon_data beacon;
  1254. int beacon_interval, dtim_period;
  1255. const u8 *ssid;
  1256. size_t ssid_len;
  1257. enum nl80211_hidden_ssid hidden_ssid;
  1258. struct cfg80211_crypto_settings crypto;
  1259. bool privacy;
  1260. enum nl80211_auth_type auth_type;
  1261. enum nl80211_smps_mode smps_mode;
  1262. int inactivity_timeout;
  1263. u8 p2p_ctwindow;
  1264. bool p2p_opp_ps;
  1265. const struct cfg80211_acl_data *acl;
  1266. bool pbss;
  1267. struct cfg80211_bitrate_mask beacon_rate;
  1268. const struct ieee80211_ht_cap *ht_cap;
  1269. const struct ieee80211_vht_cap *vht_cap;
  1270. const struct ieee80211_he_cap_elem *he_cap;
  1271. const struct ieee80211_he_operation *he_oper;
  1272. const struct ieee80211_eht_cap_elem *eht_cap;
  1273. const struct ieee80211_eht_operation *eht_oper;
  1274. bool ht_required, vht_required, he_required, sae_h2e_required;
  1275. bool twt_responder;
  1276. u32 flags;
  1277. struct ieee80211_he_obss_pd he_obss_pd;
  1278. struct cfg80211_fils_discovery fils_discovery;
  1279. struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
  1280. struct cfg80211_mbssid_config mbssid_config;
  1281. u16 punct_bitmap;
  1282. ANDROID_KABI_RESERVE(1);
  1283. };
  1284. /**
  1285. * struct cfg80211_csa_settings - channel switch settings
  1286. *
  1287. * Used for channel switch
  1288. *
  1289. * @chandef: defines the channel to use after the switch
  1290. * @beacon_csa: beacon data while performing the switch
  1291. * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
  1292. * @counter_offsets_presp: offsets of the counters within the probe response
  1293. * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
  1294. * @n_counter_offsets_presp: number of csa counters in the probe response
  1295. * @beacon_after: beacon data to be used on the new channel
  1296. * @radar_required: whether radar detection is required on the new channel
  1297. * @block_tx: whether transmissions should be blocked while changing
  1298. * @count: number of beacons until switch
  1299. * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
  1300. * a 20 MHz channel, lowest bit corresponding to the lowest channel.
  1301. * Bit set to 1 indicates that the channel is punctured.
  1302. */
  1303. struct cfg80211_csa_settings {
  1304. struct cfg80211_chan_def chandef;
  1305. struct cfg80211_beacon_data beacon_csa;
  1306. const u16 *counter_offsets_beacon;
  1307. const u16 *counter_offsets_presp;
  1308. unsigned int n_counter_offsets_beacon;
  1309. unsigned int n_counter_offsets_presp;
  1310. struct cfg80211_beacon_data beacon_after;
  1311. bool radar_required;
  1312. bool block_tx;
  1313. u8 count;
  1314. u16 punct_bitmap;
  1315. ANDROID_KABI_RESERVE(1);
  1316. };
  1317. /**
  1318. * struct cfg80211_color_change_settings - color change settings
  1319. *
  1320. * Used for bss color change
  1321. *
  1322. * @beacon_color_change: beacon data while performing the color countdown
  1323. * @counter_offset_beacon: offsets of the counters within the beacon (tail)
  1324. * @counter_offset_presp: offsets of the counters within the probe response
  1325. * @beacon_next: beacon data to be used after the color change
  1326. * @count: number of beacons until the color change
  1327. * @color: the color used after the change
  1328. */
  1329. struct cfg80211_color_change_settings {
  1330. struct cfg80211_beacon_data beacon_color_change;
  1331. u16 counter_offset_beacon;
  1332. u16 counter_offset_presp;
  1333. struct cfg80211_beacon_data beacon_next;
  1334. u8 count;
  1335. u8 color;
  1336. };
  1337. /**
  1338. * struct iface_combination_params - input parameters for interface combinations
  1339. *
  1340. * Used to pass interface combination parameters
  1341. *
  1342. * @num_different_channels: the number of different channels we want
  1343. * to use for verification
  1344. * @radar_detect: a bitmap where each bit corresponds to a channel
  1345. * width where radar detection is needed, as in the definition of
  1346. * &struct ieee80211_iface_combination.@radar_detect_widths
  1347. * @iftype_num: array with the number of interfaces of each interface
  1348. * type. The index is the interface type as specified in &enum
  1349. * nl80211_iftype.
  1350. * @new_beacon_int: set this to the beacon interval of a new interface
  1351. * that's not operating yet, if such is to be checked as part of
  1352. * the verification
  1353. */
  1354. struct iface_combination_params {
  1355. int num_different_channels;
  1356. u8 radar_detect;
  1357. int iftype_num[NUM_NL80211_IFTYPES];
  1358. u32 new_beacon_int;
  1359. };
  1360. /**
  1361. * enum station_parameters_apply_mask - station parameter values to apply
  1362. * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
  1363. * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
  1364. * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
  1365. * @STATION_PARAM_APPLY_STA_TXPOWER: apply tx power for STA
  1366. *
  1367. * Not all station parameters have in-band "no change" signalling,
  1368. * for those that don't these flags will are used.
  1369. */
  1370. enum station_parameters_apply_mask {
  1371. STATION_PARAM_APPLY_UAPSD = BIT(0),
  1372. STATION_PARAM_APPLY_CAPABILITY = BIT(1),
  1373. STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
  1374. };
  1375. /**
  1376. * struct sta_txpwr - station txpower configuration
  1377. *
  1378. * Used to configure txpower for station.
  1379. *
  1380. * @power: tx power (in dBm) to be used for sending data traffic. If tx power
  1381. * is not provided, the default per-interface tx power setting will be
  1382. * overriding. Driver should be picking up the lowest tx power, either tx
  1383. * power per-interface or per-station.
  1384. * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
  1385. * will be less than or equal to specified from userspace, whereas if TPC
  1386. * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
  1387. * NL80211_TX_POWER_FIXED is not a valid configuration option for
  1388. * per peer TPC.
  1389. */
  1390. struct sta_txpwr {
  1391. s16 power;
  1392. enum nl80211_tx_power_setting type;
  1393. };
  1394. /**
  1395. * struct link_station_parameters - link station parameters
  1396. *
  1397. * Used to change and create a new link station.
  1398. *
  1399. * @mld_mac: MAC address of the station
  1400. * @link_id: the link id (-1 for non-MLD station)
  1401. * @link_mac: MAC address of the link
  1402. * @supported_rates: supported rates in IEEE 802.11 format
  1403. * (or NULL for no change)
  1404. * @supported_rates_len: number of supported rates
  1405. * @ht_capa: HT capabilities of station
  1406. * @vht_capa: VHT capabilities of station
  1407. * @opmode_notif: operating mode field from Operating Mode Notification
  1408. * @opmode_notif_used: information if operating mode field is used
  1409. * @he_capa: HE capabilities of station
  1410. * @he_capa_len: the length of the HE capabilities
  1411. * @txpwr: transmit power for an associated station
  1412. * @txpwr_set: txpwr field is set
  1413. * @he_6ghz_capa: HE 6 GHz Band capabilities of station
  1414. * @eht_capa: EHT capabilities of station
  1415. * @eht_capa_len: the length of the EHT capabilities
  1416. */
  1417. struct link_station_parameters {
  1418. const u8 *mld_mac;
  1419. int link_id;
  1420. const u8 *link_mac;
  1421. const u8 *supported_rates;
  1422. u8 supported_rates_len;
  1423. const struct ieee80211_ht_cap *ht_capa;
  1424. const struct ieee80211_vht_cap *vht_capa;
  1425. u8 opmode_notif;
  1426. bool opmode_notif_used;
  1427. const struct ieee80211_he_cap_elem *he_capa;
  1428. u8 he_capa_len;
  1429. struct sta_txpwr txpwr;
  1430. bool txpwr_set;
  1431. const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
  1432. const struct ieee80211_eht_cap_elem *eht_capa;
  1433. u8 eht_capa_len;
  1434. ANDROID_KABI_RESERVE(1);
  1435. };
  1436. /**
  1437. * struct link_station_del_parameters - link station deletion parameters
  1438. *
  1439. * Used to delete a link station entry (or all stations).
  1440. *
  1441. * @mld_mac: MAC address of the station
  1442. * @link_id: the link id
  1443. */
  1444. struct link_station_del_parameters {
  1445. const u8 *mld_mac;
  1446. u32 link_id;
  1447. };
  1448. /**
  1449. * struct station_parameters - station parameters
  1450. *
  1451. * Used to change and create a new station.
  1452. *
  1453. * @vlan: vlan interface station should belong to
  1454. * @sta_flags_mask: station flags that changed
  1455. * (bitmask of BIT(%NL80211_STA_FLAG_...))
  1456. * @sta_flags_set: station flags values
  1457. * (bitmask of BIT(%NL80211_STA_FLAG_...))
  1458. * @listen_interval: listen interval or -1 for no change
  1459. * @aid: AID or zero for no change
  1460. * @vlan_id: VLAN ID for station (if nonzero)
  1461. * @peer_aid: mesh peer AID or zero for no change
  1462. * @plink_action: plink action to take
  1463. * @plink_state: set the peer link state for a station
  1464. * @uapsd_queues: bitmap of queues configured for uapsd. same format
  1465. * as the AC bitmap in the QoS info field
  1466. * @max_sp: max Service Period. same format as the MAX_SP in the
  1467. * QoS info field (but already shifted down)
  1468. * @sta_modify_mask: bitmap indicating which parameters changed
  1469. * (for those that don't have a natural "no change" value),
  1470. * see &enum station_parameters_apply_mask
  1471. * @local_pm: local link-specific mesh power save mode (no change when set
  1472. * to unknown)
  1473. * @capability: station capability
  1474. * @ext_capab: extended capabilities of the station
  1475. * @ext_capab_len: number of extended capabilities
  1476. * @supported_channels: supported channels in IEEE 802.11 format
  1477. * @supported_channels_len: number of supported channels
  1478. * @supported_oper_classes: supported oper classes in IEEE 802.11 format
  1479. * @supported_oper_classes_len: number of supported operating classes
  1480. * @support_p2p_ps: information if station supports P2P PS mechanism
  1481. * @airtime_weight: airtime scheduler weight for this station
  1482. * @link_sta_params: link related params.
  1483. */
  1484. struct station_parameters {
  1485. struct net_device *vlan;
  1486. u32 sta_flags_mask, sta_flags_set;
  1487. u32 sta_modify_mask;
  1488. int listen_interval;
  1489. u16 aid;
  1490. u16 vlan_id;
  1491. u16 peer_aid;
  1492. u8 plink_action;
  1493. u8 plink_state;
  1494. u8 uapsd_queues;
  1495. u8 max_sp;
  1496. enum nl80211_mesh_power_mode local_pm;
  1497. u16 capability;
  1498. const u8 *ext_capab;
  1499. u8 ext_capab_len;
  1500. const u8 *supported_channels;
  1501. u8 supported_channels_len;
  1502. const u8 *supported_oper_classes;
  1503. u8 supported_oper_classes_len;
  1504. int support_p2p_ps;
  1505. u16 airtime_weight;
  1506. struct link_station_parameters link_sta_params;
  1507. };
  1508. /**
  1509. * struct station_del_parameters - station deletion parameters
  1510. *
  1511. * Used to delete a station entry (or all stations).
  1512. *
  1513. * @mac: MAC address of the station to remove or NULL to remove all stations
  1514. * @subtype: Management frame subtype to use for indicating removal
  1515. * (10 = Disassociation, 12 = Deauthentication)
  1516. * @reason_code: Reason code for the Disassociation/Deauthentication frame
  1517. */
  1518. struct station_del_parameters {
  1519. const u8 *mac;
  1520. u8 subtype;
  1521. u16 reason_code;
  1522. };
  1523. /**
  1524. * enum cfg80211_station_type - the type of station being modified
  1525. * @CFG80211_STA_AP_CLIENT: client of an AP interface
  1526. * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
  1527. * unassociated (update properties for this type of client is permitted)
  1528. * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
  1529. * the AP MLME in the device
  1530. * @CFG80211_STA_AP_STA: AP station on managed interface
  1531. * @CFG80211_STA_IBSS: IBSS station
  1532. * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
  1533. * while TDLS setup is in progress, it moves out of this state when
  1534. * being marked authorized; use this only if TDLS with external setup is
  1535. * supported/used)
  1536. * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
  1537. * entry that is operating, has been marked authorized by userspace)
  1538. * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
  1539. * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
  1540. */
  1541. enum cfg80211_station_type {
  1542. CFG80211_STA_AP_CLIENT,
  1543. CFG80211_STA_AP_CLIENT_UNASSOC,
  1544. CFG80211_STA_AP_MLME_CLIENT,
  1545. CFG80211_STA_AP_STA,
  1546. CFG80211_STA_IBSS,
  1547. CFG80211_STA_TDLS_PEER_SETUP,
  1548. CFG80211_STA_TDLS_PEER_ACTIVE,
  1549. CFG80211_STA_MESH_PEER_KERNEL,
  1550. CFG80211_STA_MESH_PEER_USER,
  1551. };
  1552. /**
  1553. * cfg80211_check_station_change - validate parameter changes
  1554. * @wiphy: the wiphy this operates on
  1555. * @params: the new parameters for a station
  1556. * @statype: the type of station being modified
  1557. *
  1558. * Utility function for the @change_station driver method. Call this function
  1559. * with the appropriate station type looking up the station (and checking that
  1560. * it exists). It will verify whether the station change is acceptable, and if
  1561. * not will return an error code. Note that it may modify the parameters for
  1562. * backward compatibility reasons, so don't use them before calling this.
  1563. */
  1564. int cfg80211_check_station_change(struct wiphy *wiphy,
  1565. struct station_parameters *params,
  1566. enum cfg80211_station_type statype);
  1567. /**
  1568. * enum rate_info_flags - bitrate info flags
  1569. *
  1570. * Used by the driver to indicate the specific rate transmission
  1571. * type for 802.11n transmissions.
  1572. *
  1573. * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
  1574. * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
  1575. * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
  1576. * @RATE_INFO_FLAGS_DMG: 60GHz MCS
  1577. * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
  1578. * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
  1579. * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
  1580. * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information
  1581. */
  1582. enum rate_info_flags {
  1583. RATE_INFO_FLAGS_MCS = BIT(0),
  1584. RATE_INFO_FLAGS_VHT_MCS = BIT(1),
  1585. RATE_INFO_FLAGS_SHORT_GI = BIT(2),
  1586. RATE_INFO_FLAGS_DMG = BIT(3),
  1587. RATE_INFO_FLAGS_HE_MCS = BIT(4),
  1588. RATE_INFO_FLAGS_EDMG = BIT(5),
  1589. RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6),
  1590. RATE_INFO_FLAGS_EHT_MCS = BIT(7),
  1591. };
  1592. /**
  1593. * enum rate_info_bw - rate bandwidth information
  1594. *
  1595. * Used by the driver to indicate the rate bandwidth.
  1596. *
  1597. * @RATE_INFO_BW_5: 5 MHz bandwidth
  1598. * @RATE_INFO_BW_10: 10 MHz bandwidth
  1599. * @RATE_INFO_BW_20: 20 MHz bandwidth
  1600. * @RATE_INFO_BW_40: 40 MHz bandwidth
  1601. * @RATE_INFO_BW_80: 80 MHz bandwidth
  1602. * @RATE_INFO_BW_160: 160 MHz bandwidth
  1603. * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
  1604. * @RATE_INFO_BW_320: 320 MHz bandwidth
  1605. * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation
  1606. */
  1607. enum rate_info_bw {
  1608. RATE_INFO_BW_20 = 0,
  1609. RATE_INFO_BW_5,
  1610. RATE_INFO_BW_10,
  1611. RATE_INFO_BW_40,
  1612. RATE_INFO_BW_80,
  1613. RATE_INFO_BW_160,
  1614. RATE_INFO_BW_HE_RU,
  1615. RATE_INFO_BW_320,
  1616. RATE_INFO_BW_EHT_RU,
  1617. };
  1618. /**
  1619. * struct rate_info - bitrate information
  1620. *
  1621. * Information about a receiving or transmitting bitrate
  1622. *
  1623. * @flags: bitflag of flags from &enum rate_info_flags
  1624. * @mcs: mcs index if struct describes an HT/VHT/HE rate
  1625. * @legacy: bitrate in 100kbit/s for 802.11abg
  1626. * @nss: number of streams (VHT & HE only)
  1627. * @bw: bandwidth (from &enum rate_info_bw)
  1628. * @he_gi: HE guard interval (from &enum nl80211_he_gi)
  1629. * @he_dcm: HE DCM value
  1630. * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
  1631. * only valid if bw is %RATE_INFO_BW_HE_RU)
  1632. * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
  1633. * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)
  1634. * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
  1635. * only valid if bw is %RATE_INFO_BW_EHT_RU)
  1636. */
  1637. struct rate_info {
  1638. u8 flags;
  1639. u8 mcs;
  1640. u16 legacy;
  1641. u8 nss;
  1642. u8 bw;
  1643. u8 he_gi;
  1644. u8 he_dcm;
  1645. u8 he_ru_alloc;
  1646. u8 n_bonded_ch;
  1647. u8 eht_gi;
  1648. u8 eht_ru_alloc;
  1649. };
  1650. /**
  1651. * enum bss_param_flags - bitrate info flags
  1652. *
  1653. * Used by the driver to indicate the specific rate transmission
  1654. * type for 802.11n transmissions.
  1655. *
  1656. * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
  1657. * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
  1658. * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
  1659. */
  1660. enum bss_param_flags {
  1661. BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
  1662. BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
  1663. BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
  1664. };
  1665. /**
  1666. * struct sta_bss_parameters - BSS parameters for the attached station
  1667. *
  1668. * Information about the currently associated BSS
  1669. *
  1670. * @flags: bitflag of flags from &enum bss_param_flags
  1671. * @dtim_period: DTIM period for the BSS
  1672. * @beacon_interval: beacon interval
  1673. */
  1674. struct sta_bss_parameters {
  1675. u8 flags;
  1676. u8 dtim_period;
  1677. u16 beacon_interval;
  1678. };
  1679. /**
  1680. * struct cfg80211_txq_stats - TXQ statistics for this TID
  1681. * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
  1682. * indicate the relevant values in this struct are filled
  1683. * @backlog_bytes: total number of bytes currently backlogged
  1684. * @backlog_packets: total number of packets currently backlogged
  1685. * @flows: number of new flows seen
  1686. * @drops: total number of packets dropped
  1687. * @ecn_marks: total number of packets marked with ECN CE
  1688. * @overlimit: number of drops due to queue space overflow
  1689. * @overmemory: number of drops due to memory limit overflow
  1690. * @collisions: number of hash collisions
  1691. * @tx_bytes: total number of bytes dequeued
  1692. * @tx_packets: total number of packets dequeued
  1693. * @max_flows: maximum number of flows supported
  1694. */
  1695. struct cfg80211_txq_stats {
  1696. u32 filled;
  1697. u32 backlog_bytes;
  1698. u32 backlog_packets;
  1699. u32 flows;
  1700. u32 drops;
  1701. u32 ecn_marks;
  1702. u32 overlimit;
  1703. u32 overmemory;
  1704. u32 collisions;
  1705. u32 tx_bytes;
  1706. u32 tx_packets;
  1707. u32 max_flows;
  1708. };
  1709. /**
  1710. * struct cfg80211_tid_stats - per-TID statistics
  1711. * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
  1712. * indicate the relevant values in this struct are filled
  1713. * @rx_msdu: number of received MSDUs
  1714. * @tx_msdu: number of (attempted) transmitted MSDUs
  1715. * @tx_msdu_retries: number of retries (not counting the first) for
  1716. * transmitted MSDUs
  1717. * @tx_msdu_failed: number of failed transmitted MSDUs
  1718. * @txq_stats: TXQ statistics
  1719. */
  1720. struct cfg80211_tid_stats {
  1721. u32 filled;
  1722. u64 rx_msdu;
  1723. u64 tx_msdu;
  1724. u64 tx_msdu_retries;
  1725. u64 tx_msdu_failed;
  1726. struct cfg80211_txq_stats txq_stats;
  1727. };
  1728. #define IEEE80211_MAX_CHAINS 4
  1729. /**
  1730. * struct station_info - station information
  1731. *
  1732. * Station information filled by driver for get_station() and dump_station.
  1733. *
  1734. * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
  1735. * indicate the relevant values in this struct for them
  1736. * @connected_time: time(in secs) since a station is last connected
  1737. * @inactive_time: time since last station activity (tx/rx) in milliseconds
  1738. * @assoc_at: bootime (ns) of the last association
  1739. * @rx_bytes: bytes (size of MPDUs) received from this station
  1740. * @tx_bytes: bytes (size of MPDUs) transmitted to this station
  1741. * @llid: mesh local link id
  1742. * @plid: mesh peer link id
  1743. * @plink_state: mesh peer link state
  1744. * @signal: The signal strength, type depends on the wiphy's signal_type.
  1745. * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
  1746. * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
  1747. * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
  1748. * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
  1749. * @chain_signal: per-chain signal strength of last received packet in dBm
  1750. * @chain_signal_avg: per-chain signal strength average in dBm
  1751. * @txrate: current unicast bitrate from this station
  1752. * @rxrate: current unicast bitrate to this station
  1753. * @rx_packets: packets (MSDUs & MMPDUs) received from this station
  1754. * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
  1755. * @tx_retries: cumulative retry counts (MPDUs)
  1756. * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
  1757. * @rx_dropped_misc: Dropped for un-specified reason.
  1758. * @bss_param: current BSS parameters
  1759. * @generation: generation number for nl80211 dumps.
  1760. * This number should increase every time the list of stations
  1761. * changes, i.e. when a station is added or removed, so that
  1762. * userspace can tell whether it got a consistent snapshot.
  1763. * @assoc_req_ies: IEs from (Re)Association Request.
  1764. * This is used only when in AP mode with drivers that do not use
  1765. * user space MLME/SME implementation. The information is provided for
  1766. * the cfg80211_new_sta() calls to notify user space of the IEs.
  1767. * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
  1768. * @sta_flags: station flags mask & values
  1769. * @beacon_loss_count: Number of times beacon loss event has triggered.
  1770. * @t_offset: Time offset of the station relative to this host.
  1771. * @local_pm: local mesh STA power save mode
  1772. * @peer_pm: peer mesh STA power save mode
  1773. * @nonpeer_pm: non-peer mesh STA power save mode
  1774. * @expected_throughput: expected throughput in kbps (including 802.11 headers)
  1775. * towards this station.
  1776. * @rx_beacon: number of beacons received from this peer
  1777. * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  1778. * from this peer
  1779. * @connected_to_gate: true if mesh STA has a path to mesh gate
  1780. * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
  1781. * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
  1782. * @airtime_weight: current airtime scheduling weight
  1783. * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
  1784. * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  1785. * Note that this doesn't use the @filled bit, but is used if non-NULL.
  1786. * @ack_signal: signal strength (in dBm) of the last ACK frame.
  1787. * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
  1788. * been sent.
  1789. * @rx_mpdu_count: number of MPDUs received from this station
  1790. * @fcs_err_count: number of packets (MPDUs) received from this station with
  1791. * an FCS error. This counter should be incremented only when TA of the
  1792. * received packet with an FCS error matches the peer MAC address.
  1793. * @airtime_link_metric: mesh airtime link metric.
  1794. * @connected_to_as: true if mesh STA has a path to authentication server
  1795. * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled
  1796. * by driver. Drivers use this only in cfg80211_new_sta() calls when AP
  1797. * MLD's MLME/SME is offload to driver. Drivers won't fill this
  1798. * information in cfg80211_del_sta_sinfo(), get_station() and
  1799. * dump_station() callbacks.
  1800. * @assoc_link_id: Indicates MLO link ID of the AP, with which the station
  1801. * completed (re)association. This information filled for both MLO
  1802. * and non-MLO STA connections when the AP affiliated with an MLD.
  1803. * @mld_addr: For MLO STA connection, filled with MLD address of the station.
  1804. * For non-MLO STA connection, filled with all zeros.
  1805. * @assoc_resp_ies: IEs from (Re)Association Response.
  1806. * This is used only when in AP mode with drivers that do not use user
  1807. * space MLME/SME implementation. The information is provided only for the
  1808. * cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't
  1809. * fill this information in cfg80211_del_sta_sinfo(), get_station() and
  1810. * dump_station() callbacks. User space needs this information to determine
  1811. * the accepted and rejected affiliated links of the connected station.
  1812. * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.
  1813. */
  1814. struct station_info {
  1815. u64 filled;
  1816. u32 connected_time;
  1817. u32 inactive_time;
  1818. u64 assoc_at;
  1819. u64 rx_bytes;
  1820. u64 tx_bytes;
  1821. u16 llid;
  1822. u16 plid;
  1823. u8 plink_state;
  1824. s8 signal;
  1825. s8 signal_avg;
  1826. u8 chains;
  1827. s8 chain_signal[IEEE80211_MAX_CHAINS];
  1828. s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
  1829. struct rate_info txrate;
  1830. struct rate_info rxrate;
  1831. u32 rx_packets;
  1832. u32 tx_packets;
  1833. u32 tx_retries;
  1834. u32 tx_failed;
  1835. u32 rx_dropped_misc;
  1836. struct sta_bss_parameters bss_param;
  1837. struct nl80211_sta_flag_update sta_flags;
  1838. int generation;
  1839. const u8 *assoc_req_ies;
  1840. size_t assoc_req_ies_len;
  1841. u32 beacon_loss_count;
  1842. s64 t_offset;
  1843. enum nl80211_mesh_power_mode local_pm;
  1844. enum nl80211_mesh_power_mode peer_pm;
  1845. enum nl80211_mesh_power_mode nonpeer_pm;
  1846. u32 expected_throughput;
  1847. u64 tx_duration;
  1848. u64 rx_duration;
  1849. u64 rx_beacon;
  1850. u8 rx_beacon_signal_avg;
  1851. u8 connected_to_gate;
  1852. struct cfg80211_tid_stats *pertid;
  1853. s8 ack_signal;
  1854. s8 avg_ack_signal;
  1855. u16 airtime_weight;
  1856. u32 rx_mpdu_count;
  1857. u32 fcs_err_count;
  1858. u32 airtime_link_metric;
  1859. u8 connected_to_as;
  1860. bool mlo_params_valid;
  1861. u8 assoc_link_id;
  1862. u8 mld_addr[ETH_ALEN] __aligned(2);
  1863. const u8 *assoc_resp_ies;
  1864. size_t assoc_resp_ies_len;
  1865. ANDROID_KABI_RESERVE(1);
  1866. };
  1867. /**
  1868. * struct cfg80211_sar_sub_specs - sub specs limit
  1869. * @power: power limitation in 0.25dbm
  1870. * @freq_range_index: index the power limitation applies to
  1871. */
  1872. struct cfg80211_sar_sub_specs {
  1873. s32 power;
  1874. u32 freq_range_index;
  1875. };
  1876. /**
  1877. * struct cfg80211_sar_specs - sar limit specs
  1878. * @type: it's set with power in 0.25dbm or other types
  1879. * @num_sub_specs: number of sar sub specs
  1880. * @sub_specs: memory to hold the sar sub specs
  1881. */
  1882. struct cfg80211_sar_specs {
  1883. enum nl80211_sar_type type;
  1884. u32 num_sub_specs;
  1885. struct cfg80211_sar_sub_specs sub_specs[];
  1886. };
  1887. /**
  1888. * struct cfg80211_sar_freq_ranges - sar frequency ranges
  1889. * @start_freq: start range edge frequency
  1890. * @end_freq: end range edge frequency
  1891. */
  1892. struct cfg80211_sar_freq_ranges {
  1893. u32 start_freq;
  1894. u32 end_freq;
  1895. };
  1896. /**
  1897. * struct cfg80211_sar_capa - sar limit capability
  1898. * @type: it's set via power in 0.25dbm or other types
  1899. * @num_freq_ranges: number of frequency ranges
  1900. * @freq_ranges: memory to hold the freq ranges.
  1901. *
  1902. * Note: WLAN driver may append new ranges or split an existing
  1903. * range to small ones and then append them.
  1904. */
  1905. struct cfg80211_sar_capa {
  1906. enum nl80211_sar_type type;
  1907. u32 num_freq_ranges;
  1908. const struct cfg80211_sar_freq_ranges *freq_ranges;
  1909. };
  1910. #if IS_ENABLED(CONFIG_CFG80211)
  1911. /**
  1912. * cfg80211_get_station - retrieve information about a given station
  1913. * @dev: the device where the station is supposed to be connected to
  1914. * @mac_addr: the mac address of the station of interest
  1915. * @sinfo: pointer to the structure to fill with the information
  1916. *
  1917. * Returns 0 on success and sinfo is filled with the available information
  1918. * otherwise returns a negative error code and the content of sinfo has to be
  1919. * considered undefined.
  1920. */
  1921. int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
  1922. struct station_info *sinfo);
  1923. #else
  1924. static inline int cfg80211_get_station(struct net_device *dev,
  1925. const u8 *mac_addr,
  1926. struct station_info *sinfo)
  1927. {
  1928. return -ENOENT;
  1929. }
  1930. #endif
  1931. /**
  1932. * enum monitor_flags - monitor flags
  1933. *
  1934. * Monitor interface configuration flags. Note that these must be the bits
  1935. * according to the nl80211 flags.
  1936. *
  1937. * @MONITOR_FLAG_CHANGED: set if the flags were changed
  1938. * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
  1939. * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
  1940. * @MONITOR_FLAG_CONTROL: pass control frames
  1941. * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
  1942. * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
  1943. * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
  1944. */
  1945. enum monitor_flags {
  1946. MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
  1947. MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
  1948. MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
  1949. MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
  1950. MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
  1951. MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
  1952. MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
  1953. };
  1954. /**
  1955. * enum mpath_info_flags - mesh path information flags
  1956. *
  1957. * Used by the driver to indicate which info in &struct mpath_info it has filled
  1958. * in during get_station() or dump_station().
  1959. *
  1960. * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
  1961. * @MPATH_INFO_SN: @sn filled
  1962. * @MPATH_INFO_METRIC: @metric filled
  1963. * @MPATH_INFO_EXPTIME: @exptime filled
  1964. * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
  1965. * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
  1966. * @MPATH_INFO_FLAGS: @flags filled
  1967. * @MPATH_INFO_HOP_COUNT: @hop_count filled
  1968. * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
  1969. */
  1970. enum mpath_info_flags {
  1971. MPATH_INFO_FRAME_QLEN = BIT(0),
  1972. MPATH_INFO_SN = BIT(1),
  1973. MPATH_INFO_METRIC = BIT(2),
  1974. MPATH_INFO_EXPTIME = BIT(3),
  1975. MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
  1976. MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
  1977. MPATH_INFO_FLAGS = BIT(6),
  1978. MPATH_INFO_HOP_COUNT = BIT(7),
  1979. MPATH_INFO_PATH_CHANGE = BIT(8),
  1980. };
  1981. /**
  1982. * struct mpath_info - mesh path information
  1983. *
  1984. * Mesh path information filled by driver for get_mpath() and dump_mpath().
  1985. *
  1986. * @filled: bitfield of flags from &enum mpath_info_flags
  1987. * @frame_qlen: number of queued frames for this destination
  1988. * @sn: target sequence number
  1989. * @metric: metric (cost) of this mesh path
  1990. * @exptime: expiration time for the mesh path from now, in msecs
  1991. * @flags: mesh path flags
  1992. * @discovery_timeout: total mesh path discovery timeout, in msecs
  1993. * @discovery_retries: mesh path discovery retries
  1994. * @generation: generation number for nl80211 dumps.
  1995. * This number should increase every time the list of mesh paths
  1996. * changes, i.e. when a station is added or removed, so that
  1997. * userspace can tell whether it got a consistent snapshot.
  1998. * @hop_count: hops to destination
  1999. * @path_change_count: total number of path changes to destination
  2000. */
  2001. struct mpath_info {
  2002. u32 filled;
  2003. u32 frame_qlen;
  2004. u32 sn;
  2005. u32 metric;
  2006. u32 exptime;
  2007. u32 discovery_timeout;
  2008. u8 discovery_retries;
  2009. u8 flags;
  2010. u8 hop_count;
  2011. u32 path_change_count;
  2012. int generation;
  2013. };
  2014. /**
  2015. * struct bss_parameters - BSS parameters
  2016. *
  2017. * Used to change BSS parameters (mainly for AP mode).
  2018. *
  2019. * @link_id: link_id or -1 for non-MLD
  2020. * @use_cts_prot: Whether to use CTS protection
  2021. * (0 = no, 1 = yes, -1 = do not change)
  2022. * @use_short_preamble: Whether the use of short preambles is allowed
  2023. * (0 = no, 1 = yes, -1 = do not change)
  2024. * @use_short_slot_time: Whether the use of short slot time is allowed
  2025. * (0 = no, 1 = yes, -1 = do not change)
  2026. * @basic_rates: basic rates in IEEE 802.11 format
  2027. * (or NULL for no change)
  2028. * @basic_rates_len: number of basic rates
  2029. * @ap_isolate: do not forward packets between connected stations
  2030. * (0 = no, 1 = yes, -1 = do not change)
  2031. * @ht_opmode: HT Operation mode
  2032. * (u16 = opmode, -1 = do not change)
  2033. * @p2p_ctwindow: P2P CT Window (-1 = no change)
  2034. * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
  2035. */
  2036. struct bss_parameters {
  2037. int link_id;
  2038. int use_cts_prot;
  2039. int use_short_preamble;
  2040. int use_short_slot_time;
  2041. const u8 *basic_rates;
  2042. u8 basic_rates_len;
  2043. int ap_isolate;
  2044. int ht_opmode;
  2045. s8 p2p_ctwindow, p2p_opp_ps;
  2046. };
  2047. /**
  2048. * struct mesh_config - 802.11s mesh configuration
  2049. *
  2050. * These parameters can be changed while the mesh is active.
  2051. *
  2052. * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
  2053. * by the Mesh Peering Open message
  2054. * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
  2055. * used by the Mesh Peering Open message
  2056. * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
  2057. * the mesh peering management to close a mesh peering
  2058. * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
  2059. * mesh interface
  2060. * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
  2061. * be sent to establish a new peer link instance in a mesh
  2062. * @dot11MeshTTL: the value of TTL field set at a source mesh STA
  2063. * @element_ttl: the value of TTL field set at a mesh STA for path selection
  2064. * elements
  2065. * @auto_open_plinks: whether we should automatically open peer links when we
  2066. * detect compatible mesh peers
  2067. * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
  2068. * synchronize to for 11s default synchronization method
  2069. * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
  2070. * that an originator mesh STA can send to a particular path target
  2071. * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
  2072. * @min_discovery_timeout: the minimum length of time to wait until giving up on
  2073. * a path discovery in milliseconds
  2074. * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
  2075. * receiving a PREQ shall consider the forwarding information from the
  2076. * root to be valid. (TU = time unit)
  2077. * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
  2078. * which a mesh STA can send only one action frame containing a PREQ
  2079. * element
  2080. * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
  2081. * which a mesh STA can send only one Action frame containing a PERR
  2082. * element
  2083. * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
  2084. * it takes for an HWMP information element to propagate across the mesh
  2085. * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
  2086. * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
  2087. * announcements are transmitted
  2088. * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
  2089. * station has access to a broader network beyond the MBSS. (This is
  2090. * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
  2091. * only means that the station will announce others it's a mesh gate, but
  2092. * not necessarily using the gate announcement protocol. Still keeping the
  2093. * same nomenclature to be in sync with the spec)
  2094. * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
  2095. * entity (default is TRUE - forwarding entity)
  2096. * @rssi_threshold: the threshold for average signal strength of candidate
  2097. * station to establish a peer link
  2098. * @ht_opmode: mesh HT protection mode
  2099. *
  2100. * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
  2101. * receiving a proactive PREQ shall consider the forwarding information to
  2102. * the root mesh STA to be valid.
  2103. *
  2104. * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
  2105. * PREQs are transmitted.
  2106. * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
  2107. * during which a mesh STA can send only one Action frame containing
  2108. * a PREQ element for root path confirmation.
  2109. * @power_mode: The default mesh power save mode which will be the initial
  2110. * setting for new peer links.
  2111. * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
  2112. * after transmitting its beacon.
  2113. * @plink_timeout: If no tx activity is seen from a STA we've established
  2114. * peering with for longer than this time (in seconds), then remove it
  2115. * from the STA's list of peers. Default is 30 minutes.
  2116. * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA
  2117. * will advertise that it is connected to a authentication server
  2118. * in the mesh formation field.
  2119. * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
  2120. * connected to a mesh gate in mesh formation info. If false, the
  2121. * value in mesh formation is determined by the presence of root paths
  2122. * in the mesh path table
  2123. * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
  2124. * for HWMP) if the destination is a direct neighbor. Note that this might
  2125. * not be the optimal decision as a multi-hop route might be better. So
  2126. * if using this setting you will likely also want to disable
  2127. * dot11MeshForwarding and use another mesh routing protocol on top.
  2128. */
  2129. struct mesh_config {
  2130. u16 dot11MeshRetryTimeout;
  2131. u16 dot11MeshConfirmTimeout;
  2132. u16 dot11MeshHoldingTimeout;
  2133. u16 dot11MeshMaxPeerLinks;
  2134. u8 dot11MeshMaxRetries;
  2135. u8 dot11MeshTTL;
  2136. u8 element_ttl;
  2137. bool auto_open_plinks;
  2138. u32 dot11MeshNbrOffsetMaxNeighbor;
  2139. u8 dot11MeshHWMPmaxPREQretries;
  2140. u32 path_refresh_time;
  2141. u16 min_discovery_timeout;
  2142. u32 dot11MeshHWMPactivePathTimeout;
  2143. u16 dot11MeshHWMPpreqMinInterval;
  2144. u16 dot11MeshHWMPperrMinInterval;
  2145. u16 dot11MeshHWMPnetDiameterTraversalTime;
  2146. u8 dot11MeshHWMPRootMode;
  2147. bool dot11MeshConnectedToMeshGate;
  2148. bool dot11MeshConnectedToAuthServer;
  2149. u16 dot11MeshHWMPRannInterval;
  2150. bool dot11MeshGateAnnouncementProtocol;
  2151. bool dot11MeshForwarding;
  2152. s32 rssi_threshold;
  2153. u16 ht_opmode;
  2154. u32 dot11MeshHWMPactivePathToRootTimeout;
  2155. u16 dot11MeshHWMProotInterval;
  2156. u16 dot11MeshHWMPconfirmationInterval;
  2157. enum nl80211_mesh_power_mode power_mode;
  2158. u16 dot11MeshAwakeWindowDuration;
  2159. u32 plink_timeout;
  2160. bool dot11MeshNolearn;
  2161. ANDROID_KABI_RESERVE(1);
  2162. };
  2163. /**
  2164. * struct mesh_setup - 802.11s mesh setup configuration
  2165. * @chandef: defines the channel to use
  2166. * @mesh_id: the mesh ID
  2167. * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
  2168. * @sync_method: which synchronization method to use
  2169. * @path_sel_proto: which path selection protocol to use
  2170. * @path_metric: which metric to use
  2171. * @auth_id: which authentication method this mesh is using
  2172. * @ie: vendor information elements (optional)
  2173. * @ie_len: length of vendor information elements
  2174. * @is_authenticated: this mesh requires authentication
  2175. * @is_secure: this mesh uses security
  2176. * @user_mpm: userspace handles all MPM functions
  2177. * @dtim_period: DTIM period to use
  2178. * @beacon_interval: beacon interval to use
  2179. * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
  2180. * @basic_rates: basic rates to use when creating the mesh
  2181. * @beacon_rate: bitrate to be used for beacons
  2182. * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
  2183. * changes the channel when a radar is detected. This is required
  2184. * to operate on DFS channels.
  2185. * @control_port_over_nl80211: TRUE if userspace expects to exchange control
  2186. * port frames over NL80211 instead of the network interface.
  2187. *
  2188. * These parameters are fixed when the mesh is created.
  2189. */
  2190. struct mesh_setup {
  2191. struct cfg80211_chan_def chandef;
  2192. const u8 *mesh_id;
  2193. u8 mesh_id_len;
  2194. u8 sync_method;
  2195. u8 path_sel_proto;
  2196. u8 path_metric;
  2197. u8 auth_id;
  2198. const u8 *ie;
  2199. u8 ie_len;
  2200. bool is_authenticated;
  2201. bool is_secure;
  2202. bool user_mpm;
  2203. u8 dtim_period;
  2204. u16 beacon_interval;
  2205. int mcast_rate[NUM_NL80211_BANDS];
  2206. u32 basic_rates;
  2207. struct cfg80211_bitrate_mask beacon_rate;
  2208. bool userspace_handles_dfs;
  2209. bool control_port_over_nl80211;
  2210. ANDROID_KABI_RESERVE(1);
  2211. };
  2212. /**
  2213. * struct ocb_setup - 802.11p OCB mode setup configuration
  2214. * @chandef: defines the channel to use
  2215. *
  2216. * These parameters are fixed when connecting to the network
  2217. */
  2218. struct ocb_setup {
  2219. struct cfg80211_chan_def chandef;
  2220. };
  2221. /**
  2222. * struct ieee80211_txq_params - TX queue parameters
  2223. * @ac: AC identifier
  2224. * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
  2225. * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
  2226. * 1..32767]
  2227. * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
  2228. * 1..32767]
  2229. * @aifs: Arbitration interframe space [0..255]
  2230. * @link_id: link_id or -1 for non-MLD
  2231. */
  2232. struct ieee80211_txq_params {
  2233. enum nl80211_ac ac;
  2234. u16 txop;
  2235. u16 cwmin;
  2236. u16 cwmax;
  2237. u8 aifs;
  2238. int link_id;
  2239. };
  2240. /**
  2241. * DOC: Scanning and BSS list handling
  2242. *
  2243. * The scanning process itself is fairly simple, but cfg80211 offers quite
  2244. * a bit of helper functionality. To start a scan, the scan operation will
  2245. * be invoked with a scan definition. This scan definition contains the
  2246. * channels to scan, and the SSIDs to send probe requests for (including the
  2247. * wildcard, if desired). A passive scan is indicated by having no SSIDs to
  2248. * probe. Additionally, a scan request may contain extra information elements
  2249. * that should be added to the probe request. The IEs are guaranteed to be
  2250. * well-formed, and will not exceed the maximum length the driver advertised
  2251. * in the wiphy structure.
  2252. *
  2253. * When scanning finds a BSS, cfg80211 needs to be notified of that, because
  2254. * it is responsible for maintaining the BSS list; the driver should not
  2255. * maintain a list itself. For this notification, various functions exist.
  2256. *
  2257. * Since drivers do not maintain a BSS list, there are also a number of
  2258. * functions to search for a BSS and obtain information about it from the
  2259. * BSS structure cfg80211 maintains. The BSS list is also made available
  2260. * to userspace.
  2261. */
  2262. /**
  2263. * struct cfg80211_ssid - SSID description
  2264. * @ssid: the SSID
  2265. * @ssid_len: length of the ssid
  2266. */
  2267. struct cfg80211_ssid {
  2268. u8 ssid[IEEE80211_MAX_SSID_LEN];
  2269. u8 ssid_len;
  2270. };
  2271. /**
  2272. * struct cfg80211_scan_info - information about completed scan
  2273. * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
  2274. * wireless device that requested the scan is connected to. If this
  2275. * information is not available, this field is left zero.
  2276. * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
  2277. * @aborted: set to true if the scan was aborted for any reason,
  2278. * userspace will be notified of that
  2279. */
  2280. struct cfg80211_scan_info {
  2281. u64 scan_start_tsf;
  2282. u8 tsf_bssid[ETH_ALEN] __aligned(2);
  2283. bool aborted;
  2284. };
  2285. /**
  2286. * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
  2287. *
  2288. * @short_ssid: short ssid to scan for
  2289. * @bssid: bssid to scan for
  2290. * @channel_idx: idx of the channel in the channel array in the scan request
  2291. * which the above info relvant to
  2292. * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
  2293. * @short_ssid_valid: @short_ssid is valid and can be used
  2294. * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
  2295. * 20 TUs before starting to send probe requests.
  2296. */
  2297. struct cfg80211_scan_6ghz_params {
  2298. u32 short_ssid;
  2299. u32 channel_idx;
  2300. u8 bssid[ETH_ALEN];
  2301. bool unsolicited_probe;
  2302. bool short_ssid_valid;
  2303. bool psc_no_listen;
  2304. };
  2305. /**
  2306. * struct cfg80211_scan_request - scan request description
  2307. *
  2308. * @ssids: SSIDs to scan for (active scan only)
  2309. * @n_ssids: number of SSIDs
  2310. * @channels: channels to scan on.
  2311. * @n_channels: total number of channels to scan
  2312. * @scan_width: channel width for scanning
  2313. * @ie: optional information element(s) to add into Probe Request or %NULL
  2314. * @ie_len: length of ie in octets
  2315. * @duration: how long to listen on each channel, in TUs. If
  2316. * %duration_mandatory is not set, this is the maximum dwell time and
  2317. * the actual dwell time may be shorter.
  2318. * @duration_mandatory: if set, the scan duration must be as specified by the
  2319. * %duration field.
  2320. * @flags: bit field of flags controlling operation
  2321. * @rates: bitmap of rates to advertise for each band
  2322. * @wiphy: the wiphy this was for
  2323. * @scan_start: time (in jiffies) when the scan started
  2324. * @wdev: the wireless device to scan for
  2325. * @info: (internal) information about completed scan
  2326. * @notified: (internal) scan request was notified as done or aborted
  2327. * @no_cck: used to send probe requests at non CCK rate in 2GHz band
  2328. * @mac_addr: MAC address used with randomisation
  2329. * @mac_addr_mask: MAC address mask used with randomisation, bits that
  2330. * are 0 in the mask should be randomised, bits that are 1 should
  2331. * be taken from the @mac_addr
  2332. * @scan_6ghz: relevant for split scan request only,
  2333. * true if this is the second scan request
  2334. * @n_6ghz_params: number of 6 GHz params
  2335. * @scan_6ghz_params: 6 GHz params
  2336. * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
  2337. */
  2338. struct cfg80211_scan_request {
  2339. struct cfg80211_ssid *ssids;
  2340. int n_ssids;
  2341. u32 n_channels;
  2342. enum nl80211_bss_scan_width scan_width;
  2343. const u8 *ie;
  2344. size_t ie_len;
  2345. u16 duration;
  2346. bool duration_mandatory;
  2347. u32 flags;
  2348. u32 rates[NUM_NL80211_BANDS];
  2349. struct wireless_dev *wdev;
  2350. u8 mac_addr[ETH_ALEN] __aligned(2);
  2351. u8 mac_addr_mask[ETH_ALEN] __aligned(2);
  2352. u8 bssid[ETH_ALEN] __aligned(2);
  2353. /* internal */
  2354. struct wiphy *wiphy;
  2355. unsigned long scan_start;
  2356. struct cfg80211_scan_info info;
  2357. bool notified;
  2358. bool no_cck;
  2359. bool scan_6ghz;
  2360. u32 n_6ghz_params;
  2361. struct cfg80211_scan_6ghz_params *scan_6ghz_params;
  2362. ANDROID_KABI_RESERVE(1);
  2363. /* keep last */
  2364. struct ieee80211_channel *channels[];
  2365. };
  2366. static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
  2367. {
  2368. int i;
  2369. get_random_bytes(buf, ETH_ALEN);
  2370. for (i = 0; i < ETH_ALEN; i++) {
  2371. buf[i] &= ~mask[i];
  2372. buf[i] |= addr[i] & mask[i];
  2373. }
  2374. }
  2375. /**
  2376. * struct cfg80211_match_set - sets of attributes to match
  2377. *
  2378. * @ssid: SSID to be matched; may be zero-length in case of BSSID match
  2379. * or no match (RSSI only)
  2380. * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
  2381. * or no match (RSSI only)
  2382. * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
  2383. * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
  2384. * for filtering out scan results received. Drivers advertize this support
  2385. * of band specific rssi based filtering through the feature capability
  2386. * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
  2387. * specific rssi thresholds take precedence over rssi_thold, if specified.
  2388. * If not specified for any band, it will be assigned with rssi_thold of
  2389. * corresponding matchset.
  2390. */
  2391. struct cfg80211_match_set {
  2392. struct cfg80211_ssid ssid;
  2393. u8 bssid[ETH_ALEN];
  2394. s32 rssi_thold;
  2395. s32 per_band_rssi_thold[NUM_NL80211_BANDS];
  2396. };
  2397. /**
  2398. * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
  2399. *
  2400. * @interval: interval between scheduled scan iterations. In seconds.
  2401. * @iterations: number of scan iterations in this scan plan. Zero means
  2402. * infinite loop.
  2403. * The last scan plan will always have this parameter set to zero,
  2404. * all other scan plans will have a finite number of iterations.
  2405. */
  2406. struct cfg80211_sched_scan_plan {
  2407. u32 interval;
  2408. u32 iterations;
  2409. };
  2410. /**
  2411. * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
  2412. *
  2413. * @band: band of BSS which should match for RSSI level adjustment.
  2414. * @delta: value of RSSI level adjustment.
  2415. */
  2416. struct cfg80211_bss_select_adjust {
  2417. enum nl80211_band band;
  2418. s8 delta;
  2419. };
  2420. /**
  2421. * struct cfg80211_sched_scan_request - scheduled scan request description
  2422. *
  2423. * @reqid: identifies this request.
  2424. * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
  2425. * @n_ssids: number of SSIDs
  2426. * @n_channels: total number of channels to scan
  2427. * @scan_width: channel width for scanning
  2428. * @ie: optional information element(s) to add into Probe Request or %NULL
  2429. * @ie_len: length of ie in octets
  2430. * @flags: bit field of flags controlling operation
  2431. * @match_sets: sets of parameters to be matched for a scan result
  2432. * entry to be considered valid and to be passed to the host
  2433. * (others are filtered out).
  2434. * If ommited, all results are passed.
  2435. * @n_match_sets: number of match sets
  2436. * @report_results: indicates that results were reported for this request
  2437. * @wiphy: the wiphy this was for
  2438. * @dev: the interface
  2439. * @scan_start: start time of the scheduled scan
  2440. * @channels: channels to scan
  2441. * @min_rssi_thold: for drivers only supporting a single threshold, this
  2442. * contains the minimum over all matchsets
  2443. * @mac_addr: MAC address used with randomisation
  2444. * @mac_addr_mask: MAC address mask used with randomisation, bits that
  2445. * are 0 in the mask should be randomised, bits that are 1 should
  2446. * be taken from the @mac_addr
  2447. * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
  2448. * index must be executed first.
  2449. * @n_scan_plans: number of scan plans, at least 1.
  2450. * @rcu_head: RCU callback used to free the struct
  2451. * @owner_nlportid: netlink portid of owner (if this should is a request
  2452. * owned by a particular socket)
  2453. * @nl_owner_dead: netlink owner socket was closed - this request be freed
  2454. * @list: for keeping list of requests.
  2455. * @delay: delay in seconds to use before starting the first scan
  2456. * cycle. The driver may ignore this parameter and start
  2457. * immediately (or at any other time), if this feature is not
  2458. * supported.
  2459. * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
  2460. * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
  2461. * reporting in connected state to cases where a matching BSS is determined
  2462. * to have better or slightly worse RSSI than the current connected BSS.
  2463. * The relative RSSI threshold values are ignored in disconnected state.
  2464. * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
  2465. * to the specified band while deciding whether a better BSS is reported
  2466. * using @relative_rssi. If delta is a negative number, the BSSs that
  2467. * belong to the specified band will be penalized by delta dB in relative
  2468. * comparisions.
  2469. */
  2470. struct cfg80211_sched_scan_request {
  2471. u64 reqid;
  2472. struct cfg80211_ssid *ssids;
  2473. int n_ssids;
  2474. u32 n_channels;
  2475. enum nl80211_bss_scan_width scan_width;
  2476. const u8 *ie;
  2477. size_t ie_len;
  2478. u32 flags;
  2479. struct cfg80211_match_set *match_sets;
  2480. int n_match_sets;
  2481. s32 min_rssi_thold;
  2482. u32 delay;
  2483. struct cfg80211_sched_scan_plan *scan_plans;
  2484. int n_scan_plans;
  2485. u8 mac_addr[ETH_ALEN] __aligned(2);
  2486. u8 mac_addr_mask[ETH_ALEN] __aligned(2);
  2487. bool relative_rssi_set;
  2488. s8 relative_rssi;
  2489. struct cfg80211_bss_select_adjust rssi_adjust;
  2490. /* internal */
  2491. struct wiphy *wiphy;
  2492. struct net_device *dev;
  2493. unsigned long scan_start;
  2494. bool report_results;
  2495. struct rcu_head rcu_head;
  2496. u32 owner_nlportid;
  2497. bool nl_owner_dead;
  2498. struct list_head list;
  2499. ANDROID_KABI_RESERVE(1);
  2500. /* keep last */
  2501. struct ieee80211_channel *channels[];
  2502. };
  2503. /**
  2504. * enum cfg80211_signal_type - signal type
  2505. *
  2506. * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
  2507. * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
  2508. * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
  2509. */
  2510. enum cfg80211_signal_type {
  2511. CFG80211_SIGNAL_TYPE_NONE,
  2512. CFG80211_SIGNAL_TYPE_MBM,
  2513. CFG80211_SIGNAL_TYPE_UNSPEC,
  2514. };
  2515. /**
  2516. * struct cfg80211_inform_bss - BSS inform data
  2517. * @chan: channel the frame was received on
  2518. * @scan_width: scan width that was used
  2519. * @signal: signal strength value, according to the wiphy's
  2520. * signal type
  2521. * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
  2522. * received; should match the time when the frame was actually
  2523. * received by the device (not just by the host, in case it was
  2524. * buffered on the device) and be accurate to about 10ms.
  2525. * If the frame isn't buffered, just passing the return value of
  2526. * ktime_get_boottime_ns() is likely appropriate.
  2527. * @parent_tsf: the time at the start of reception of the first octet of the
  2528. * timestamp field of the frame. The time is the TSF of the BSS specified
  2529. * by %parent_bssid.
  2530. * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
  2531. * the BSS that requested the scan in which the beacon/probe was received.
  2532. * @chains: bitmask for filled values in @chain_signal.
  2533. * @chain_signal: per-chain signal strength of last received BSS in dBm.
  2534. */
  2535. struct cfg80211_inform_bss {
  2536. struct ieee80211_channel *chan;
  2537. enum nl80211_bss_scan_width scan_width;
  2538. s32 signal;
  2539. u64 boottime_ns;
  2540. u64 parent_tsf;
  2541. u8 parent_bssid[ETH_ALEN] __aligned(2);
  2542. u8 chains;
  2543. s8 chain_signal[IEEE80211_MAX_CHAINS];
  2544. };
  2545. /**
  2546. * struct cfg80211_bss_ies - BSS entry IE data
  2547. * @tsf: TSF contained in the frame that carried these IEs
  2548. * @rcu_head: internal use, for freeing
  2549. * @len: length of the IEs
  2550. * @from_beacon: these IEs are known to come from a beacon
  2551. * @data: IE data
  2552. */
  2553. struct cfg80211_bss_ies {
  2554. u64 tsf;
  2555. struct rcu_head rcu_head;
  2556. int len;
  2557. bool from_beacon;
  2558. u8 data[];
  2559. };
  2560. /**
  2561. * struct cfg80211_bss - BSS description
  2562. *
  2563. * This structure describes a BSS (which may also be a mesh network)
  2564. * for use in scan results and similar.
  2565. *
  2566. * @channel: channel this BSS is on
  2567. * @scan_width: width of the control channel
  2568. * @bssid: BSSID of the BSS
  2569. * @beacon_interval: the beacon interval as from the frame
  2570. * @capability: the capability field in host byte order
  2571. * @ies: the information elements (Note that there is no guarantee that these
  2572. * are well-formed!); this is a pointer to either the beacon_ies or
  2573. * proberesp_ies depending on whether Probe Response frame has been
  2574. * received. It is always non-%NULL.
  2575. * @beacon_ies: the information elements from the last Beacon frame
  2576. * (implementation note: if @hidden_beacon_bss is set this struct doesn't
  2577. * own the beacon_ies, but they're just pointers to the ones from the
  2578. * @hidden_beacon_bss struct)
  2579. * @proberesp_ies: the information elements from the last Probe Response frame
  2580. * @hidden_beacon_bss: in case this BSS struct represents a probe response from
  2581. * a BSS that hides the SSID in its beacon, this points to the BSS struct
  2582. * that holds the beacon data. @beacon_ies is still valid, of course, and
  2583. * points to the same data as hidden_beacon_bss->beacon_ies in that case.
  2584. * @transmitted_bss: pointer to the transmitted BSS, if this is a
  2585. * non-transmitted one (multi-BSSID support)
  2586. * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
  2587. * (multi-BSSID support)
  2588. * @signal: signal strength value (type depends on the wiphy's signal_type)
  2589. * @chains: bitmask for filled values in @chain_signal.
  2590. * @chain_signal: per-chain signal strength of last received BSS in dBm.
  2591. * @bssid_index: index in the multiple BSS set
  2592. * @max_bssid_indicator: max number of members in the BSS set
  2593. * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
  2594. */
  2595. struct cfg80211_bss {
  2596. struct ieee80211_channel *channel;
  2597. enum nl80211_bss_scan_width scan_width;
  2598. const struct cfg80211_bss_ies __rcu *ies;
  2599. const struct cfg80211_bss_ies __rcu *beacon_ies;
  2600. const struct cfg80211_bss_ies __rcu *proberesp_ies;
  2601. struct cfg80211_bss *hidden_beacon_bss;
  2602. struct cfg80211_bss *transmitted_bss;
  2603. struct list_head nontrans_list;
  2604. s32 signal;
  2605. u16 beacon_interval;
  2606. u16 capability;
  2607. u8 bssid[ETH_ALEN];
  2608. u8 chains;
  2609. s8 chain_signal[IEEE80211_MAX_CHAINS];
  2610. u8 bssid_index;
  2611. u8 max_bssid_indicator;
  2612. ANDROID_KABI_RESERVE(1);
  2613. u8 priv[] __aligned(sizeof(void *));
  2614. };
  2615. /**
  2616. * ieee80211_bss_get_elem - find element with given ID
  2617. * @bss: the bss to search
  2618. * @id: the element ID
  2619. *
  2620. * Note that the return value is an RCU-protected pointer, so
  2621. * rcu_read_lock() must be held when calling this function.
  2622. * Return: %NULL if not found.
  2623. */
  2624. const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
  2625. /**
  2626. * ieee80211_bss_get_ie - find IE with given ID
  2627. * @bss: the bss to search
  2628. * @id: the element ID
  2629. *
  2630. * Note that the return value is an RCU-protected pointer, so
  2631. * rcu_read_lock() must be held when calling this function.
  2632. * Return: %NULL if not found.
  2633. */
  2634. static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
  2635. {
  2636. return (const void *)ieee80211_bss_get_elem(bss, id);
  2637. }
  2638. /**
  2639. * struct cfg80211_auth_request - Authentication request data
  2640. *
  2641. * This structure provides information needed to complete IEEE 802.11
  2642. * authentication.
  2643. *
  2644. * @bss: The BSS to authenticate with, the callee must obtain a reference
  2645. * to it if it needs to keep it.
  2646. * @auth_type: Authentication type (algorithm)
  2647. * @ie: Extra IEs to add to Authentication frame or %NULL
  2648. * @ie_len: Length of ie buffer in octets
  2649. * @key_len: length of WEP key for shared key authentication
  2650. * @key_idx: index of WEP key for shared key authentication
  2651. * @key: WEP key for shared key authentication
  2652. * @auth_data: Fields and elements in Authentication frames. This contains
  2653. * the authentication frame body (non-IE and IE data), excluding the
  2654. * Authentication algorithm number, i.e., starting at the Authentication
  2655. * transaction sequence number field.
  2656. * @auth_data_len: Length of auth_data buffer in octets
  2657. * @link_id: if >= 0, indicates authentication should be done as an MLD,
  2658. * the interface address is included as the MLD address and the
  2659. * necessary link (with the given link_id) will be created (and
  2660. * given an MLD address) by the driver
  2661. * @ap_mld_addr: AP MLD address in case of authentication request with
  2662. * an AP MLD, valid iff @link_id >= 0
  2663. */
  2664. struct cfg80211_auth_request {
  2665. struct cfg80211_bss *bss;
  2666. const u8 *ie;
  2667. size_t ie_len;
  2668. enum nl80211_auth_type auth_type;
  2669. const u8 *key;
  2670. u8 key_len;
  2671. s8 key_idx;
  2672. const u8 *auth_data;
  2673. size_t auth_data_len;
  2674. s8 link_id;
  2675. const u8 *ap_mld_addr;
  2676. };
  2677. /**
  2678. * struct cfg80211_assoc_link - per-link information for MLO association
  2679. * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;
  2680. * if this is %NULL for a link, that link is not requested
  2681. * @elems: extra elements for the per-STA profile for this link
  2682. * @elems_len: length of the elements
  2683. */
  2684. struct cfg80211_assoc_link {
  2685. struct cfg80211_bss *bss;
  2686. const u8 *elems;
  2687. size_t elems_len;
  2688. };
  2689. /**
  2690. * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
  2691. *
  2692. * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
  2693. * @ASSOC_REQ_DISABLE_VHT: Disable VHT
  2694. * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
  2695. * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
  2696. * authentication capability. Drivers can offload authentication to
  2697. * userspace if this flag is set. Only applicable for cfg80211_connect()
  2698. * request (connect callback).
  2699. * @ASSOC_REQ_DISABLE_HE: Disable HE
  2700. * @ASSOC_REQ_DISABLE_EHT: Disable EHT
  2701. * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.
  2702. * Drivers shall disable MLO features for the current association if this
  2703. * flag is not set.
  2704. */
  2705. enum cfg80211_assoc_req_flags {
  2706. ASSOC_REQ_DISABLE_HT = BIT(0),
  2707. ASSOC_REQ_DISABLE_VHT = BIT(1),
  2708. ASSOC_REQ_USE_RRM = BIT(2),
  2709. CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
  2710. ASSOC_REQ_DISABLE_HE = BIT(4),
  2711. ASSOC_REQ_DISABLE_EHT = BIT(5),
  2712. CONNECT_REQ_MLO_SUPPORT = BIT(6),
  2713. };
  2714. /**
  2715. * struct cfg80211_assoc_request - (Re)Association request data
  2716. *
  2717. * This structure provides information needed to complete IEEE 802.11
  2718. * (re)association.
  2719. * @bss: The BSS to associate with. If the call is successful the driver is
  2720. * given a reference that it must give back to cfg80211_send_rx_assoc()
  2721. * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
  2722. * association requests while already associating must be rejected.
  2723. * This also applies to the @links.bss parameter, which is used instead
  2724. * of this one (it is %NULL) for MLO associations.
  2725. * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
  2726. * @ie_len: Length of ie buffer in octets
  2727. * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
  2728. * @crypto: crypto settings
  2729. * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
  2730. * to indicate a request to reassociate within the ESS instead of a request
  2731. * do the initial association with the ESS. When included, this is set to
  2732. * the BSSID of the current association, i.e., to the value that is
  2733. * included in the Current AP address field of the Reassociation Request
  2734. * frame.
  2735. * @flags: See &enum cfg80211_assoc_req_flags
  2736. * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
  2737. * will be used in ht_capa. Un-supported values will be ignored.
  2738. * @ht_capa_mask: The bits of ht_capa which are to be used.
  2739. * @vht_capa: VHT capability override
  2740. * @vht_capa_mask: VHT capability mask indicating which fields to use
  2741. * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
  2742. * %NULL if FILS is not used.
  2743. * @fils_kek_len: Length of fils_kek in octets
  2744. * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
  2745. * Request/Response frame or %NULL if FILS is not used. This field starts
  2746. * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
  2747. * @s1g_capa: S1G capability override
  2748. * @s1g_capa_mask: S1G capability override mask
  2749. * @links: per-link information for MLO connections
  2750. * @link_id: >= 0 for MLO connections, where links are given, and indicates
  2751. * the link on which the association request should be sent
  2752. * @ap_mld_addr: AP MLD address in case of MLO association request,
  2753. * valid iff @link_id >= 0
  2754. */
  2755. struct cfg80211_assoc_request {
  2756. struct cfg80211_bss *bss;
  2757. const u8 *ie, *prev_bssid;
  2758. size_t ie_len;
  2759. struct cfg80211_crypto_settings crypto;
  2760. bool use_mfp;
  2761. u32 flags;
  2762. struct ieee80211_ht_cap ht_capa;
  2763. struct ieee80211_ht_cap ht_capa_mask;
  2764. struct ieee80211_vht_cap vht_capa, vht_capa_mask;
  2765. const u8 *fils_kek;
  2766. size_t fils_kek_len;
  2767. const u8 *fils_nonces;
  2768. struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
  2769. struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];
  2770. const u8 *ap_mld_addr;
  2771. s8 link_id;
  2772. ANDROID_KABI_RESERVE(1);
  2773. };
  2774. /**
  2775. * struct cfg80211_deauth_request - Deauthentication request data
  2776. *
  2777. * This structure provides information needed to complete IEEE 802.11
  2778. * deauthentication.
  2779. *
  2780. * @bssid: the BSSID or AP MLD address to deauthenticate from
  2781. * @ie: Extra IEs to add to Deauthentication frame or %NULL
  2782. * @ie_len: Length of ie buffer in octets
  2783. * @reason_code: The reason code for the deauthentication
  2784. * @local_state_change: if set, change local state only and
  2785. * do not set a deauth frame
  2786. */
  2787. struct cfg80211_deauth_request {
  2788. const u8 *bssid;
  2789. const u8 *ie;
  2790. size_t ie_len;
  2791. u16 reason_code;
  2792. bool local_state_change;
  2793. };
  2794. /**
  2795. * struct cfg80211_disassoc_request - Disassociation request data
  2796. *
  2797. * This structure provides information needed to complete IEEE 802.11
  2798. * disassociation.
  2799. *
  2800. * @ap_addr: the BSSID or AP MLD address to disassociate from
  2801. * @ie: Extra IEs to add to Disassociation frame or %NULL
  2802. * @ie_len: Length of ie buffer in octets
  2803. * @reason_code: The reason code for the disassociation
  2804. * @local_state_change: This is a request for a local state only, i.e., no
  2805. * Disassociation frame is to be transmitted.
  2806. */
  2807. struct cfg80211_disassoc_request {
  2808. const u8 *ap_addr;
  2809. const u8 *ie;
  2810. size_t ie_len;
  2811. u16 reason_code;
  2812. bool local_state_change;
  2813. };
  2814. /**
  2815. * struct cfg80211_ibss_params - IBSS parameters
  2816. *
  2817. * This structure defines the IBSS parameters for the join_ibss()
  2818. * method.
  2819. *
  2820. * @ssid: The SSID, will always be non-null.
  2821. * @ssid_len: The length of the SSID, will always be non-zero.
  2822. * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
  2823. * search for IBSSs with a different BSSID.
  2824. * @chandef: defines the channel to use if no other IBSS to join can be found
  2825. * @channel_fixed: The channel should be fixed -- do not search for
  2826. * IBSSs to join on other channels.
  2827. * @ie: information element(s) to include in the beacon
  2828. * @ie_len: length of that
  2829. * @beacon_interval: beacon interval to use
  2830. * @privacy: this is a protected network, keys will be configured
  2831. * after joining
  2832. * @control_port: whether user space controls IEEE 802.1X port, i.e.,
  2833. * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
  2834. * required to assume that the port is unauthorized until authorized by
  2835. * user space. Otherwise, port is marked authorized by default.
  2836. * @control_port_over_nl80211: TRUE if userspace expects to exchange control
  2837. * port frames over NL80211 instead of the network interface.
  2838. * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
  2839. * changes the channel when a radar is detected. This is required
  2840. * to operate on DFS channels.
  2841. * @basic_rates: bitmap of basic rates to use when creating the IBSS
  2842. * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
  2843. * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
  2844. * will be used in ht_capa. Un-supported values will be ignored.
  2845. * @ht_capa_mask: The bits of ht_capa which are to be used.
  2846. * @wep_keys: static WEP keys, if not NULL points to an array of
  2847. * CFG80211_MAX_WEP_KEYS WEP keys
  2848. * @wep_tx_key: key index (0..3) of the default TX static WEP key
  2849. */
  2850. struct cfg80211_ibss_params {
  2851. const u8 *ssid;
  2852. const u8 *bssid;
  2853. struct cfg80211_chan_def chandef;
  2854. const u8 *ie;
  2855. u8 ssid_len, ie_len;
  2856. u16 beacon_interval;
  2857. u32 basic_rates;
  2858. bool channel_fixed;
  2859. bool privacy;
  2860. bool control_port;
  2861. bool control_port_over_nl80211;
  2862. bool userspace_handles_dfs;
  2863. int mcast_rate[NUM_NL80211_BANDS];
  2864. struct ieee80211_ht_cap ht_capa;
  2865. struct ieee80211_ht_cap ht_capa_mask;
  2866. struct key_params *wep_keys;
  2867. int wep_tx_key;
  2868. ANDROID_KABI_RESERVE(1);
  2869. };
  2870. /**
  2871. * struct cfg80211_bss_selection - connection parameters for BSS selection.
  2872. *
  2873. * @behaviour: requested BSS selection behaviour.
  2874. * @param: parameters for requestion behaviour.
  2875. * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
  2876. * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
  2877. */
  2878. struct cfg80211_bss_selection {
  2879. enum nl80211_bss_select_attr behaviour;
  2880. union {
  2881. enum nl80211_band band_pref;
  2882. struct cfg80211_bss_select_adjust adjust;
  2883. } param;
  2884. };
  2885. /**
  2886. * struct cfg80211_connect_params - Connection parameters
  2887. *
  2888. * This structure provides information needed to complete IEEE 802.11
  2889. * authentication and association.
  2890. *
  2891. * @channel: The channel to use or %NULL if not specified (auto-select based
  2892. * on scan results)
  2893. * @channel_hint: The channel of the recommended BSS for initial connection or
  2894. * %NULL if not specified
  2895. * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
  2896. * results)
  2897. * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
  2898. * %NULL if not specified. Unlike the @bssid parameter, the driver is
  2899. * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
  2900. * to use.
  2901. * @ssid: SSID
  2902. * @ssid_len: Length of ssid in octets
  2903. * @auth_type: Authentication type (algorithm)
  2904. * @ie: IEs for association request
  2905. * @ie_len: Length of assoc_ie in octets
  2906. * @privacy: indicates whether privacy-enabled APs should be used
  2907. * @mfp: indicate whether management frame protection is used
  2908. * @crypto: crypto settings
  2909. * @key_len: length of WEP key for shared key authentication
  2910. * @key_idx: index of WEP key for shared key authentication
  2911. * @key: WEP key for shared key authentication
  2912. * @flags: See &enum cfg80211_assoc_req_flags
  2913. * @bg_scan_period: Background scan period in seconds
  2914. * or -1 to indicate that default value is to be used.
  2915. * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
  2916. * will be used in ht_capa. Un-supported values will be ignored.
  2917. * @ht_capa_mask: The bits of ht_capa which are to be used.
  2918. * @vht_capa: VHT Capability overrides
  2919. * @vht_capa_mask: The bits of vht_capa which are to be used.
  2920. * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
  2921. * networks.
  2922. * @bss_select: criteria to be used for BSS selection.
  2923. * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
  2924. * to indicate a request to reassociate within the ESS instead of a request
  2925. * do the initial association with the ESS. When included, this is set to
  2926. * the BSSID of the current association, i.e., to the value that is
  2927. * included in the Current AP address field of the Reassociation Request
  2928. * frame.
  2929. * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
  2930. * NAI or %NULL if not specified. This is used to construct FILS wrapped
  2931. * data IE.
  2932. * @fils_erp_username_len: Length of @fils_erp_username in octets.
  2933. * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
  2934. * %NULL if not specified. This specifies the domain name of ER server and
  2935. * is used to construct FILS wrapped data IE.
  2936. * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
  2937. * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
  2938. * messages. This is also used to construct FILS wrapped data IE.
  2939. * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
  2940. * keys in FILS or %NULL if not specified.
  2941. * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
  2942. * @want_1x: indicates user-space supports and wants to use 802.1X driver
  2943. * offload of 4-way handshake.
  2944. * @edmg: define the EDMG channels.
  2945. * This may specify multiple channels and bonding options for the driver
  2946. * to choose from, based on BSS configuration.
  2947. */
  2948. struct cfg80211_connect_params {
  2949. struct ieee80211_channel *channel;
  2950. struct ieee80211_channel *channel_hint;
  2951. const u8 *bssid;
  2952. const u8 *bssid_hint;
  2953. const u8 *ssid;
  2954. size_t ssid_len;
  2955. enum nl80211_auth_type auth_type;
  2956. const u8 *ie;
  2957. size_t ie_len;
  2958. bool privacy;
  2959. enum nl80211_mfp mfp;
  2960. struct cfg80211_crypto_settings crypto;
  2961. const u8 *key;
  2962. u8 key_len, key_idx;
  2963. u32 flags;
  2964. int bg_scan_period;
  2965. struct ieee80211_ht_cap ht_capa;
  2966. struct ieee80211_ht_cap ht_capa_mask;
  2967. struct ieee80211_vht_cap vht_capa;
  2968. struct ieee80211_vht_cap vht_capa_mask;
  2969. bool pbss;
  2970. struct cfg80211_bss_selection bss_select;
  2971. const u8 *prev_bssid;
  2972. const u8 *fils_erp_username;
  2973. size_t fils_erp_username_len;
  2974. const u8 *fils_erp_realm;
  2975. size_t fils_erp_realm_len;
  2976. u16 fils_erp_next_seq_num;
  2977. const u8 *fils_erp_rrk;
  2978. size_t fils_erp_rrk_len;
  2979. bool want_1x;
  2980. struct ieee80211_edmg edmg;
  2981. ANDROID_KABI_RESERVE(1);
  2982. };
  2983. /**
  2984. * enum cfg80211_connect_params_changed - Connection parameters being updated
  2985. *
  2986. * This enum provides information of all connect parameters that
  2987. * have to be updated as part of update_connect_params() call.
  2988. *
  2989. * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
  2990. * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
  2991. * username, erp sequence number and rrk) are updated
  2992. * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
  2993. */
  2994. enum cfg80211_connect_params_changed {
  2995. UPDATE_ASSOC_IES = BIT(0),
  2996. UPDATE_FILS_ERP_INFO = BIT(1),
  2997. UPDATE_AUTH_TYPE = BIT(2),
  2998. };
  2999. /**
  3000. * enum wiphy_params_flags - set_wiphy_params bitfield values
  3001. * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
  3002. * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
  3003. * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
  3004. * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
  3005. * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
  3006. * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
  3007. * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
  3008. * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
  3009. * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
  3010. */
  3011. enum wiphy_params_flags {
  3012. WIPHY_PARAM_RETRY_SHORT = 1 << 0,
  3013. WIPHY_PARAM_RETRY_LONG = 1 << 1,
  3014. WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
  3015. WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
  3016. WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
  3017. WIPHY_PARAM_DYN_ACK = 1 << 5,
  3018. WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
  3019. WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
  3020. WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
  3021. };
  3022. #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
  3023. /* The per TXQ device queue limit in airtime */
  3024. #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
  3025. #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
  3026. /* The per interface airtime threshold to switch to lower queue limit */
  3027. #define IEEE80211_AQL_THRESHOLD 24000
  3028. /**
  3029. * struct cfg80211_pmksa - PMK Security Association
  3030. *
  3031. * This structure is passed to the set/del_pmksa() method for PMKSA
  3032. * caching.
  3033. *
  3034. * @bssid: The AP's BSSID (may be %NULL).
  3035. * @pmkid: The identifier to refer a PMKSA.
  3036. * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
  3037. * derivation by a FILS STA. Otherwise, %NULL.
  3038. * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
  3039. * the hash algorithm used to generate this.
  3040. * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
  3041. * cache identifier (may be %NULL).
  3042. * @ssid_len: Length of the @ssid in octets.
  3043. * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
  3044. * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
  3045. * %NULL).
  3046. * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
  3047. * (dot11RSNAConfigPMKLifetime) or 0 if not specified.
  3048. * The configured PMKSA must not be used for PMKSA caching after
  3049. * expiration and any keys derived from this PMK become invalid on
  3050. * expiration, i.e., the current association must be dropped if the PMK
  3051. * used for it expires.
  3052. * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
  3053. * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
  3054. * Drivers are expected to trigger a full authentication instead of using
  3055. * this PMKSA for caching when reassociating to a new BSS after this
  3056. * threshold to generate a new PMK before the current one expires.
  3057. */
  3058. struct cfg80211_pmksa {
  3059. const u8 *bssid;
  3060. const u8 *pmkid;
  3061. const u8 *pmk;
  3062. size_t pmk_len;
  3063. const u8 *ssid;
  3064. size_t ssid_len;
  3065. const u8 *cache_id;
  3066. u32 pmk_lifetime;
  3067. u8 pmk_reauth_threshold;
  3068. };
  3069. /**
  3070. * struct cfg80211_pkt_pattern - packet pattern
  3071. * @mask: bitmask where to match pattern and where to ignore bytes,
  3072. * one bit per byte, in same format as nl80211
  3073. * @pattern: bytes to match where bitmask is 1
  3074. * @pattern_len: length of pattern (in bytes)
  3075. * @pkt_offset: packet offset (in bytes)
  3076. *
  3077. * Internal note: @mask and @pattern are allocated in one chunk of
  3078. * memory, free @mask only!
  3079. */
  3080. struct cfg80211_pkt_pattern {
  3081. const u8 *mask, *pattern;
  3082. int pattern_len;
  3083. int pkt_offset;
  3084. };
  3085. /**
  3086. * struct cfg80211_wowlan_tcp - TCP connection parameters
  3087. *
  3088. * @sock: (internal) socket for source port allocation
  3089. * @src: source IP address
  3090. * @dst: destination IP address
  3091. * @dst_mac: destination MAC address
  3092. * @src_port: source port
  3093. * @dst_port: destination port
  3094. * @payload_len: data payload length
  3095. * @payload: data payload buffer
  3096. * @payload_seq: payload sequence stamping configuration
  3097. * @data_interval: interval at which to send data packets
  3098. * @wake_len: wakeup payload match length
  3099. * @wake_data: wakeup payload match data
  3100. * @wake_mask: wakeup payload match mask
  3101. * @tokens_size: length of the tokens buffer
  3102. * @payload_tok: payload token usage configuration
  3103. */
  3104. struct cfg80211_wowlan_tcp {
  3105. struct socket *sock;
  3106. __be32 src, dst;
  3107. u16 src_port, dst_port;
  3108. u8 dst_mac[ETH_ALEN];
  3109. int payload_len;
  3110. const u8 *payload;
  3111. struct nl80211_wowlan_tcp_data_seq payload_seq;
  3112. u32 data_interval;
  3113. u32 wake_len;
  3114. const u8 *wake_data, *wake_mask;
  3115. u32 tokens_size;
  3116. /* must be last, variable member */
  3117. struct nl80211_wowlan_tcp_data_token payload_tok;
  3118. };
  3119. /**
  3120. * struct cfg80211_wowlan - Wake on Wireless-LAN support info
  3121. *
  3122. * This structure defines the enabled WoWLAN triggers for the device.
  3123. * @any: wake up on any activity -- special trigger if device continues
  3124. * operating as normal during suspend
  3125. * @disconnect: wake up if getting disconnected
  3126. * @magic_pkt: wake up on receiving magic packet
  3127. * @patterns: wake up on receiving packet matching a pattern
  3128. * @n_patterns: number of patterns
  3129. * @gtk_rekey_failure: wake up on GTK rekey failure
  3130. * @eap_identity_req: wake up on EAP identity request packet
  3131. * @four_way_handshake: wake up on 4-way handshake
  3132. * @rfkill_release: wake up when rfkill is released
  3133. * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
  3134. * NULL if not configured.
  3135. * @nd_config: configuration for the scan to be used for net detect wake.
  3136. */
  3137. struct cfg80211_wowlan {
  3138. bool any, disconnect, magic_pkt, gtk_rekey_failure,
  3139. eap_identity_req, four_way_handshake,
  3140. rfkill_release;
  3141. struct cfg80211_pkt_pattern *patterns;
  3142. struct cfg80211_wowlan_tcp *tcp;
  3143. int n_patterns;
  3144. struct cfg80211_sched_scan_request *nd_config;
  3145. };
  3146. /**
  3147. * struct cfg80211_coalesce_rules - Coalesce rule parameters
  3148. *
  3149. * This structure defines coalesce rule for the device.
  3150. * @delay: maximum coalescing delay in msecs.
  3151. * @condition: condition for packet coalescence.
  3152. * see &enum nl80211_coalesce_condition.
  3153. * @patterns: array of packet patterns
  3154. * @n_patterns: number of patterns
  3155. */
  3156. struct cfg80211_coalesce_rules {
  3157. int delay;
  3158. enum nl80211_coalesce_condition condition;
  3159. struct cfg80211_pkt_pattern *patterns;
  3160. int n_patterns;
  3161. };
  3162. /**
  3163. * struct cfg80211_coalesce - Packet coalescing settings
  3164. *
  3165. * This structure defines coalescing settings.
  3166. * @rules: array of coalesce rules
  3167. * @n_rules: number of rules
  3168. */
  3169. struct cfg80211_coalesce {
  3170. struct cfg80211_coalesce_rules *rules;
  3171. int n_rules;
  3172. };
  3173. /**
  3174. * struct cfg80211_wowlan_nd_match - information about the match
  3175. *
  3176. * @ssid: SSID of the match that triggered the wake up
  3177. * @n_channels: Number of channels where the match occurred. This
  3178. * value may be zero if the driver can't report the channels.
  3179. * @channels: center frequencies of the channels where a match
  3180. * occurred (in MHz)
  3181. */
  3182. struct cfg80211_wowlan_nd_match {
  3183. struct cfg80211_ssid ssid;
  3184. int n_channels;
  3185. u32 channels[];
  3186. };
  3187. /**
  3188. * struct cfg80211_wowlan_nd_info - net detect wake up information
  3189. *
  3190. * @n_matches: Number of match information instances provided in
  3191. * @matches. This value may be zero if the driver can't provide
  3192. * match information.
  3193. * @matches: Array of pointers to matches containing information about
  3194. * the matches that triggered the wake up.
  3195. */
  3196. struct cfg80211_wowlan_nd_info {
  3197. int n_matches;
  3198. struct cfg80211_wowlan_nd_match *matches[];
  3199. };
  3200. /**
  3201. * struct cfg80211_wowlan_wakeup - wakeup report
  3202. * @disconnect: woke up by getting disconnected
  3203. * @magic_pkt: woke up by receiving magic packet
  3204. * @gtk_rekey_failure: woke up by GTK rekey failure
  3205. * @eap_identity_req: woke up by EAP identity request packet
  3206. * @four_way_handshake: woke up by 4-way handshake
  3207. * @rfkill_release: woke up by rfkill being released
  3208. * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
  3209. * @packet_present_len: copied wakeup packet data
  3210. * @packet_len: original wakeup packet length
  3211. * @packet: The packet causing the wakeup, if any.
  3212. * @packet_80211: For pattern match, magic packet and other data
  3213. * frame triggers an 802.3 frame should be reported, for
  3214. * disconnect due to deauth 802.11 frame. This indicates which
  3215. * it is.
  3216. * @tcp_match: TCP wakeup packet received
  3217. * @tcp_connlost: TCP connection lost or failed to establish
  3218. * @tcp_nomoretokens: TCP data ran out of tokens
  3219. * @net_detect: if not %NULL, woke up because of net detect
  3220. */
  3221. struct cfg80211_wowlan_wakeup {
  3222. bool disconnect, magic_pkt, gtk_rekey_failure,
  3223. eap_identity_req, four_way_handshake,
  3224. rfkill_release, packet_80211,
  3225. tcp_match, tcp_connlost, tcp_nomoretokens;
  3226. s32 pattern_idx;
  3227. u32 packet_present_len, packet_len;
  3228. const void *packet;
  3229. struct cfg80211_wowlan_nd_info *net_detect;
  3230. };
  3231. /**
  3232. * struct cfg80211_gtk_rekey_data - rekey data
  3233. * @kek: key encryption key (@kek_len bytes)
  3234. * @kck: key confirmation key (@kck_len bytes)
  3235. * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
  3236. * @kek_len: length of kek
  3237. * @kck_len: length of kck
  3238. * @akm: akm (oui, id)
  3239. */
  3240. struct cfg80211_gtk_rekey_data {
  3241. const u8 *kek, *kck, *replay_ctr;
  3242. u32 akm;
  3243. u8 kek_len, kck_len;
  3244. };
  3245. /**
  3246. * struct cfg80211_update_ft_ies_params - FT IE Information
  3247. *
  3248. * This structure provides information needed to update the fast transition IE
  3249. *
  3250. * @md: The Mobility Domain ID, 2 Octet value
  3251. * @ie: Fast Transition IEs
  3252. * @ie_len: Length of ft_ie in octets
  3253. */
  3254. struct cfg80211_update_ft_ies_params {
  3255. u16 md;
  3256. const u8 *ie;
  3257. size_t ie_len;
  3258. };
  3259. /**
  3260. * struct cfg80211_mgmt_tx_params - mgmt tx parameters
  3261. *
  3262. * This structure provides information needed to transmit a mgmt frame
  3263. *
  3264. * @chan: channel to use
  3265. * @offchan: indicates wether off channel operation is required
  3266. * @wait: duration for ROC
  3267. * @buf: buffer to transmit
  3268. * @len: buffer length
  3269. * @no_cck: don't use cck rates for this frame
  3270. * @dont_wait_for_ack: tells the low level not to wait for an ack
  3271. * @n_csa_offsets: length of csa_offsets array
  3272. * @csa_offsets: array of all the csa offsets in the frame
  3273. * @link_id: for MLO, the link ID to transmit on, -1 if not given; note
  3274. * that the link ID isn't validated (much), it's in range but the
  3275. * link might not exist (or be used by the receiver STA)
  3276. */
  3277. struct cfg80211_mgmt_tx_params {
  3278. struct ieee80211_channel *chan;
  3279. bool offchan;
  3280. unsigned int wait;
  3281. const u8 *buf;
  3282. size_t len;
  3283. bool no_cck;
  3284. bool dont_wait_for_ack;
  3285. int n_csa_offsets;
  3286. const u16 *csa_offsets;
  3287. int link_id;
  3288. };
  3289. /**
  3290. * struct cfg80211_dscp_exception - DSCP exception
  3291. *
  3292. * @dscp: DSCP value that does not adhere to the user priority range definition
  3293. * @up: user priority value to which the corresponding DSCP value belongs
  3294. */
  3295. struct cfg80211_dscp_exception {
  3296. u8 dscp;
  3297. u8 up;
  3298. };
  3299. /**
  3300. * struct cfg80211_dscp_range - DSCP range definition for user priority
  3301. *
  3302. * @low: lowest DSCP value of this user priority range, inclusive
  3303. * @high: highest DSCP value of this user priority range, inclusive
  3304. */
  3305. struct cfg80211_dscp_range {
  3306. u8 low;
  3307. u8 high;
  3308. };
  3309. /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
  3310. #define IEEE80211_QOS_MAP_MAX_EX 21
  3311. #define IEEE80211_QOS_MAP_LEN_MIN 16
  3312. #define IEEE80211_QOS_MAP_LEN_MAX \
  3313. (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
  3314. /**
  3315. * struct cfg80211_qos_map - QoS Map Information
  3316. *
  3317. * This struct defines the Interworking QoS map setting for DSCP values
  3318. *
  3319. * @num_des: number of DSCP exceptions (0..21)
  3320. * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
  3321. * the user priority DSCP range definition
  3322. * @up: DSCP range definition for a particular user priority
  3323. */
  3324. struct cfg80211_qos_map {
  3325. u8 num_des;
  3326. struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
  3327. struct cfg80211_dscp_range up[8];
  3328. };
  3329. /**
  3330. * struct cfg80211_nan_conf - NAN configuration
  3331. *
  3332. * This struct defines NAN configuration parameters
  3333. *
  3334. * @master_pref: master preference (1 - 255)
  3335. * @bands: operating bands, a bitmap of &enum nl80211_band values.
  3336. * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
  3337. * (i.e. BIT(NL80211_BAND_2GHZ)).
  3338. */
  3339. struct cfg80211_nan_conf {
  3340. u8 master_pref;
  3341. u8 bands;
  3342. };
  3343. /**
  3344. * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
  3345. * configuration
  3346. *
  3347. * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
  3348. * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
  3349. */
  3350. enum cfg80211_nan_conf_changes {
  3351. CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
  3352. CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
  3353. };
  3354. /**
  3355. * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
  3356. *
  3357. * @filter: the content of the filter
  3358. * @len: the length of the filter
  3359. */
  3360. struct cfg80211_nan_func_filter {
  3361. const u8 *filter;
  3362. u8 len;
  3363. };
  3364. /**
  3365. * struct cfg80211_nan_func - a NAN function
  3366. *
  3367. * @type: &enum nl80211_nan_function_type
  3368. * @service_id: the service ID of the function
  3369. * @publish_type: &nl80211_nan_publish_type
  3370. * @close_range: if true, the range should be limited. Threshold is
  3371. * implementation specific.
  3372. * @publish_bcast: if true, the solicited publish should be broadcasted
  3373. * @subscribe_active: if true, the subscribe is active
  3374. * @followup_id: the instance ID for follow up
  3375. * @followup_reqid: the requestor instance ID for follow up
  3376. * @followup_dest: MAC address of the recipient of the follow up
  3377. * @ttl: time to live counter in DW.
  3378. * @serv_spec_info: Service Specific Info
  3379. * @serv_spec_info_len: Service Specific Info length
  3380. * @srf_include: if true, SRF is inclusive
  3381. * @srf_bf: Bloom Filter
  3382. * @srf_bf_len: Bloom Filter length
  3383. * @srf_bf_idx: Bloom Filter index
  3384. * @srf_macs: SRF MAC addresses
  3385. * @srf_num_macs: number of MAC addresses in SRF
  3386. * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
  3387. * @tx_filters: filters that should be transmitted in the SDF.
  3388. * @num_rx_filters: length of &rx_filters.
  3389. * @num_tx_filters: length of &tx_filters.
  3390. * @instance_id: driver allocated id of the function.
  3391. * @cookie: unique NAN function identifier.
  3392. */
  3393. struct cfg80211_nan_func {
  3394. enum nl80211_nan_function_type type;
  3395. u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
  3396. u8 publish_type;
  3397. bool close_range;
  3398. bool publish_bcast;
  3399. bool subscribe_active;
  3400. u8 followup_id;
  3401. u8 followup_reqid;
  3402. struct mac_address followup_dest;
  3403. u32 ttl;
  3404. const u8 *serv_spec_info;
  3405. u8 serv_spec_info_len;
  3406. bool srf_include;
  3407. const u8 *srf_bf;
  3408. u8 srf_bf_len;
  3409. u8 srf_bf_idx;
  3410. struct mac_address *srf_macs;
  3411. int srf_num_macs;
  3412. struct cfg80211_nan_func_filter *rx_filters;
  3413. struct cfg80211_nan_func_filter *tx_filters;
  3414. u8 num_tx_filters;
  3415. u8 num_rx_filters;
  3416. u8 instance_id;
  3417. u64 cookie;
  3418. ANDROID_KABI_RESERVE(1);
  3419. };
  3420. /**
  3421. * struct cfg80211_pmk_conf - PMK configuration
  3422. *
  3423. * @aa: authenticator address
  3424. * @pmk_len: PMK length in bytes.
  3425. * @pmk: the PMK material
  3426. * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
  3427. * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
  3428. * holds PMK-R0.
  3429. */
  3430. struct cfg80211_pmk_conf {
  3431. const u8 *aa;
  3432. u8 pmk_len;
  3433. const u8 *pmk;
  3434. const u8 *pmk_r0_name;
  3435. };
  3436. /**
  3437. * struct cfg80211_external_auth_params - Trigger External authentication.
  3438. *
  3439. * Commonly used across the external auth request and event interfaces.
  3440. *
  3441. * @action: action type / trigger for external authentication. Only significant
  3442. * for the authentication request event interface (driver to user space).
  3443. * @bssid: BSSID of the peer with which the authentication has
  3444. * to happen. Used by both the authentication request event and
  3445. * authentication response command interface.
  3446. * @ssid: SSID of the AP. Used by both the authentication request event and
  3447. * authentication response command interface.
  3448. * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
  3449. * authentication request event interface.
  3450. * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
  3451. * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
  3452. * the real status code for failures. Used only for the authentication
  3453. * response command interface (user space to driver).
  3454. * @pmkid: The identifier to refer a PMKSA.
  3455. * @mld_addr: MLD address of the peer. Used by the authentication request event
  3456. * interface. Driver indicates this to enable MLO during the authentication
  3457. * offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT
  3458. * flag capability in NL80211_CMD_CONNECT to know whether the user space
  3459. * supports enabling MLO during the authentication offload.
  3460. * User space should use the address of the interface (on which the
  3461. * authentication request event reported) as self MLD address. User space
  3462. * and driver should use MLD addresses in RA, TA and BSSID fields of
  3463. * authentication frames sent or received via cfg80211. The driver
  3464. * translates the MLD addresses to/from link addresses based on the link
  3465. * chosen for the authentication.
  3466. */
  3467. struct cfg80211_external_auth_params {
  3468. enum nl80211_external_auth_action action;
  3469. u8 bssid[ETH_ALEN] __aligned(2);
  3470. struct cfg80211_ssid ssid;
  3471. unsigned int key_mgmt_suite;
  3472. u16 status;
  3473. const u8 *pmkid;
  3474. u8 mld_addr[ETH_ALEN] __aligned(2);
  3475. };
  3476. /**
  3477. * struct cfg80211_ftm_responder_stats - FTM responder statistics
  3478. *
  3479. * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
  3480. * indicate the relevant values in this struct for them
  3481. * @success_num: number of FTM sessions in which all frames were successfully
  3482. * answered
  3483. * @partial_num: number of FTM sessions in which part of frames were
  3484. * successfully answered
  3485. * @failed_num: number of failed FTM sessions
  3486. * @asap_num: number of ASAP FTM sessions
  3487. * @non_asap_num: number of non-ASAP FTM sessions
  3488. * @total_duration_ms: total sessions durations - gives an indication
  3489. * of how much time the responder was busy
  3490. * @unknown_triggers_num: number of unknown FTM triggers - triggers from
  3491. * initiators that didn't finish successfully the negotiation phase with
  3492. * the responder
  3493. * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
  3494. * for a new scheduling although it already has scheduled FTM slot
  3495. * @out_of_window_triggers_num: total FTM triggers out of scheduled window
  3496. */
  3497. struct cfg80211_ftm_responder_stats {
  3498. u32 filled;
  3499. u32 success_num;
  3500. u32 partial_num;
  3501. u32 failed_num;
  3502. u32 asap_num;
  3503. u32 non_asap_num;
  3504. u64 total_duration_ms;
  3505. u32 unknown_triggers_num;
  3506. u32 reschedule_requests_num;
  3507. u32 out_of_window_triggers_num;
  3508. };
  3509. /**
  3510. * struct cfg80211_pmsr_ftm_result - FTM result
  3511. * @failure_reason: if this measurement failed (PMSR status is
  3512. * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
  3513. * reason than just "failure"
  3514. * @burst_index: if reporting partial results, this is the index
  3515. * in [0 .. num_bursts-1] of the burst that's being reported
  3516. * @num_ftmr_attempts: number of FTM request frames transmitted
  3517. * @num_ftmr_successes: number of FTM request frames acked
  3518. * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
  3519. * fill this to indicate in how many seconds a retry is deemed possible
  3520. * by the responder
  3521. * @num_bursts_exp: actual number of bursts exponent negotiated
  3522. * @burst_duration: actual burst duration negotiated
  3523. * @ftms_per_burst: actual FTMs per burst negotiated
  3524. * @lci_len: length of LCI information (if present)
  3525. * @civicloc_len: length of civic location information (if present)
  3526. * @lci: LCI data (may be %NULL)
  3527. * @civicloc: civic location data (may be %NULL)
  3528. * @rssi_avg: average RSSI over FTM action frames reported
  3529. * @rssi_spread: spread of the RSSI over FTM action frames reported
  3530. * @tx_rate: bitrate for transmitted FTM action frame response
  3531. * @rx_rate: bitrate of received FTM action frame
  3532. * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
  3533. * @rtt_variance: variance of RTTs measured (note that standard deviation is
  3534. * the square root of the variance)
  3535. * @rtt_spread: spread of the RTTs measured
  3536. * @dist_avg: average of distances (mm) measured
  3537. * (must have either this or @rtt_avg)
  3538. * @dist_variance: variance of distances measured (see also @rtt_variance)
  3539. * @dist_spread: spread of distances measured (see also @rtt_spread)
  3540. * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
  3541. * @num_ftmr_successes_valid: @num_ftmr_successes is valid
  3542. * @rssi_avg_valid: @rssi_avg is valid
  3543. * @rssi_spread_valid: @rssi_spread is valid
  3544. * @tx_rate_valid: @tx_rate is valid
  3545. * @rx_rate_valid: @rx_rate is valid
  3546. * @rtt_avg_valid: @rtt_avg is valid
  3547. * @rtt_variance_valid: @rtt_variance is valid
  3548. * @rtt_spread_valid: @rtt_spread is valid
  3549. * @dist_avg_valid: @dist_avg is valid
  3550. * @dist_variance_valid: @dist_variance is valid
  3551. * @dist_spread_valid: @dist_spread is valid
  3552. */
  3553. struct cfg80211_pmsr_ftm_result {
  3554. const u8 *lci;
  3555. const u8 *civicloc;
  3556. unsigned int lci_len;
  3557. unsigned int civicloc_len;
  3558. enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
  3559. u32 num_ftmr_attempts, num_ftmr_successes;
  3560. s16 burst_index;
  3561. u8 busy_retry_time;
  3562. u8 num_bursts_exp;
  3563. u8 burst_duration;
  3564. u8 ftms_per_burst;
  3565. s32 rssi_avg;
  3566. s32 rssi_spread;
  3567. struct rate_info tx_rate, rx_rate;
  3568. s64 rtt_avg;
  3569. s64 rtt_variance;
  3570. s64 rtt_spread;
  3571. s64 dist_avg;
  3572. s64 dist_variance;
  3573. s64 dist_spread;
  3574. u16 num_ftmr_attempts_valid:1,
  3575. num_ftmr_successes_valid:1,
  3576. rssi_avg_valid:1,
  3577. rssi_spread_valid:1,
  3578. tx_rate_valid:1,
  3579. rx_rate_valid:1,
  3580. rtt_avg_valid:1,
  3581. rtt_variance_valid:1,
  3582. rtt_spread_valid:1,
  3583. dist_avg_valid:1,
  3584. dist_variance_valid:1,
  3585. dist_spread_valid:1;
  3586. ANDROID_KABI_RESERVE(1);
  3587. };
  3588. /**
  3589. * struct cfg80211_pmsr_result - peer measurement result
  3590. * @addr: address of the peer
  3591. * @host_time: host time (use ktime_get_boottime() adjust to the time when the
  3592. * measurement was made)
  3593. * @ap_tsf: AP's TSF at measurement time
  3594. * @status: status of the measurement
  3595. * @final: if reporting partial results, mark this as the last one; if not
  3596. * reporting partial results always set this flag
  3597. * @ap_tsf_valid: indicates the @ap_tsf value is valid
  3598. * @type: type of the measurement reported, note that we only support reporting
  3599. * one type at a time, but you can report multiple results separately and
  3600. * they're all aggregated for userspace.
  3601. * @ftm: FTM result
  3602. */
  3603. struct cfg80211_pmsr_result {
  3604. u64 host_time, ap_tsf;
  3605. enum nl80211_peer_measurement_status status;
  3606. u8 addr[ETH_ALEN];
  3607. u8 final:1,
  3608. ap_tsf_valid:1;
  3609. enum nl80211_peer_measurement_type type;
  3610. union {
  3611. struct cfg80211_pmsr_ftm_result ftm;
  3612. };
  3613. };
  3614. /**
  3615. * struct cfg80211_pmsr_ftm_request_peer - FTM request data
  3616. * @requested: indicates FTM is requested
  3617. * @preamble: frame preamble to use
  3618. * @burst_period: burst period to use
  3619. * @asap: indicates to use ASAP mode
  3620. * @num_bursts_exp: number of bursts exponent
  3621. * @burst_duration: burst duration
  3622. * @ftms_per_burst: number of FTMs per burst
  3623. * @ftmr_retries: number of retries for FTM request
  3624. * @request_lci: request LCI information
  3625. * @request_civicloc: request civic location information
  3626. * @trigger_based: use trigger based ranging for the measurement
  3627. * If neither @trigger_based nor @non_trigger_based is set,
  3628. * EDCA based ranging will be used.
  3629. * @non_trigger_based: use non trigger based ranging for the measurement
  3630. * If neither @trigger_based nor @non_trigger_based is set,
  3631. * EDCA based ranging will be used.
  3632. * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
  3633. * @trigger_based or @non_trigger_based is set.
  3634. * @bss_color: the bss color of the responder. Optional. Set to zero to
  3635. * indicate the driver should set the BSS color. Only valid if
  3636. * @non_trigger_based or @trigger_based is set.
  3637. *
  3638. * See also nl80211 for the respective attribute documentation.
  3639. */
  3640. struct cfg80211_pmsr_ftm_request_peer {
  3641. enum nl80211_preamble preamble;
  3642. u16 burst_period;
  3643. u8 requested:1,
  3644. asap:1,
  3645. request_lci:1,
  3646. request_civicloc:1,
  3647. trigger_based:1,
  3648. non_trigger_based:1,
  3649. lmr_feedback:1;
  3650. u8 num_bursts_exp;
  3651. u8 burst_duration;
  3652. u8 ftms_per_burst;
  3653. u8 ftmr_retries;
  3654. u8 bss_color;
  3655. };
  3656. /**
  3657. * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
  3658. * @addr: MAC address
  3659. * @chandef: channel to use
  3660. * @report_ap_tsf: report the associated AP's TSF
  3661. * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
  3662. */
  3663. struct cfg80211_pmsr_request_peer {
  3664. u8 addr[ETH_ALEN];
  3665. struct cfg80211_chan_def chandef;
  3666. u8 report_ap_tsf:1;
  3667. struct cfg80211_pmsr_ftm_request_peer ftm;
  3668. };
  3669. /**
  3670. * struct cfg80211_pmsr_request - peer measurement request
  3671. * @cookie: cookie, set by cfg80211
  3672. * @nl_portid: netlink portid - used by cfg80211
  3673. * @drv_data: driver data for this request, if required for aborting,
  3674. * not otherwise freed or anything by cfg80211
  3675. * @mac_addr: MAC address used for (randomised) request
  3676. * @mac_addr_mask: MAC address mask used for randomisation, bits that
  3677. * are 0 in the mask should be randomised, bits that are 1 should
  3678. * be taken from the @mac_addr
  3679. * @list: used by cfg80211 to hold on to the request
  3680. * @timeout: timeout (in milliseconds) for the whole operation, if
  3681. * zero it means there's no timeout
  3682. * @n_peers: number of peers to do measurements with
  3683. * @peers: per-peer measurement request data
  3684. */
  3685. struct cfg80211_pmsr_request {
  3686. u64 cookie;
  3687. void *drv_data;
  3688. u32 n_peers;
  3689. u32 nl_portid;
  3690. u32 timeout;
  3691. u8 mac_addr[ETH_ALEN] __aligned(2);
  3692. u8 mac_addr_mask[ETH_ALEN] __aligned(2);
  3693. struct list_head list;
  3694. struct cfg80211_pmsr_request_peer peers[];
  3695. };
  3696. /**
  3697. * struct cfg80211_update_owe_info - OWE Information
  3698. *
  3699. * This structure provides information needed for the drivers to offload OWE
  3700. * (Opportunistic Wireless Encryption) processing to the user space.
  3701. *
  3702. * Commonly used across update_owe_info request and event interfaces.
  3703. *
  3704. * @peer: MAC address of the peer device for which the OWE processing
  3705. * has to be done.
  3706. * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
  3707. * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
  3708. * cannot give you the real status code for failures. Used only for
  3709. * OWE update request command interface (user space to driver).
  3710. * @ie: IEs obtained from the peer or constructed by the user space. These are
  3711. * the IEs of the remote peer in the event from the host driver and
  3712. * the constructed IEs by the user space in the request interface.
  3713. * @ie_len: Length of IEs in octets.
  3714. * @assoc_link_id: MLO link ID of the AP, with which (re)association requested
  3715. * by peer. This will be filled by driver for both MLO and non-MLO station
  3716. * connections when the AP affiliated with an MLD. For non-MLD AP mode, it
  3717. * will be -1. Used only with OWE update event (driver to user space).
  3718. * @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO
  3719. * connection, it will be all zeros. This is applicable only when
  3720. * @assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only
  3721. * with OWE update event (driver to user space).
  3722. */
  3723. struct cfg80211_update_owe_info {
  3724. u8 peer[ETH_ALEN] __aligned(2);
  3725. u16 status;
  3726. const u8 *ie;
  3727. size_t ie_len;
  3728. int assoc_link_id;
  3729. u8 peer_mld_addr[ETH_ALEN] __aligned(2);
  3730. };
  3731. /**
  3732. * struct mgmt_frame_regs - management frame registrations data
  3733. * @global_stypes: bitmap of management frame subtypes registered
  3734. * for the entire device
  3735. * @interface_stypes: bitmap of management frame subtypes registered
  3736. * for the given interface
  3737. * @global_mcast_stypes: mcast RX is needed globally for these subtypes
  3738. * @interface_mcast_stypes: mcast RX is needed on this interface
  3739. * for these subtypes
  3740. */
  3741. struct mgmt_frame_regs {
  3742. u32 global_stypes, interface_stypes;
  3743. u32 global_mcast_stypes, interface_mcast_stypes;
  3744. };
  3745. /**
  3746. * struct cfg80211_ops - backend description for wireless configuration
  3747. *
  3748. * This struct is registered by fullmac card drivers and/or wireless stacks
  3749. * in order to handle configuration requests on their interfaces.
  3750. *
  3751. * All callbacks except where otherwise noted should return 0
  3752. * on success or a negative error code.
  3753. *
  3754. * All operations are invoked with the wiphy mutex held. The RTNL may be
  3755. * held in addition (due to wireless extensions) but this cannot be relied
  3756. * upon except in cases where documented below. Note that due to ordering,
  3757. * the RTNL also cannot be acquired in any handlers.
  3758. *
  3759. * @suspend: wiphy device needs to be suspended. The variable @wow will
  3760. * be %NULL or contain the enabled Wake-on-Wireless triggers that are
  3761. * configured for the device.
  3762. * @resume: wiphy device needs to be resumed
  3763. * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
  3764. * to call device_set_wakeup_enable() to enable/disable wakeup from
  3765. * the device.
  3766. *
  3767. * @add_virtual_intf: create a new virtual interface with the given name,
  3768. * must set the struct wireless_dev's iftype. Beware: You must create
  3769. * the new netdev in the wiphy's network namespace! Returns the struct
  3770. * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
  3771. * also set the address member in the wdev.
  3772. * This additionally holds the RTNL to be able to do netdev changes.
  3773. *
  3774. * @del_virtual_intf: remove the virtual interface
  3775. * This additionally holds the RTNL to be able to do netdev changes.
  3776. *
  3777. * @change_virtual_intf: change type/configuration of virtual interface,
  3778. * keep the struct wireless_dev's iftype updated.
  3779. * This additionally holds the RTNL to be able to do netdev changes.
  3780. *
  3781. * @add_intf_link: Add a new MLO link to the given interface. Note that
  3782. * the wdev->link[] data structure has been updated, so the new link
  3783. * address is available.
  3784. * @del_intf_link: Remove an MLO link from the given interface.
  3785. *
  3786. * @add_key: add a key with the given parameters. @mac_addr will be %NULL
  3787. * when adding a group key. @link_id will be -1 for non-MLO connection.
  3788. * For MLO connection, @link_id will be >= 0 for group key and -1 for
  3789. * pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key.
  3790. *
  3791. * @get_key: get information about the key with the given parameters.
  3792. * @mac_addr will be %NULL when requesting information for a group
  3793. * key. All pointers given to the @callback function need not be valid
  3794. * after it returns. This function should return an error if it is
  3795. * not possible to retrieve the key, -ENOENT if it doesn't exist.
  3796. * @link_id will be -1 for non-MLO connection. For MLO connection,
  3797. * @link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr
  3798. * will be peer's MLD address for MLO pairwise key.
  3799. *
  3800. * @del_key: remove a key given the @mac_addr (%NULL for a group key)
  3801. * and @key_index, return -ENOENT if the key doesn't exist. @link_id will
  3802. * be -1 for non-MLO connection. For MLO connection, @link_id will be >= 0
  3803. * for group key and -1 for pairwise key, @mac_addr will be peer's MLD
  3804. * address for MLO pairwise key.
  3805. *
  3806. * @set_default_key: set the default key on an interface. @link_id will be >= 0
  3807. * for MLO connection and -1 for non-MLO connection.
  3808. *
  3809. * @set_default_mgmt_key: set the default management frame key on an interface.
  3810. * @link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
  3811. *
  3812. * @set_default_beacon_key: set the default Beacon frame key on an interface.
  3813. * @link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
  3814. *
  3815. * @set_rekey_data: give the data necessary for GTK rekeying to the driver
  3816. *
  3817. * @start_ap: Start acting in AP mode defined by the parameters.
  3818. * @change_beacon: Change the beacon parameters for an access point mode
  3819. * interface. This should reject the call when AP mode wasn't started.
  3820. * @stop_ap: Stop being an AP, including stopping beaconing.
  3821. *
  3822. * @add_station: Add a new station.
  3823. * @del_station: Remove a station
  3824. * @change_station: Modify a given station. Note that flags changes are not much
  3825. * validated in cfg80211, in particular the auth/assoc/authorized flags
  3826. * might come to the driver in invalid combinations -- make sure to check
  3827. * them, also against the existing state! Drivers must call
  3828. * cfg80211_check_station_change() to validate the information.
  3829. * @get_station: get station information for the station identified by @mac
  3830. * @dump_station: dump station callback -- resume dump at index @idx
  3831. *
  3832. * @add_mpath: add a fixed mesh path
  3833. * @del_mpath: delete a given mesh path
  3834. * @change_mpath: change a given mesh path
  3835. * @get_mpath: get a mesh path for the given parameters
  3836. * @dump_mpath: dump mesh path callback -- resume dump at index @idx
  3837. * @get_mpp: get a mesh proxy path for the given parameters
  3838. * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
  3839. * @join_mesh: join the mesh network with the specified parameters
  3840. * (invoked with the wireless_dev mutex held)
  3841. * @leave_mesh: leave the current mesh network
  3842. * (invoked with the wireless_dev mutex held)
  3843. *
  3844. * @get_mesh_config: Get the current mesh configuration
  3845. *
  3846. * @update_mesh_config: Update mesh parameters on a running mesh.
  3847. * The mask is a bitfield which tells us which parameters to
  3848. * set, and which to leave alone.
  3849. *
  3850. * @change_bss: Modify parameters for a given BSS.
  3851. *
  3852. * @set_txq_params: Set TX queue parameters
  3853. *
  3854. * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
  3855. * as it doesn't implement join_mesh and needs to set the channel to
  3856. * join the mesh instead.
  3857. *
  3858. * @set_monitor_channel: Set the monitor mode channel for the device. If other
  3859. * interfaces are active this callback should reject the configuration.
  3860. * If no interfaces are active or the device is down, the channel should
  3861. * be stored for when a monitor interface becomes active.
  3862. *
  3863. * @scan: Request to do a scan. If returning zero, the scan request is given
  3864. * the driver, and will be valid until passed to cfg80211_scan_done().
  3865. * For scan results, call cfg80211_inform_bss(); you can call this outside
  3866. * the scan/scan_done bracket too.
  3867. * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
  3868. * indicate the status of the scan through cfg80211_scan_done().
  3869. *
  3870. * @auth: Request to authenticate with the specified peer
  3871. * (invoked with the wireless_dev mutex held)
  3872. * @assoc: Request to (re)associate with the specified peer
  3873. * (invoked with the wireless_dev mutex held)
  3874. * @deauth: Request to deauthenticate from the specified peer
  3875. * (invoked with the wireless_dev mutex held)
  3876. * @disassoc: Request to disassociate from the specified peer
  3877. * (invoked with the wireless_dev mutex held)
  3878. *
  3879. * @connect: Connect to the ESS with the specified parameters. When connected,
  3880. * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
  3881. * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
  3882. * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
  3883. * from the AP or cfg80211_connect_timeout() if no frame with status code
  3884. * was received.
  3885. * The driver is allowed to roam to other BSSes within the ESS when the
  3886. * other BSS matches the connect parameters. When such roaming is initiated
  3887. * by the driver, the driver is expected to verify that the target matches
  3888. * the configured security parameters and to use Reassociation Request
  3889. * frame instead of Association Request frame.
  3890. * The connect function can also be used to request the driver to perform a
  3891. * specific roam when connected to an ESS. In that case, the prev_bssid
  3892. * parameter is set to the BSSID of the currently associated BSS as an
  3893. * indication of requesting reassociation.
  3894. * In both the driver-initiated and new connect() call initiated roaming
  3895. * cases, the result of roaming is indicated with a call to
  3896. * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
  3897. * @update_connect_params: Update the connect parameters while connected to a
  3898. * BSS. The updated parameters can be used by driver/firmware for
  3899. * subsequent BSS selection (roaming) decisions and to form the
  3900. * Authentication/(Re)Association Request frames. This call does not
  3901. * request an immediate disassociation or reassociation with the current
  3902. * BSS, i.e., this impacts only subsequent (re)associations. The bits in
  3903. * changed are defined in &enum cfg80211_connect_params_changed.
  3904. * (invoked with the wireless_dev mutex held)
  3905. * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
  3906. * connection is in progress. Once done, call cfg80211_disconnected() in
  3907. * case connection was already established (invoked with the
  3908. * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
  3909. *
  3910. * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
  3911. * cfg80211_ibss_joined(), also call that function when changing BSSID due
  3912. * to a merge.
  3913. * (invoked with the wireless_dev mutex held)
  3914. * @leave_ibss: Leave the IBSS.
  3915. * (invoked with the wireless_dev mutex held)
  3916. *
  3917. * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
  3918. * MESH mode)
  3919. *
  3920. * @set_wiphy_params: Notify that wiphy parameters have changed;
  3921. * @changed bitfield (see &enum wiphy_params_flags) describes which values
  3922. * have changed. The actual parameter values are available in
  3923. * struct wiphy. If returning an error, no value should be changed.
  3924. *
  3925. * @set_tx_power: set the transmit power according to the parameters,
  3926. * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
  3927. * wdev may be %NULL if power was set for the wiphy, and will
  3928. * always be %NULL unless the driver supports per-vif TX power
  3929. * (as advertised by the nl80211 feature flag.)
  3930. * @get_tx_power: store the current TX power into the dbm variable;
  3931. * return 0 if successful
  3932. *
  3933. * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
  3934. * functions to adjust rfkill hw state
  3935. *
  3936. * @dump_survey: get site survey information.
  3937. *
  3938. * @remain_on_channel: Request the driver to remain awake on the specified
  3939. * channel for the specified duration to complete an off-channel
  3940. * operation (e.g., public action frame exchange). When the driver is
  3941. * ready on the requested channel, it must indicate this with an event
  3942. * notification by calling cfg80211_ready_on_channel().
  3943. * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
  3944. * This allows the operation to be terminated prior to timeout based on
  3945. * the duration value.
  3946. * @mgmt_tx: Transmit a management frame.
  3947. * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
  3948. * frame on another channel
  3949. *
  3950. * @testmode_cmd: run a test mode command; @wdev may be %NULL
  3951. * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
  3952. * used by the function, but 0 and 1 must not be touched. Additionally,
  3953. * return error codes other than -ENOBUFS and -ENOENT will terminate the
  3954. * dump and return to userspace with an error, so be careful. If any data
  3955. * was passed in from userspace then the data/len arguments will be present
  3956. * and point to the data contained in %NL80211_ATTR_TESTDATA.
  3957. *
  3958. * @set_bitrate_mask: set the bitrate mask configuration
  3959. *
  3960. * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
  3961. * devices running firmwares capable of generating the (re) association
  3962. * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
  3963. * @del_pmksa: Delete a cached PMKID.
  3964. * @flush_pmksa: Flush all cached PMKIDs.
  3965. * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
  3966. * allows the driver to adjust the dynamic ps timeout value.
  3967. * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
  3968. * After configuration, the driver should (soon) send an event indicating
  3969. * the current level is above/below the configured threshold; this may
  3970. * need some care when the configuration is changed (without first being
  3971. * disabled.)
  3972. * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
  3973. * connection quality monitor. An event is to be sent only when the
  3974. * signal level is found to be outside the two values. The driver should
  3975. * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
  3976. * If it is provided then there's no point providing @set_cqm_rssi_config.
  3977. * @set_cqm_txe_config: Configure connection quality monitor TX error
  3978. * thresholds.
  3979. * @sched_scan_start: Tell the driver to start a scheduled scan.
  3980. * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
  3981. * given request id. This call must stop the scheduled scan and be ready
  3982. * for starting a new one before it returns, i.e. @sched_scan_start may be
  3983. * called immediately after that again and should not fail in that case.
  3984. * The driver should not call cfg80211_sched_scan_stopped() for a requested
  3985. * stop (when this method returns 0).
  3986. *
  3987. * @update_mgmt_frame_registrations: Notify the driver that management frame
  3988. * registrations were updated. The callback is allowed to sleep.
  3989. *
  3990. * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
  3991. * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
  3992. * reject TX/RX mask combinations they cannot support by returning -EINVAL
  3993. * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
  3994. *
  3995. * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
  3996. *
  3997. * @tdls_mgmt: Transmit a TDLS management frame.
  3998. * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
  3999. *
  4000. * @probe_client: probe an associated client, must return a cookie that it
  4001. * later passes to cfg80211_probe_status().
  4002. *
  4003. * @set_noack_map: Set the NoAck Map for the TIDs.
  4004. *
  4005. * @get_channel: Get the current operating channel for the virtual interface.
  4006. * For monitor interfaces, it should return %NULL unless there's a single
  4007. * current monitoring channel.
  4008. *
  4009. * @start_p2p_device: Start the given P2P device.
  4010. * @stop_p2p_device: Stop the given P2P device.
  4011. *
  4012. * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
  4013. * Parameters include ACL policy, an array of MAC address of stations
  4014. * and the number of MAC addresses. If there is already a list in driver
  4015. * this new list replaces the existing one. Driver has to clear its ACL
  4016. * when number of MAC addresses entries is passed as 0. Drivers which
  4017. * advertise the support for MAC based ACL have to implement this callback.
  4018. *
  4019. * @start_radar_detection: Start radar detection in the driver.
  4020. *
  4021. * @end_cac: End running CAC, probably because a related CAC
  4022. * was finished on another phy.
  4023. *
  4024. * @update_ft_ies: Provide updated Fast BSS Transition information to the
  4025. * driver. If the SME is in the driver/firmware, this information can be
  4026. * used in building Authentication and Reassociation Request frames.
  4027. *
  4028. * @crit_proto_start: Indicates a critical protocol needs more link reliability
  4029. * for a given duration (milliseconds). The protocol is provided so the
  4030. * driver can take the most appropriate actions.
  4031. * @crit_proto_stop: Indicates critical protocol no longer needs increased link
  4032. * reliability. This operation can not fail.
  4033. * @set_coalesce: Set coalesce parameters.
  4034. *
  4035. * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
  4036. * responsible for veryfing if the switch is possible. Since this is
  4037. * inherently tricky driver may decide to disconnect an interface later
  4038. * with cfg80211_stop_iface(). This doesn't mean driver can accept
  4039. * everything. It should do it's best to verify requests and reject them
  4040. * as soon as possible.
  4041. *
  4042. * @set_qos_map: Set QoS mapping information to the driver
  4043. *
  4044. * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
  4045. * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
  4046. * changes during the lifetime of the BSS.
  4047. *
  4048. * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
  4049. * with the given parameters; action frame exchange has been handled by
  4050. * userspace so this just has to modify the TX path to take the TS into
  4051. * account.
  4052. * If the admitted time is 0 just validate the parameters to make sure
  4053. * the session can be created at all; it is valid to just always return
  4054. * success for that but that may result in inefficient behaviour (handshake
  4055. * with the peer followed by immediate teardown when the addition is later
  4056. * rejected)
  4057. * @del_tx_ts: remove an existing TX TS
  4058. *
  4059. * @join_ocb: join the OCB network with the specified parameters
  4060. * (invoked with the wireless_dev mutex held)
  4061. * @leave_ocb: leave the current OCB network
  4062. * (invoked with the wireless_dev mutex held)
  4063. *
  4064. * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
  4065. * is responsible for continually initiating channel-switching operations
  4066. * and returning to the base channel for communication with the AP.
  4067. * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
  4068. * peers must be on the base channel when the call completes.
  4069. * @start_nan: Start the NAN interface.
  4070. * @stop_nan: Stop the NAN interface.
  4071. * @add_nan_func: Add a NAN function. Returns negative value on failure.
  4072. * On success @nan_func ownership is transferred to the driver and
  4073. * it may access it outside of the scope of this function. The driver
  4074. * should free the @nan_func when no longer needed by calling
  4075. * cfg80211_free_nan_func().
  4076. * On success the driver should assign an instance_id in the
  4077. * provided @nan_func.
  4078. * @del_nan_func: Delete a NAN function.
  4079. * @nan_change_conf: changes NAN configuration. The changed parameters must
  4080. * be specified in @changes (using &enum cfg80211_nan_conf_changes);
  4081. * All other parameters must be ignored.
  4082. *
  4083. * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
  4084. *
  4085. * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
  4086. * function should return phy stats, and interface stats otherwise.
  4087. *
  4088. * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
  4089. * If not deleted through @del_pmk the PMK remains valid until disconnect
  4090. * upon which the driver should clear it.
  4091. * (invoked with the wireless_dev mutex held)
  4092. * @del_pmk: delete the previously configured PMK for the given authenticator.
  4093. * (invoked with the wireless_dev mutex held)
  4094. *
  4095. * @external_auth: indicates result of offloaded authentication processing from
  4096. * user space
  4097. *
  4098. * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
  4099. * tells the driver that the frame should not be encrypted.
  4100. *
  4101. * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
  4102. * Statistics should be cumulative, currently no way to reset is provided.
  4103. * @start_pmsr: start peer measurement (e.g. FTM)
  4104. * @abort_pmsr: abort peer measurement
  4105. *
  4106. * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
  4107. * but offloading OWE processing to the user space will get the updated
  4108. * DH IE through this interface.
  4109. *
  4110. * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
  4111. * and overrule HWMP path selection algorithm.
  4112. * @set_tid_config: TID specific configuration, this can be peer or BSS specific
  4113. * This callback may sleep.
  4114. * @reset_tid_config: Reset TID specific configuration for the peer, for the
  4115. * given TIDs. This callback may sleep.
  4116. *
  4117. * @set_sar_specs: Update the SAR (TX power) settings.
  4118. *
  4119. * @color_change: Initiate a color change.
  4120. *
  4121. * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
  4122. * those to decrypt (Re)Association Request and encrypt (Re)Association
  4123. * Response frame.
  4124. *
  4125. * @set_radar_background: Configure dedicated offchannel chain available for
  4126. * radar/CAC detection on some hw. This chain can't be used to transmit
  4127. * or receive frames and it is bounded to a running wdev.
  4128. * Background radar/CAC detection allows to avoid the CAC downtime
  4129. * switching to a different channel during CAC detection on the selected
  4130. * radar channel.
  4131. * The caller is expected to set chandef pointer to NULL in order to
  4132. * disable background CAC/radar detection.
  4133. * @add_link_station: Add a link to a station.
  4134. * @mod_link_station: Modify a link of a station.
  4135. * @del_link_station: Remove a link of a station.
  4136. */
  4137. struct cfg80211_ops {
  4138. int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
  4139. int (*resume)(struct wiphy *wiphy);
  4140. void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
  4141. struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
  4142. const char *name,
  4143. unsigned char name_assign_type,
  4144. enum nl80211_iftype type,
  4145. struct vif_params *params);
  4146. int (*del_virtual_intf)(struct wiphy *wiphy,
  4147. struct wireless_dev *wdev);
  4148. int (*change_virtual_intf)(struct wiphy *wiphy,
  4149. struct net_device *dev,
  4150. enum nl80211_iftype type,
  4151. struct vif_params *params);
  4152. int (*add_intf_link)(struct wiphy *wiphy,
  4153. struct wireless_dev *wdev,
  4154. unsigned int link_id);
  4155. void (*del_intf_link)(struct wiphy *wiphy,
  4156. struct wireless_dev *wdev,
  4157. unsigned int link_id);
  4158. int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
  4159. int link_id, u8 key_index, bool pairwise,
  4160. const u8 *mac_addr, struct key_params *params);
  4161. int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
  4162. int link_id, u8 key_index, bool pairwise,
  4163. const u8 *mac_addr, void *cookie,
  4164. void (*callback)(void *cookie, struct key_params*));
  4165. int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
  4166. int link_id, u8 key_index, bool pairwise,
  4167. const u8 *mac_addr);
  4168. int (*set_default_key)(struct wiphy *wiphy,
  4169. struct net_device *netdev, int link_id,
  4170. u8 key_index, bool unicast, bool multicast);
  4171. int (*set_default_mgmt_key)(struct wiphy *wiphy,
  4172. struct net_device *netdev, int link_id,
  4173. u8 key_index);
  4174. int (*set_default_beacon_key)(struct wiphy *wiphy,
  4175. struct net_device *netdev,
  4176. int link_id,
  4177. u8 key_index);
  4178. int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
  4179. struct cfg80211_ap_settings *settings);
  4180. int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
  4181. struct cfg80211_beacon_data *info);
  4182. int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
  4183. unsigned int link_id);
  4184. int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
  4185. const u8 *mac,
  4186. struct station_parameters *params);
  4187. int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
  4188. struct station_del_parameters *params);
  4189. int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
  4190. const u8 *mac,
  4191. struct station_parameters *params);
  4192. int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
  4193. const u8 *mac, struct station_info *sinfo);
  4194. int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
  4195. int idx, u8 *mac, struct station_info *sinfo);
  4196. int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
  4197. const u8 *dst, const u8 *next_hop);
  4198. int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
  4199. const u8 *dst);
  4200. int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
  4201. const u8 *dst, const u8 *next_hop);
  4202. int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
  4203. u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
  4204. int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
  4205. int idx, u8 *dst, u8 *next_hop,
  4206. struct mpath_info *pinfo);
  4207. int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
  4208. u8 *dst, u8 *mpp, struct mpath_info *pinfo);
  4209. int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
  4210. int idx, u8 *dst, u8 *mpp,
  4211. struct mpath_info *pinfo);
  4212. int (*get_mesh_config)(struct wiphy *wiphy,
  4213. struct net_device *dev,
  4214. struct mesh_config *conf);
  4215. int (*update_mesh_config)(struct wiphy *wiphy,
  4216. struct net_device *dev, u32 mask,
  4217. const struct mesh_config *nconf);
  4218. int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
  4219. const struct mesh_config *conf,
  4220. const struct mesh_setup *setup);
  4221. int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
  4222. int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
  4223. struct ocb_setup *setup);
  4224. int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
  4225. int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
  4226. struct bss_parameters *params);
  4227. int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
  4228. struct ieee80211_txq_params *params);
  4229. int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
  4230. struct net_device *dev,
  4231. struct ieee80211_channel *chan);
  4232. int (*set_monitor_channel)(struct wiphy *wiphy,
  4233. struct cfg80211_chan_def *chandef);
  4234. int (*scan)(struct wiphy *wiphy,
  4235. struct cfg80211_scan_request *request);
  4236. void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
  4237. int (*auth)(struct wiphy *wiphy, struct net_device *dev,
  4238. struct cfg80211_auth_request *req);
  4239. int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
  4240. struct cfg80211_assoc_request *req);
  4241. int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
  4242. struct cfg80211_deauth_request *req);
  4243. int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
  4244. struct cfg80211_disassoc_request *req);
  4245. int (*connect)(struct wiphy *wiphy, struct net_device *dev,
  4246. struct cfg80211_connect_params *sme);
  4247. int (*update_connect_params)(struct wiphy *wiphy,
  4248. struct net_device *dev,
  4249. struct cfg80211_connect_params *sme,
  4250. u32 changed);
  4251. int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
  4252. u16 reason_code);
  4253. int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
  4254. struct cfg80211_ibss_params *params);
  4255. int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
  4256. int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
  4257. int rate[NUM_NL80211_BANDS]);
  4258. int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
  4259. int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4260. enum nl80211_tx_power_setting type, int mbm);
  4261. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4262. int *dbm);
  4263. void (*rfkill_poll)(struct wiphy *wiphy);
  4264. #ifdef CONFIG_NL80211_TESTMODE
  4265. int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4266. void *data, int len);
  4267. int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
  4268. struct netlink_callback *cb,
  4269. void *data, int len);
  4270. #endif
  4271. int (*set_bitrate_mask)(struct wiphy *wiphy,
  4272. struct net_device *dev,
  4273. unsigned int link_id,
  4274. const u8 *peer,
  4275. const struct cfg80211_bitrate_mask *mask);
  4276. int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
  4277. int idx, struct survey_info *info);
  4278. int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
  4279. struct cfg80211_pmksa *pmksa);
  4280. int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
  4281. struct cfg80211_pmksa *pmksa);
  4282. int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
  4283. int (*remain_on_channel)(struct wiphy *wiphy,
  4284. struct wireless_dev *wdev,
  4285. struct ieee80211_channel *chan,
  4286. unsigned int duration,
  4287. u64 *cookie);
  4288. int (*cancel_remain_on_channel)(struct wiphy *wiphy,
  4289. struct wireless_dev *wdev,
  4290. u64 cookie);
  4291. int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4292. struct cfg80211_mgmt_tx_params *params,
  4293. u64 *cookie);
  4294. int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
  4295. struct wireless_dev *wdev,
  4296. u64 cookie);
  4297. int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
  4298. bool enabled, int timeout);
  4299. int (*set_cqm_rssi_config)(struct wiphy *wiphy,
  4300. struct net_device *dev,
  4301. s32 rssi_thold, u32 rssi_hyst);
  4302. int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
  4303. struct net_device *dev,
  4304. s32 rssi_low, s32 rssi_high);
  4305. int (*set_cqm_txe_config)(struct wiphy *wiphy,
  4306. struct net_device *dev,
  4307. u32 rate, u32 pkts, u32 intvl);
  4308. void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,
  4309. struct wireless_dev *wdev,
  4310. struct mgmt_frame_regs *upd);
  4311. int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
  4312. int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
  4313. int (*sched_scan_start)(struct wiphy *wiphy,
  4314. struct net_device *dev,
  4315. struct cfg80211_sched_scan_request *request);
  4316. int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
  4317. u64 reqid);
  4318. int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
  4319. struct cfg80211_gtk_rekey_data *data);
  4320. int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
  4321. const u8 *peer, u8 action_code, u8 dialog_token,
  4322. u16 status_code, u32 peer_capability,
  4323. bool initiator, const u8 *buf, size_t len);
  4324. int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
  4325. const u8 *peer, enum nl80211_tdls_operation oper);
  4326. int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
  4327. const u8 *peer, u64 *cookie);
  4328. int (*set_noack_map)(struct wiphy *wiphy,
  4329. struct net_device *dev,
  4330. u16 noack_map);
  4331. int (*get_channel)(struct wiphy *wiphy,
  4332. struct wireless_dev *wdev,
  4333. unsigned int link_id,
  4334. struct cfg80211_chan_def *chandef);
  4335. int (*start_p2p_device)(struct wiphy *wiphy,
  4336. struct wireless_dev *wdev);
  4337. void (*stop_p2p_device)(struct wiphy *wiphy,
  4338. struct wireless_dev *wdev);
  4339. int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
  4340. const struct cfg80211_acl_data *params);
  4341. int (*start_radar_detection)(struct wiphy *wiphy,
  4342. struct net_device *dev,
  4343. struct cfg80211_chan_def *chandef,
  4344. u32 cac_time_ms);
  4345. void (*end_cac)(struct wiphy *wiphy,
  4346. struct net_device *dev);
  4347. int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
  4348. struct cfg80211_update_ft_ies_params *ftie);
  4349. int (*crit_proto_start)(struct wiphy *wiphy,
  4350. struct wireless_dev *wdev,
  4351. enum nl80211_crit_proto_id protocol,
  4352. u16 duration);
  4353. void (*crit_proto_stop)(struct wiphy *wiphy,
  4354. struct wireless_dev *wdev);
  4355. int (*set_coalesce)(struct wiphy *wiphy,
  4356. struct cfg80211_coalesce *coalesce);
  4357. int (*channel_switch)(struct wiphy *wiphy,
  4358. struct net_device *dev,
  4359. struct cfg80211_csa_settings *params);
  4360. int (*set_qos_map)(struct wiphy *wiphy,
  4361. struct net_device *dev,
  4362. struct cfg80211_qos_map *qos_map);
  4363. int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
  4364. unsigned int link_id,
  4365. struct cfg80211_chan_def *chandef);
  4366. int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
  4367. u8 tsid, const u8 *peer, u8 user_prio,
  4368. u16 admitted_time);
  4369. int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
  4370. u8 tsid, const u8 *peer);
  4371. int (*tdls_channel_switch)(struct wiphy *wiphy,
  4372. struct net_device *dev,
  4373. const u8 *addr, u8 oper_class,
  4374. struct cfg80211_chan_def *chandef);
  4375. void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
  4376. struct net_device *dev,
  4377. const u8 *addr);
  4378. int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4379. struct cfg80211_nan_conf *conf);
  4380. void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
  4381. int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4382. struct cfg80211_nan_func *nan_func);
  4383. void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4384. u64 cookie);
  4385. int (*nan_change_conf)(struct wiphy *wiphy,
  4386. struct wireless_dev *wdev,
  4387. struct cfg80211_nan_conf *conf,
  4388. u32 changes);
  4389. int (*set_multicast_to_unicast)(struct wiphy *wiphy,
  4390. struct net_device *dev,
  4391. const bool enabled);
  4392. int (*get_txq_stats)(struct wiphy *wiphy,
  4393. struct wireless_dev *wdev,
  4394. struct cfg80211_txq_stats *txqstats);
  4395. int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
  4396. const struct cfg80211_pmk_conf *conf);
  4397. int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
  4398. const u8 *aa);
  4399. int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
  4400. struct cfg80211_external_auth_params *params);
  4401. int (*tx_control_port)(struct wiphy *wiphy,
  4402. struct net_device *dev,
  4403. const u8 *buf, size_t len,
  4404. const u8 *dest, const __be16 proto,
  4405. const bool noencrypt, int link_id,
  4406. u64 *cookie);
  4407. int (*get_ftm_responder_stats)(struct wiphy *wiphy,
  4408. struct net_device *dev,
  4409. struct cfg80211_ftm_responder_stats *ftm_stats);
  4410. int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4411. struct cfg80211_pmsr_request *request);
  4412. void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4413. struct cfg80211_pmsr_request *request);
  4414. int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
  4415. struct cfg80211_update_owe_info *owe_info);
  4416. int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
  4417. const u8 *buf, size_t len);
  4418. int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
  4419. struct cfg80211_tid_config *tid_conf);
  4420. int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
  4421. const u8 *peer, u8 tids);
  4422. int (*set_sar_specs)(struct wiphy *wiphy,
  4423. struct cfg80211_sar_specs *sar);
  4424. int (*color_change)(struct wiphy *wiphy,
  4425. struct net_device *dev,
  4426. struct cfg80211_color_change_settings *params);
  4427. int (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
  4428. struct cfg80211_fils_aad *fils_aad);
  4429. int (*set_radar_background)(struct wiphy *wiphy,
  4430. struct cfg80211_chan_def *chandef);
  4431. int (*add_link_station)(struct wiphy *wiphy, struct net_device *dev,
  4432. struct link_station_parameters *params);
  4433. int (*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,
  4434. struct link_station_parameters *params);
  4435. int (*del_link_station)(struct wiphy *wiphy, struct net_device *dev,
  4436. struct link_station_del_parameters *params);
  4437. ANDROID_KABI_RESERVE(1);
  4438. ANDROID_KABI_RESERVE(2);
  4439. ANDROID_KABI_RESERVE(3);
  4440. ANDROID_KABI_RESERVE(4);
  4441. };
  4442. /*
  4443. * wireless hardware and networking interfaces structures
  4444. * and registration/helper functions
  4445. */
  4446. /**
  4447. * enum wiphy_flags - wiphy capability flags
  4448. *
  4449. * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
  4450. * into two, first for legacy bands and second for UHB.
  4451. * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
  4452. * wiphy at all
  4453. * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
  4454. * by default -- this flag will be set depending on the kernel's default
  4455. * on wiphy_new(), but can be changed by the driver if it has a good
  4456. * reason to override the default
  4457. * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
  4458. * on a VLAN interface). This flag also serves an extra purpose of
  4459. * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
  4460. * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
  4461. * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
  4462. * control port protocol ethertype. The device also honours the
  4463. * control_port_no_encrypt flag.
  4464. * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
  4465. * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
  4466. * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
  4467. * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
  4468. * firmware.
  4469. * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
  4470. * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
  4471. * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
  4472. * link setup/discovery operations internally. Setup, discovery and
  4473. * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
  4474. * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
  4475. * used for asking the driver/firmware to perform a TDLS operation.
  4476. * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
  4477. * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
  4478. * when there are virtual interfaces in AP mode by calling
  4479. * cfg80211_report_obss_beacon().
  4480. * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
  4481. * responds to probe-requests in hardware.
  4482. * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
  4483. * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
  4484. * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
  4485. * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
  4486. * beaconing mode (AP, IBSS, Mesh, ...).
  4487. * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
  4488. * before connection.
  4489. * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
  4490. * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,
  4491. * in order to not have them reachable in normal drivers, until we have
  4492. * complete feature/interface combinations/etc. advertisement. No driver
  4493. * should set this flag for now.
  4494. * @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys.
  4495. */
  4496. enum wiphy_flags {
  4497. WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
  4498. WIPHY_FLAG_SUPPORTS_MLO = BIT(1),
  4499. WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),
  4500. WIPHY_FLAG_NETNS_OK = BIT(3),
  4501. WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
  4502. WIPHY_FLAG_4ADDR_AP = BIT(5),
  4503. WIPHY_FLAG_4ADDR_STATION = BIT(6),
  4504. WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
  4505. WIPHY_FLAG_IBSS_RSN = BIT(8),
  4506. WIPHY_FLAG_MESH_AUTH = BIT(10),
  4507. WIPHY_FLAG_SUPPORTS_EXT_KCK_32 = BIT(11),
  4508. /* use hole at 12 */
  4509. WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
  4510. WIPHY_FLAG_AP_UAPSD = BIT(14),
  4511. WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
  4512. WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
  4513. WIPHY_FLAG_HAVE_AP_SME = BIT(17),
  4514. WIPHY_FLAG_REPORTS_OBSS = BIT(18),
  4515. WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
  4516. WIPHY_FLAG_OFFCHAN_TX = BIT(20),
  4517. WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
  4518. WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
  4519. WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
  4520. WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
  4521. };
  4522. /**
  4523. * struct ieee80211_iface_limit - limit on certain interface types
  4524. * @max: maximum number of interfaces of these types
  4525. * @types: interface types (bits)
  4526. */
  4527. struct ieee80211_iface_limit {
  4528. u16 max;
  4529. u16 types;
  4530. };
  4531. /**
  4532. * struct ieee80211_iface_combination - possible interface combination
  4533. *
  4534. * With this structure the driver can describe which interface
  4535. * combinations it supports concurrently.
  4536. *
  4537. * Examples:
  4538. *
  4539. * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
  4540. *
  4541. * .. code-block:: c
  4542. *
  4543. * struct ieee80211_iface_limit limits1[] = {
  4544. * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
  4545. * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
  4546. * };
  4547. * struct ieee80211_iface_combination combination1 = {
  4548. * .limits = limits1,
  4549. * .n_limits = ARRAY_SIZE(limits1),
  4550. * .max_interfaces = 2,
  4551. * .beacon_int_infra_match = true,
  4552. * };
  4553. *
  4554. *
  4555. * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
  4556. *
  4557. * .. code-block:: c
  4558. *
  4559. * struct ieee80211_iface_limit limits2[] = {
  4560. * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
  4561. * BIT(NL80211_IFTYPE_P2P_GO), },
  4562. * };
  4563. * struct ieee80211_iface_combination combination2 = {
  4564. * .limits = limits2,
  4565. * .n_limits = ARRAY_SIZE(limits2),
  4566. * .max_interfaces = 8,
  4567. * .num_different_channels = 1,
  4568. * };
  4569. *
  4570. *
  4571. * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
  4572. *
  4573. * This allows for an infrastructure connection and three P2P connections.
  4574. *
  4575. * .. code-block:: c
  4576. *
  4577. * struct ieee80211_iface_limit limits3[] = {
  4578. * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
  4579. * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
  4580. * BIT(NL80211_IFTYPE_P2P_CLIENT), },
  4581. * };
  4582. * struct ieee80211_iface_combination combination3 = {
  4583. * .limits = limits3,
  4584. * .n_limits = ARRAY_SIZE(limits3),
  4585. * .max_interfaces = 4,
  4586. * .num_different_channels = 2,
  4587. * };
  4588. *
  4589. */
  4590. struct ieee80211_iface_combination {
  4591. /**
  4592. * @limits:
  4593. * limits for the given interface types
  4594. */
  4595. const struct ieee80211_iface_limit *limits;
  4596. /**
  4597. * @num_different_channels:
  4598. * can use up to this many different channels
  4599. */
  4600. u32 num_different_channels;
  4601. /**
  4602. * @max_interfaces:
  4603. * maximum number of interfaces in total allowed in this group
  4604. */
  4605. u16 max_interfaces;
  4606. /**
  4607. * @n_limits:
  4608. * number of limitations
  4609. */
  4610. u8 n_limits;
  4611. /**
  4612. * @beacon_int_infra_match:
  4613. * In this combination, the beacon intervals between infrastructure
  4614. * and AP types must match. This is required only in special cases.
  4615. */
  4616. bool beacon_int_infra_match;
  4617. /**
  4618. * @radar_detect_widths:
  4619. * bitmap of channel widths supported for radar detection
  4620. */
  4621. u8 radar_detect_widths;
  4622. /**
  4623. * @radar_detect_regions:
  4624. * bitmap of regions supported for radar detection
  4625. */
  4626. u8 radar_detect_regions;
  4627. /**
  4628. * @beacon_int_min_gcd:
  4629. * This interface combination supports different beacon intervals.
  4630. *
  4631. * = 0
  4632. * all beacon intervals for different interface must be same.
  4633. * > 0
  4634. * any beacon interval for the interface part of this combination AND
  4635. * GCD of all beacon intervals from beaconing interfaces of this
  4636. * combination must be greater or equal to this value.
  4637. */
  4638. u32 beacon_int_min_gcd;
  4639. };
  4640. struct ieee80211_txrx_stypes {
  4641. u16 tx, rx;
  4642. };
  4643. /**
  4644. * enum wiphy_wowlan_support_flags - WoWLAN support flags
  4645. * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
  4646. * trigger that keeps the device operating as-is and
  4647. * wakes up the host on any activity, for example a
  4648. * received packet that passed filtering; note that the
  4649. * packet should be preserved in that case
  4650. * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
  4651. * (see nl80211.h)
  4652. * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
  4653. * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
  4654. * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
  4655. * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
  4656. * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
  4657. * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
  4658. * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
  4659. */
  4660. enum wiphy_wowlan_support_flags {
  4661. WIPHY_WOWLAN_ANY = BIT(0),
  4662. WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
  4663. WIPHY_WOWLAN_DISCONNECT = BIT(2),
  4664. WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
  4665. WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
  4666. WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
  4667. WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
  4668. WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
  4669. WIPHY_WOWLAN_NET_DETECT = BIT(8),
  4670. };
  4671. struct wiphy_wowlan_tcp_support {
  4672. const struct nl80211_wowlan_tcp_data_token_feature *tok;
  4673. u32 data_payload_max;
  4674. u32 data_interval_max;
  4675. u32 wake_payload_max;
  4676. bool seq;
  4677. };
  4678. /**
  4679. * struct wiphy_wowlan_support - WoWLAN support data
  4680. * @flags: see &enum wiphy_wowlan_support_flags
  4681. * @n_patterns: number of supported wakeup patterns
  4682. * (see nl80211.h for the pattern definition)
  4683. * @pattern_max_len: maximum length of each pattern
  4684. * @pattern_min_len: minimum length of each pattern
  4685. * @max_pkt_offset: maximum Rx packet offset
  4686. * @max_nd_match_sets: maximum number of matchsets for net-detect,
  4687. * similar, but not necessarily identical, to max_match_sets for
  4688. * scheduled scans.
  4689. * See &struct cfg80211_sched_scan_request.@match_sets for more
  4690. * details.
  4691. * @tcp: TCP wakeup support information
  4692. */
  4693. struct wiphy_wowlan_support {
  4694. u32 flags;
  4695. int n_patterns;
  4696. int pattern_max_len;
  4697. int pattern_min_len;
  4698. int max_pkt_offset;
  4699. int max_nd_match_sets;
  4700. const struct wiphy_wowlan_tcp_support *tcp;
  4701. };
  4702. /**
  4703. * struct wiphy_coalesce_support - coalesce support data
  4704. * @n_rules: maximum number of coalesce rules
  4705. * @max_delay: maximum supported coalescing delay in msecs
  4706. * @n_patterns: number of supported patterns in a rule
  4707. * (see nl80211.h for the pattern definition)
  4708. * @pattern_max_len: maximum length of each pattern
  4709. * @pattern_min_len: minimum length of each pattern
  4710. * @max_pkt_offset: maximum Rx packet offset
  4711. */
  4712. struct wiphy_coalesce_support {
  4713. int n_rules;
  4714. int max_delay;
  4715. int n_patterns;
  4716. int pattern_max_len;
  4717. int pattern_min_len;
  4718. int max_pkt_offset;
  4719. };
  4720. /**
  4721. * enum wiphy_vendor_command_flags - validation flags for vendor commands
  4722. * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
  4723. * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
  4724. * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
  4725. * (must be combined with %_WDEV or %_NETDEV)
  4726. */
  4727. enum wiphy_vendor_command_flags {
  4728. WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
  4729. WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
  4730. WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
  4731. };
  4732. /**
  4733. * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
  4734. *
  4735. * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
  4736. * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
  4737. * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
  4738. *
  4739. */
  4740. enum wiphy_opmode_flag {
  4741. STA_OPMODE_MAX_BW_CHANGED = BIT(0),
  4742. STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
  4743. STA_OPMODE_N_SS_CHANGED = BIT(2),
  4744. };
  4745. /**
  4746. * struct sta_opmode_info - Station's ht/vht operation mode information
  4747. * @changed: contains value from &enum wiphy_opmode_flag
  4748. * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
  4749. * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
  4750. * @rx_nss: new rx_nss value of a station
  4751. */
  4752. struct sta_opmode_info {
  4753. u32 changed;
  4754. enum nl80211_smps_mode smps_mode;
  4755. enum nl80211_chan_width bw;
  4756. u8 rx_nss;
  4757. };
  4758. #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
  4759. /**
  4760. * struct wiphy_vendor_command - vendor command definition
  4761. * @info: vendor command identifying information, as used in nl80211
  4762. * @flags: flags, see &enum wiphy_vendor_command_flags
  4763. * @doit: callback for the operation, note that wdev is %NULL if the
  4764. * flags didn't ask for a wdev and non-%NULL otherwise; the data
  4765. * pointer may be %NULL if userspace provided no data at all
  4766. * @dumpit: dump callback, for transferring bigger/multiple items. The
  4767. * @storage points to cb->args[5], ie. is preserved over the multiple
  4768. * dumpit calls.
  4769. * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
  4770. * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
  4771. * attribute is just raw data (e.g. a firmware command).
  4772. * @maxattr: highest attribute number in policy
  4773. * It's recommended to not have the same sub command with both @doit and
  4774. * @dumpit, so that userspace can assume certain ones are get and others
  4775. * are used with dump requests.
  4776. */
  4777. struct wiphy_vendor_command {
  4778. struct nl80211_vendor_cmd_info info;
  4779. u32 flags;
  4780. int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4781. const void *data, int data_len);
  4782. int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
  4783. struct sk_buff *skb, const void *data, int data_len,
  4784. unsigned long *storage);
  4785. const struct nla_policy *policy;
  4786. unsigned int maxattr;
  4787. ANDROID_KABI_RESERVE(1);
  4788. };
  4789. /**
  4790. * struct wiphy_iftype_ext_capab - extended capabilities per interface type
  4791. * @iftype: interface type
  4792. * @extended_capabilities: extended capabilities supported by the driver,
  4793. * additional capabilities might be supported by userspace; these are the
  4794. * 802.11 extended capabilities ("Extended Capabilities element") and are
  4795. * in the same format as in the information element. See IEEE Std
  4796. * 802.11-2012 8.4.2.29 for the defined fields.
  4797. * @extended_capabilities_mask: mask of the valid values
  4798. * @extended_capabilities_len: length of the extended capabilities
  4799. * @eml_capabilities: EML capabilities (for MLO)
  4800. * @mld_capa_and_ops: MLD capabilities and operations (for MLO)
  4801. */
  4802. struct wiphy_iftype_ext_capab {
  4803. enum nl80211_iftype iftype;
  4804. const u8 *extended_capabilities;
  4805. const u8 *extended_capabilities_mask;
  4806. u8 extended_capabilities_len;
  4807. u16 eml_capabilities;
  4808. u16 mld_capa_and_ops;
  4809. };
  4810. /**
  4811. * cfg80211_get_iftype_ext_capa - lookup interface type extended capability
  4812. * @wiphy: the wiphy to look up from
  4813. * @type: the interface type to look up
  4814. */
  4815. const struct wiphy_iftype_ext_capab *
  4816. cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);
  4817. /**
  4818. * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
  4819. * @max_peers: maximum number of peers in a single measurement
  4820. * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
  4821. * @randomize_mac_addr: can randomize MAC address for measurement
  4822. * @ftm: FTM measurement data
  4823. * @ftm.supported: FTM measurement is supported
  4824. * @ftm.asap: ASAP-mode is supported
  4825. * @ftm.non_asap: non-ASAP-mode is supported
  4826. * @ftm.request_lci: can request LCI data
  4827. * @ftm.request_civicloc: can request civic location data
  4828. * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
  4829. * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
  4830. * @ftm.max_bursts_exponent: maximum burst exponent supported
  4831. * (set to -1 if not limited; note that setting this will necessarily
  4832. * forbid using the value 15 to let the responder pick)
  4833. * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
  4834. * not limited)
  4835. * @ftm.trigger_based: trigger based ranging measurement is supported
  4836. * @ftm.non_trigger_based: non trigger based ranging measurement is supported
  4837. */
  4838. struct cfg80211_pmsr_capabilities {
  4839. unsigned int max_peers;
  4840. u8 report_ap_tsf:1,
  4841. randomize_mac_addr:1;
  4842. struct {
  4843. u32 preambles;
  4844. u32 bandwidths;
  4845. s8 max_bursts_exponent;
  4846. u8 max_ftms_per_burst;
  4847. u8 supported:1,
  4848. asap:1,
  4849. non_asap:1,
  4850. request_lci:1,
  4851. request_civicloc:1,
  4852. trigger_based:1,
  4853. non_trigger_based:1;
  4854. } ftm;
  4855. };
  4856. /**
  4857. * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
  4858. * suites for interface types defined in @iftypes_mask. Each type in the
  4859. * @iftypes_mask must be unique across all instances of iftype_akm_suites.
  4860. *
  4861. * @iftypes_mask: bitmask of interfaces types
  4862. * @akm_suites: points to an array of supported akm suites
  4863. * @n_akm_suites: number of supported AKM suites
  4864. */
  4865. struct wiphy_iftype_akm_suites {
  4866. u16 iftypes_mask;
  4867. const u32 *akm_suites;
  4868. int n_akm_suites;
  4869. };
  4870. /**
  4871. * struct wiphy - wireless hardware description
  4872. * @mtx: mutex for the data (structures) of this device
  4873. * @reg_notifier: the driver's regulatory notification callback,
  4874. * note that if your driver uses wiphy_apply_custom_regulatory()
  4875. * the reg_notifier's request can be passed as NULL
  4876. * @regd: the driver's regulatory domain, if one was requested via
  4877. * the regulatory_hint() API. This can be used by the driver
  4878. * on the reg_notifier() if it chooses to ignore future
  4879. * regulatory domain changes caused by other drivers.
  4880. * @signal_type: signal type reported in &struct cfg80211_bss.
  4881. * @cipher_suites: supported cipher suites
  4882. * @n_cipher_suites: number of supported cipher suites
  4883. * @akm_suites: supported AKM suites. These are the default AKMs supported if
  4884. * the supported AKMs not advertized for a specific interface type in
  4885. * iftype_akm_suites.
  4886. * @n_akm_suites: number of supported AKM suites
  4887. * @iftype_akm_suites: array of supported akm suites info per interface type.
  4888. * Note that the bits in @iftypes_mask inside this structure cannot
  4889. * overlap (i.e. only one occurrence of each type is allowed across all
  4890. * instances of iftype_akm_suites).
  4891. * @num_iftype_akm_suites: number of interface types for which supported akm
  4892. * suites are specified separately.
  4893. * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
  4894. * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
  4895. * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
  4896. * -1 = fragmentation disabled, only odd values >= 256 used
  4897. * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
  4898. * @_net: the network namespace this wiphy currently lives in
  4899. * @perm_addr: permanent MAC address of this device
  4900. * @addr_mask: If the device supports multiple MAC addresses by masking,
  4901. * set this to a mask with variable bits set to 1, e.g. if the last
  4902. * four bits are variable then set it to 00-00-00-00-00-0f. The actual
  4903. * variable bits shall be determined by the interfaces added, with
  4904. * interfaces not matching the mask being rejected to be brought up.
  4905. * @n_addresses: number of addresses in @addresses.
  4906. * @addresses: If the device has more than one address, set this pointer
  4907. * to a list of addresses (6 bytes each). The first one will be used
  4908. * by default for perm_addr. In this case, the mask should be set to
  4909. * all-zeroes. In this case it is assumed that the device can handle
  4910. * the same number of arbitrary MAC addresses.
  4911. * @registered: protects ->resume and ->suspend sysfs callbacks against
  4912. * unregister hardware
  4913. * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
  4914. * It will be renamed automatically on wiphy renames
  4915. * @dev: (virtual) struct device for this wiphy. The item in
  4916. * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
  4917. * (see below).
  4918. * @wext: wireless extension handlers
  4919. * @priv: driver private data (sized according to wiphy_new() parameter)
  4920. * @interface_modes: bitmask of interfaces types valid for this wiphy,
  4921. * must be set by driver
  4922. * @iface_combinations: Valid interface combinations array, should not
  4923. * list single interface types.
  4924. * @n_iface_combinations: number of entries in @iface_combinations array.
  4925. * @software_iftypes: bitmask of software interface types, these are not
  4926. * subject to any restrictions since they are purely managed in SW.
  4927. * @flags: wiphy flags, see &enum wiphy_flags
  4928. * @regulatory_flags: wiphy regulatory flags, see
  4929. * &enum ieee80211_regulatory_flags
  4930. * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
  4931. * @ext_features: extended features advertised to nl80211, see
  4932. * &enum nl80211_ext_feature_index.
  4933. * @bss_priv_size: each BSS struct has private data allocated with it,
  4934. * this variable determines its size
  4935. * @max_scan_ssids: maximum number of SSIDs the device can scan for in
  4936. * any given scan
  4937. * @max_sched_scan_reqs: maximum number of scheduled scan requests that
  4938. * the device can run concurrently.
  4939. * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
  4940. * for in any given scheduled scan
  4941. * @max_match_sets: maximum number of match sets the device can handle
  4942. * when performing a scheduled scan, 0 if filtering is not
  4943. * supported.
  4944. * @max_scan_ie_len: maximum length of user-controlled IEs device can
  4945. * add to probe request frames transmitted during a scan, must not
  4946. * include fixed IEs like supported rates
  4947. * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
  4948. * scans
  4949. * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
  4950. * of iterations) for scheduled scan supported by the device.
  4951. * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
  4952. * single scan plan supported by the device.
  4953. * @max_sched_scan_plan_iterations: maximum number of iterations for a single
  4954. * scan plan supported by the device.
  4955. * @coverage_class: current coverage class
  4956. * @fw_version: firmware version for ethtool reporting
  4957. * @hw_version: hardware version for ethtool reporting
  4958. * @max_num_pmkids: maximum number of PMKIDs supported by device
  4959. * @privid: a pointer that drivers can use to identify if an arbitrary
  4960. * wiphy is theirs, e.g. in global notifiers
  4961. * @bands: information about bands/channels supported by this device
  4962. *
  4963. * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
  4964. * transmitted through nl80211, points to an array indexed by interface
  4965. * type
  4966. *
  4967. * @available_antennas_tx: bitmap of antennas which are available to be
  4968. * configured as TX antennas. Antenna configuration commands will be
  4969. * rejected unless this or @available_antennas_rx is set.
  4970. *
  4971. * @available_antennas_rx: bitmap of antennas which are available to be
  4972. * configured as RX antennas. Antenna configuration commands will be
  4973. * rejected unless this or @available_antennas_tx is set.
  4974. *
  4975. * @probe_resp_offload:
  4976. * Bitmap of supported protocols for probe response offloading.
  4977. * See &enum nl80211_probe_resp_offload_support_attr. Only valid
  4978. * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
  4979. *
  4980. * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
  4981. * may request, if implemented.
  4982. *
  4983. * @wowlan: WoWLAN support information
  4984. * @wowlan_config: current WoWLAN configuration; this should usually not be
  4985. * used since access to it is necessarily racy, use the parameter passed
  4986. * to the suspend() operation instead.
  4987. *
  4988. * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
  4989. * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
  4990. * If null, then none can be over-ridden.
  4991. * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
  4992. * If null, then none can be over-ridden.
  4993. *
  4994. * @wdev_list: the list of associated (virtual) interfaces; this list must
  4995. * not be modified by the driver, but can be read with RTNL/RCU protection.
  4996. *
  4997. * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
  4998. * supports for ACL.
  4999. *
  5000. * @extended_capabilities: extended capabilities supported by the driver,
  5001. * additional capabilities might be supported by userspace; these are
  5002. * the 802.11 extended capabilities ("Extended Capabilities element")
  5003. * and are in the same format as in the information element. See
  5004. * 802.11-2012 8.4.2.29 for the defined fields. These are the default
  5005. * extended capabilities to be used if the capabilities are not specified
  5006. * for a specific interface type in iftype_ext_capab.
  5007. * @extended_capabilities_mask: mask of the valid values
  5008. * @extended_capabilities_len: length of the extended capabilities
  5009. * @iftype_ext_capab: array of extended capabilities per interface type
  5010. * @num_iftype_ext_capab: number of interface types for which extended
  5011. * capabilities are specified separately.
  5012. * @coalesce: packet coalescing support information
  5013. *
  5014. * @vendor_commands: array of vendor commands supported by the hardware
  5015. * @n_vendor_commands: number of vendor commands
  5016. * @vendor_events: array of vendor events supported by the hardware
  5017. * @n_vendor_events: number of vendor events
  5018. *
  5019. * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
  5020. * (including P2P GO) or 0 to indicate no such limit is advertised. The
  5021. * driver is allowed to advertise a theoretical limit that it can reach in
  5022. * some cases, but may not always reach.
  5023. *
  5024. * @max_num_csa_counters: Number of supported csa_counters in beacons
  5025. * and probe responses. This value should be set if the driver
  5026. * wishes to limit the number of csa counters. Default (0) means
  5027. * infinite.
  5028. * @bss_select_support: bitmask indicating the BSS selection criteria supported
  5029. * by the driver in the .connect() callback. The bit position maps to the
  5030. * attribute indices defined in &enum nl80211_bss_select_attr.
  5031. *
  5032. * @nan_supported_bands: bands supported by the device in NAN mode, a
  5033. * bitmap of &enum nl80211_band values. For instance, for
  5034. * NL80211_BAND_2GHZ, bit 0 would be set
  5035. * (i.e. BIT(NL80211_BAND_2GHZ)).
  5036. *
  5037. * @txq_limit: configuration of internal TX queue frame limit
  5038. * @txq_memory_limit: configuration internal TX queue memory limit
  5039. * @txq_quantum: configuration of internal TX queue scheduler quantum
  5040. *
  5041. * @tx_queue_len: allow setting transmit queue len for drivers not using
  5042. * wake_tx_queue
  5043. *
  5044. * @support_mbssid: can HW support association with nontransmitted AP
  5045. * @support_only_he_mbssid: don't parse MBSSID elements if it is not
  5046. * HE AP, in order to avoid compatibility issues.
  5047. * @support_mbssid must be set for this to have any effect.
  5048. *
  5049. * @pmsr_capa: peer measurement capabilities
  5050. *
  5051. * @tid_config_support: describes the per-TID config support that the
  5052. * device has
  5053. * @tid_config_support.vif: bitmap of attributes (configurations)
  5054. * supported by the driver for each vif
  5055. * @tid_config_support.peer: bitmap of attributes (configurations)
  5056. * supported by the driver for each peer
  5057. * @tid_config_support.max_retry: maximum supported retry count for
  5058. * long/short retry configuration
  5059. *
  5060. * @max_data_retry_count: maximum supported per TID retry count for
  5061. * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
  5062. * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
  5063. * @sar_capa: SAR control capabilities
  5064. * @rfkill: a pointer to the rfkill structure
  5065. *
  5066. * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
  5067. * in a multiple BSSID set. This field must be set to a non-zero value
  5068. * by the driver to advertise MBSSID support.
  5069. * @ema_max_profile_periodicity: maximum profile periodicity supported by
  5070. * the driver. Setting this field to a non-zero value indicates that the
  5071. * driver supports enhanced multi-BSSID advertisements (EMA AP).
  5072. * @max_num_akm_suites: maximum number of AKM suites allowed for
  5073. * configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and
  5074. * %NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by
  5075. * driver. If set by driver minimum allowed value is
  5076. * NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with
  5077. * legacy userspace and maximum allowed value is
  5078. * CFG80211_MAX_NUM_AKM_SUITES.
  5079. */
  5080. struct wiphy {
  5081. struct mutex mtx;
  5082. /* assign these fields before you register the wiphy */
  5083. u8 perm_addr[ETH_ALEN];
  5084. u8 addr_mask[ETH_ALEN];
  5085. struct mac_address *addresses;
  5086. const struct ieee80211_txrx_stypes *mgmt_stypes;
  5087. const struct ieee80211_iface_combination *iface_combinations;
  5088. int n_iface_combinations;
  5089. u16 software_iftypes;
  5090. u16 n_addresses;
  5091. /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
  5092. u16 interface_modes;
  5093. u16 max_acl_mac_addrs;
  5094. u32 flags, regulatory_flags, features;
  5095. u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
  5096. u32 ap_sme_capa;
  5097. enum cfg80211_signal_type signal_type;
  5098. int bss_priv_size;
  5099. u8 max_scan_ssids;
  5100. u8 max_sched_scan_reqs;
  5101. u8 max_sched_scan_ssids;
  5102. u8 max_match_sets;
  5103. u16 max_scan_ie_len;
  5104. u16 max_sched_scan_ie_len;
  5105. u32 max_sched_scan_plans;
  5106. u32 max_sched_scan_plan_interval;
  5107. u32 max_sched_scan_plan_iterations;
  5108. int n_cipher_suites;
  5109. const u32 *cipher_suites;
  5110. int n_akm_suites;
  5111. const u32 *akm_suites;
  5112. const struct wiphy_iftype_akm_suites *iftype_akm_suites;
  5113. unsigned int num_iftype_akm_suites;
  5114. u8 retry_short;
  5115. u8 retry_long;
  5116. u32 frag_threshold;
  5117. u32 rts_threshold;
  5118. u8 coverage_class;
  5119. char fw_version[ETHTOOL_FWVERS_LEN];
  5120. u32 hw_version;
  5121. #ifdef CONFIG_PM
  5122. const struct wiphy_wowlan_support *wowlan;
  5123. struct cfg80211_wowlan *wowlan_config;
  5124. #endif
  5125. u16 max_remain_on_channel_duration;
  5126. u8 max_num_pmkids;
  5127. u32 available_antennas_tx;
  5128. u32 available_antennas_rx;
  5129. u32 probe_resp_offload;
  5130. const u8 *extended_capabilities, *extended_capabilities_mask;
  5131. u8 extended_capabilities_len;
  5132. const struct wiphy_iftype_ext_capab *iftype_ext_capab;
  5133. unsigned int num_iftype_ext_capab;
  5134. const void *privid;
  5135. struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
  5136. void (*reg_notifier)(struct wiphy *wiphy,
  5137. struct regulatory_request *request);
  5138. /* fields below are read-only, assigned by cfg80211 */
  5139. const struct ieee80211_regdomain __rcu *regd;
  5140. struct device dev;
  5141. bool registered;
  5142. struct dentry *debugfsdir;
  5143. const struct ieee80211_ht_cap *ht_capa_mod_mask;
  5144. const struct ieee80211_vht_cap *vht_capa_mod_mask;
  5145. struct list_head wdev_list;
  5146. possible_net_t _net;
  5147. #ifdef CONFIG_CFG80211_WEXT
  5148. const struct iw_handler_def *wext;
  5149. #endif
  5150. const struct wiphy_coalesce_support *coalesce;
  5151. const struct wiphy_vendor_command *vendor_commands;
  5152. const struct nl80211_vendor_cmd_info *vendor_events;
  5153. int n_vendor_commands, n_vendor_events;
  5154. u16 max_ap_assoc_sta;
  5155. u8 max_num_csa_counters;
  5156. u32 bss_select_support;
  5157. u8 nan_supported_bands;
  5158. u32 txq_limit;
  5159. u32 txq_memory_limit;
  5160. u32 txq_quantum;
  5161. unsigned long tx_queue_len;
  5162. u8 support_mbssid:1,
  5163. support_only_he_mbssid:1;
  5164. const struct cfg80211_pmsr_capabilities *pmsr_capa;
  5165. struct {
  5166. u64 peer, vif;
  5167. u8 max_retry;
  5168. } tid_config_support;
  5169. u8 max_data_retry_count;
  5170. const struct cfg80211_sar_capa *sar_capa;
  5171. struct rfkill *rfkill;
  5172. u8 mbssid_max_interfaces;
  5173. u8 ema_max_profile_periodicity;
  5174. u16 max_num_akm_suites;
  5175. ANDROID_KABI_RESERVE(1);
  5176. char priv[] __aligned(NETDEV_ALIGN);
  5177. };
  5178. static inline struct net *wiphy_net(struct wiphy *wiphy)
  5179. {
  5180. return read_pnet(&wiphy->_net);
  5181. }
  5182. static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
  5183. {
  5184. write_pnet(&wiphy->_net, net);
  5185. }
  5186. /**
  5187. * wiphy_priv - return priv from wiphy
  5188. *
  5189. * @wiphy: the wiphy whose priv pointer to return
  5190. * Return: The priv of @wiphy.
  5191. */
  5192. static inline void *wiphy_priv(struct wiphy *wiphy)
  5193. {
  5194. BUG_ON(!wiphy);
  5195. return &wiphy->priv;
  5196. }
  5197. /**
  5198. * priv_to_wiphy - return the wiphy containing the priv
  5199. *
  5200. * @priv: a pointer previously returned by wiphy_priv
  5201. * Return: The wiphy of @priv.
  5202. */
  5203. static inline struct wiphy *priv_to_wiphy(void *priv)
  5204. {
  5205. BUG_ON(!priv);
  5206. return container_of(priv, struct wiphy, priv);
  5207. }
  5208. /**
  5209. * set_wiphy_dev - set device pointer for wiphy
  5210. *
  5211. * @wiphy: The wiphy whose device to bind
  5212. * @dev: The device to parent it to
  5213. */
  5214. static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
  5215. {
  5216. wiphy->dev.parent = dev;
  5217. }
  5218. /**
  5219. * wiphy_dev - get wiphy dev pointer
  5220. *
  5221. * @wiphy: The wiphy whose device struct to look up
  5222. * Return: The dev of @wiphy.
  5223. */
  5224. static inline struct device *wiphy_dev(struct wiphy *wiphy)
  5225. {
  5226. return wiphy->dev.parent;
  5227. }
  5228. /**
  5229. * wiphy_name - get wiphy name
  5230. *
  5231. * @wiphy: The wiphy whose name to return
  5232. * Return: The name of @wiphy.
  5233. */
  5234. static inline const char *wiphy_name(const struct wiphy *wiphy)
  5235. {
  5236. return dev_name(&wiphy->dev);
  5237. }
  5238. /**
  5239. * wiphy_new_nm - create a new wiphy for use with cfg80211
  5240. *
  5241. * @ops: The configuration operations for this device
  5242. * @sizeof_priv: The size of the private area to allocate
  5243. * @requested_name: Request a particular name.
  5244. * NULL is valid value, and means use the default phy%d naming.
  5245. *
  5246. * Create a new wiphy and associate the given operations with it.
  5247. * @sizeof_priv bytes are allocated for private use.
  5248. *
  5249. * Return: A pointer to the new wiphy. This pointer must be
  5250. * assigned to each netdev's ieee80211_ptr for proper operation.
  5251. */
  5252. struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
  5253. const char *requested_name);
  5254. /**
  5255. * wiphy_new - create a new wiphy for use with cfg80211
  5256. *
  5257. * @ops: The configuration operations for this device
  5258. * @sizeof_priv: The size of the private area to allocate
  5259. *
  5260. * Create a new wiphy and associate the given operations with it.
  5261. * @sizeof_priv bytes are allocated for private use.
  5262. *
  5263. * Return: A pointer to the new wiphy. This pointer must be
  5264. * assigned to each netdev's ieee80211_ptr for proper operation.
  5265. */
  5266. static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
  5267. int sizeof_priv)
  5268. {
  5269. return wiphy_new_nm(ops, sizeof_priv, NULL);
  5270. }
  5271. /**
  5272. * wiphy_register - register a wiphy with cfg80211
  5273. *
  5274. * @wiphy: The wiphy to register.
  5275. *
  5276. * Return: A non-negative wiphy index or a negative error code.
  5277. */
  5278. int wiphy_register(struct wiphy *wiphy);
  5279. /* this is a define for better error reporting (file/line) */
  5280. #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
  5281. /**
  5282. * rcu_dereference_wiphy - rcu_dereference with debug checking
  5283. * @wiphy: the wiphy to check the locking on
  5284. * @p: The pointer to read, prior to dereferencing
  5285. *
  5286. * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
  5287. * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
  5288. */
  5289. #define rcu_dereference_wiphy(wiphy, p) \
  5290. rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
  5291. /**
  5292. * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
  5293. * @wiphy: the wiphy to check the locking on
  5294. * @p: The pointer to read, prior to dereferencing
  5295. *
  5296. * Return the value of the specified RCU-protected pointer, but omit the
  5297. * READ_ONCE(), because caller holds the wiphy mutex used for updates.
  5298. */
  5299. #define wiphy_dereference(wiphy, p) \
  5300. rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
  5301. /**
  5302. * get_wiphy_regdom - get custom regdomain for the given wiphy
  5303. * @wiphy: the wiphy to get the regdomain from
  5304. */
  5305. const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
  5306. /**
  5307. * wiphy_unregister - deregister a wiphy from cfg80211
  5308. *
  5309. * @wiphy: The wiphy to unregister.
  5310. *
  5311. * After this call, no more requests can be made with this priv
  5312. * pointer, but the call may sleep to wait for an outstanding
  5313. * request that is being handled.
  5314. */
  5315. void wiphy_unregister(struct wiphy *wiphy);
  5316. /**
  5317. * wiphy_free - free wiphy
  5318. *
  5319. * @wiphy: The wiphy to free
  5320. */
  5321. void wiphy_free(struct wiphy *wiphy);
  5322. /* internal structs */
  5323. struct cfg80211_conn;
  5324. struct cfg80211_internal_bss;
  5325. struct cfg80211_cached_keys;
  5326. struct cfg80211_cqm_config;
  5327. /**
  5328. * wiphy_lock - lock the wiphy
  5329. * @wiphy: the wiphy to lock
  5330. *
  5331. * This is needed around registering and unregistering netdevs that
  5332. * aren't created through cfg80211 calls, since that requires locking
  5333. * in cfg80211 when the notifiers is called, but that cannot
  5334. * differentiate which way it's called.
  5335. *
  5336. * It can also be used by drivers for their own purposes.
  5337. *
  5338. * When cfg80211 ops are called, the wiphy is already locked.
  5339. *
  5340. * Note that this makes sure that no workers that have been queued
  5341. * with wiphy_queue_work() are running.
  5342. */
  5343. static inline void wiphy_lock(struct wiphy *wiphy)
  5344. __acquires(&wiphy->mtx)
  5345. {
  5346. mutex_lock(&wiphy->mtx);
  5347. __acquire(&wiphy->mtx);
  5348. }
  5349. /**
  5350. * wiphy_unlock - unlock the wiphy again
  5351. * @wiphy: the wiphy to unlock
  5352. */
  5353. static inline void wiphy_unlock(struct wiphy *wiphy)
  5354. __releases(&wiphy->mtx)
  5355. {
  5356. __release(&wiphy->mtx);
  5357. mutex_unlock(&wiphy->mtx);
  5358. }
  5359. struct wiphy_work;
  5360. typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *);
  5361. struct wiphy_work {
  5362. struct list_head entry;
  5363. wiphy_work_func_t func;
  5364. };
  5365. static inline void wiphy_work_init(struct wiphy_work *work,
  5366. wiphy_work_func_t func)
  5367. {
  5368. INIT_LIST_HEAD(&work->entry);
  5369. work->func = func;
  5370. }
  5371. /**
  5372. * wiphy_work_queue - queue work for the wiphy
  5373. * @wiphy: the wiphy to queue for
  5374. * @work: the work item
  5375. *
  5376. * This is useful for work that must be done asynchronously, and work
  5377. * queued here has the special property that the wiphy mutex will be
  5378. * held as if wiphy_lock() was called, and that it cannot be running
  5379. * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
  5380. * use just cancel_work() instead of cancel_work_sync(), it requires
  5381. * being in a section protected by wiphy_lock().
  5382. */
  5383. void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work);
  5384. /**
  5385. * wiphy_work_cancel - cancel previously queued work
  5386. * @wiphy: the wiphy, for debug purposes
  5387. * @work: the work to cancel
  5388. *
  5389. * Cancel the work *without* waiting for it, this assumes being
  5390. * called under the wiphy mutex acquired by wiphy_lock().
  5391. */
  5392. void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work);
  5393. /**
  5394. * wiphy_work_flush - flush previously queued work
  5395. * @wiphy: the wiphy, for debug purposes
  5396. * @work: the work to flush, this can be %NULL to flush all work
  5397. *
  5398. * Flush the work (i.e. run it if pending). This must be called
  5399. * under the wiphy mutex acquired by wiphy_lock().
  5400. */
  5401. void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work);
  5402. struct wiphy_delayed_work {
  5403. struct wiphy_work work;
  5404. struct wiphy *wiphy;
  5405. struct timer_list timer;
  5406. };
  5407. void wiphy_delayed_work_timer(struct timer_list *t);
  5408. static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork,
  5409. wiphy_work_func_t func)
  5410. {
  5411. timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0);
  5412. wiphy_work_init(&dwork->work, func);
  5413. }
  5414. /**
  5415. * wiphy_delayed_work_queue - queue delayed work for the wiphy
  5416. * @wiphy: the wiphy to queue for
  5417. * @dwork: the delayable worker
  5418. * @delay: number of jiffies to wait before queueing
  5419. *
  5420. * This is useful for work that must be done asynchronously, and work
  5421. * queued here has the special property that the wiphy mutex will be
  5422. * held as if wiphy_lock() was called, and that it cannot be running
  5423. * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
  5424. * use just cancel_work() instead of cancel_work_sync(), it requires
  5425. * being in a section protected by wiphy_lock().
  5426. */
  5427. void wiphy_delayed_work_queue(struct wiphy *wiphy,
  5428. struct wiphy_delayed_work *dwork,
  5429. unsigned long delay);
  5430. /**
  5431. * wiphy_delayed_work_cancel - cancel previously queued delayed work
  5432. * @wiphy: the wiphy, for debug purposes
  5433. * @dwork: the delayed work to cancel
  5434. *
  5435. * Cancel the work *without* waiting for it, this assumes being
  5436. * called under the wiphy mutex acquired by wiphy_lock().
  5437. */
  5438. void wiphy_delayed_work_cancel(struct wiphy *wiphy,
  5439. struct wiphy_delayed_work *dwork);
  5440. /**
  5441. * wiphy_delayed_work_flush - flush previously queued delayed work
  5442. * @wiphy: the wiphy, for debug purposes
  5443. * @work: the work to flush
  5444. *
  5445. * Flush the work (i.e. run it if pending). This must be called
  5446. * under the wiphy mutex acquired by wiphy_lock().
  5447. */
  5448. void wiphy_delayed_work_flush(struct wiphy *wiphy,
  5449. struct wiphy_delayed_work *dwork);
  5450. /**
  5451. * struct wireless_dev - wireless device state
  5452. *
  5453. * For netdevs, this structure must be allocated by the driver
  5454. * that uses the ieee80211_ptr field in struct net_device (this
  5455. * is intentional so it can be allocated along with the netdev.)
  5456. * It need not be registered then as netdev registration will
  5457. * be intercepted by cfg80211 to see the new wireless device,
  5458. * however, drivers must lock the wiphy before registering or
  5459. * unregistering netdevs if they pre-create any netdevs (in ops
  5460. * called from cfg80211, the wiphy is already locked.)
  5461. *
  5462. * For non-netdev uses, it must also be allocated by the driver
  5463. * in response to the cfg80211 callbacks that require it, as
  5464. * there's no netdev registration in that case it may not be
  5465. * allocated outside of callback operations that return it.
  5466. *
  5467. * @wiphy: pointer to hardware description
  5468. * @iftype: interface type
  5469. * @registered: is this wdev already registered with cfg80211
  5470. * @registering: indicates we're doing registration under wiphy lock
  5471. * for the notifier
  5472. * @list: (private) Used to collect the interfaces
  5473. * @netdev: (private) Used to reference back to the netdev, may be %NULL
  5474. * @identifier: (private) Identifier used in nl80211 to identify this
  5475. * wireless device if it has no netdev
  5476. * @u: union containing data specific to @iftype
  5477. * @connected: indicates if connected or not (STA mode)
  5478. * @bssid: (private) Used by the internal configuration code
  5479. * @wext: (private) Used by the internal wireless extensions compat code
  5480. * @wext.ibss: (private) IBSS data part of wext handling
  5481. * @wext.connect: (private) connection handling data
  5482. * @wext.keys: (private) (WEP) key data
  5483. * @wext.ie: (private) extra elements for association
  5484. * @wext.ie_len: (private) length of extra elements
  5485. * @wext.bssid: (private) selected network BSSID
  5486. * @wext.ssid: (private) selected network SSID
  5487. * @wext.default_key: (private) selected default key index
  5488. * @wext.default_mgmt_key: (private) selected default management key index
  5489. * @wext.prev_bssid: (private) previous BSSID for reassociation
  5490. * @wext.prev_bssid_valid: (private) previous BSSID validity
  5491. * @use_4addr: indicates 4addr mode is used on this interface, must be
  5492. * set by driver (if supported) on add_interface BEFORE registering the
  5493. * netdev and may otherwise be used by driver read-only, will be update
  5494. * by cfg80211 on change_interface
  5495. * @mgmt_registrations: list of registrations for management frames
  5496. * @mgmt_registrations_need_update: mgmt registrations were updated,
  5497. * need to propagate the update to the driver
  5498. * @mtx: mutex used to lock data in this struct, may be used by drivers
  5499. * and some API functions require it held
  5500. * @beacon_interval: beacon interval used on this device for transmitting
  5501. * beacons, 0 when not valid
  5502. * @address: The address for this device, valid only if @netdev is %NULL
  5503. * @is_running: true if this is a non-netdev device that has been started, e.g.
  5504. * the P2P Device.
  5505. * @cac_started: true if DFS channel availability check has been started
  5506. * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
  5507. * @cac_time_ms: CAC time in ms
  5508. * @ps: powersave mode is enabled
  5509. * @ps_timeout: dynamic powersave timeout
  5510. * @ap_unexpected_nlportid: (private) netlink port ID of application
  5511. * registered for unexpected class 3 frames (AP mode)
  5512. * @conn: (private) cfg80211 software SME connection state machine data
  5513. * @connect_keys: (private) keys to set after connection is established
  5514. * @conn_bss_type: connecting/connected BSS type
  5515. * @conn_owner_nlportid: (private) connection owner socket port ID
  5516. * @disconnect_wk: (private) auto-disconnect work
  5517. * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
  5518. * @event_list: (private) list for internal event processing
  5519. * @event_lock: (private) lock for event list
  5520. * @owner_nlportid: (private) owner socket port ID
  5521. * @nl_owner_dead: (private) owner socket went away
  5522. * @cqm_rssi_work: (private) CQM RSSI reporting work
  5523. * @cqm_config: (private) nl80211 RSSI monitor state
  5524. * @pmsr_list: (private) peer measurement requests
  5525. * @pmsr_lock: (private) peer measurements requests/results lock
  5526. * @pmsr_free_wk: (private) peer measurements cleanup work
  5527. * @unprot_beacon_reported: (private) timestamp of last
  5528. * unprotected beacon report
  5529. * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr
  5530. * @ap and @client for each link
  5531. * @valid_links: bitmap describing what elements of @links are valid
  5532. */
  5533. struct wireless_dev {
  5534. struct wiphy *wiphy;
  5535. enum nl80211_iftype iftype;
  5536. /* the remainder of this struct should be private to cfg80211 */
  5537. struct list_head list;
  5538. struct net_device *netdev;
  5539. u32 identifier;
  5540. struct list_head mgmt_registrations;
  5541. u8 mgmt_registrations_need_update:1;
  5542. struct mutex mtx;
  5543. bool use_4addr, is_running, registered, registering;
  5544. u8 address[ETH_ALEN] __aligned(sizeof(u16));
  5545. /* currently used for IBSS and SME - might be rearranged later */
  5546. struct cfg80211_conn *conn;
  5547. struct cfg80211_cached_keys *connect_keys;
  5548. enum ieee80211_bss_type conn_bss_type;
  5549. u32 conn_owner_nlportid;
  5550. struct work_struct disconnect_wk;
  5551. u8 disconnect_bssid[ETH_ALEN];
  5552. struct list_head event_list;
  5553. spinlock_t event_lock;
  5554. u8 connected:1;
  5555. bool ps;
  5556. int ps_timeout;
  5557. u32 ap_unexpected_nlportid;
  5558. u32 owner_nlportid;
  5559. bool nl_owner_dead;
  5560. /* FIXME: need to rework radar detection for MLO */
  5561. bool cac_started;
  5562. unsigned long cac_start_time;
  5563. unsigned int cac_time_ms;
  5564. #ifdef CONFIG_CFG80211_WEXT
  5565. /* wext data */
  5566. struct {
  5567. struct cfg80211_ibss_params ibss;
  5568. struct cfg80211_connect_params connect;
  5569. struct cfg80211_cached_keys *keys;
  5570. const u8 *ie;
  5571. size_t ie_len;
  5572. u8 bssid[ETH_ALEN];
  5573. u8 prev_bssid[ETH_ALEN];
  5574. u8 ssid[IEEE80211_MAX_SSID_LEN];
  5575. s8 default_key, default_mgmt_key;
  5576. bool prev_bssid_valid;
  5577. } wext;
  5578. #endif
  5579. struct cfg80211_cqm_config *cqm_config;
  5580. struct list_head pmsr_list;
  5581. spinlock_t pmsr_lock;
  5582. struct work_struct pmsr_free_wk;
  5583. unsigned long unprot_beacon_reported;
  5584. union {
  5585. struct {
  5586. u8 connected_addr[ETH_ALEN] __aligned(2);
  5587. u8 ssid[IEEE80211_MAX_SSID_LEN];
  5588. u8 ssid_len;
  5589. } client;
  5590. struct {
  5591. int beacon_interval;
  5592. struct cfg80211_chan_def preset_chandef;
  5593. struct cfg80211_chan_def chandef;
  5594. u8 id[IEEE80211_MAX_SSID_LEN];
  5595. u8 id_len, id_up_len;
  5596. } mesh;
  5597. struct {
  5598. struct cfg80211_chan_def preset_chandef;
  5599. u8 ssid[IEEE80211_MAX_SSID_LEN];
  5600. u8 ssid_len;
  5601. } ap;
  5602. struct {
  5603. struct cfg80211_internal_bss *current_bss;
  5604. struct cfg80211_chan_def chandef;
  5605. int beacon_interval;
  5606. u8 ssid[IEEE80211_MAX_SSID_LEN];
  5607. u8 ssid_len;
  5608. } ibss;
  5609. struct {
  5610. struct cfg80211_chan_def chandef;
  5611. } ocb;
  5612. } u;
  5613. struct {
  5614. u8 addr[ETH_ALEN] __aligned(2);
  5615. union {
  5616. struct {
  5617. unsigned int beacon_interval;
  5618. struct cfg80211_chan_def chandef;
  5619. } ap;
  5620. struct {
  5621. struct cfg80211_internal_bss *current_bss;
  5622. } client;
  5623. };
  5624. } links[IEEE80211_MLD_MAX_NUM_LINKS];
  5625. u16 valid_links;
  5626. ANDROID_KABI_RESERVE(1);
  5627. ANDROID_KABI_RESERVE(2);
  5628. };
  5629. static inline const u8 *wdev_address(struct wireless_dev *wdev)
  5630. {
  5631. if (wdev->netdev)
  5632. return wdev->netdev->dev_addr;
  5633. return wdev->address;
  5634. }
  5635. static inline bool wdev_running(struct wireless_dev *wdev)
  5636. {
  5637. if (wdev->netdev)
  5638. return netif_running(wdev->netdev);
  5639. return wdev->is_running;
  5640. }
  5641. /**
  5642. * wdev_priv - return wiphy priv from wireless_dev
  5643. *
  5644. * @wdev: The wireless device whose wiphy's priv pointer to return
  5645. * Return: The wiphy priv of @wdev.
  5646. */
  5647. static inline void *wdev_priv(struct wireless_dev *wdev)
  5648. {
  5649. BUG_ON(!wdev);
  5650. return wiphy_priv(wdev->wiphy);
  5651. }
  5652. /**
  5653. * wdev_chandef - return chandef pointer from wireless_dev
  5654. * @wdev: the wdev
  5655. * @link_id: the link ID for MLO
  5656. *
  5657. * Return: The chandef depending on the mode, or %NULL.
  5658. */
  5659. struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,
  5660. unsigned int link_id);
  5661. static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,
  5662. unsigned int link_id)
  5663. {
  5664. WARN_ON(link_id && !wdev->valid_links);
  5665. WARN_ON(wdev->valid_links &&
  5666. !(wdev->valid_links & BIT(link_id)));
  5667. }
  5668. #define for_each_valid_link(link_info, link_id) \
  5669. for (link_id = 0; \
  5670. link_id < ((link_info)->valid_links ? \
  5671. ARRAY_SIZE((link_info)->links) : 1); \
  5672. link_id++) \
  5673. if (!(link_info)->valid_links || \
  5674. ((link_info)->valid_links & BIT(link_id)))
  5675. /**
  5676. * DOC: Utility functions
  5677. *
  5678. * cfg80211 offers a number of utility functions that can be useful.
  5679. */
  5680. /**
  5681. * ieee80211_channel_equal - compare two struct ieee80211_channel
  5682. *
  5683. * @a: 1st struct ieee80211_channel
  5684. * @b: 2nd struct ieee80211_channel
  5685. * Return: true if center frequency of @a == @b
  5686. */
  5687. static inline bool
  5688. ieee80211_channel_equal(struct ieee80211_channel *a,
  5689. struct ieee80211_channel *b)
  5690. {
  5691. return (a->center_freq == b->center_freq &&
  5692. a->freq_offset == b->freq_offset);
  5693. }
  5694. /**
  5695. * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
  5696. * @chan: struct ieee80211_channel to convert
  5697. * Return: The corresponding frequency (in KHz)
  5698. */
  5699. static inline u32
  5700. ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
  5701. {
  5702. return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
  5703. }
  5704. /**
  5705. * ieee80211_s1g_channel_width - get allowed channel width from @chan
  5706. *
  5707. * Only allowed for band NL80211_BAND_S1GHZ
  5708. * @chan: channel
  5709. * Return: The allowed channel width for this center_freq
  5710. */
  5711. enum nl80211_chan_width
  5712. ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
  5713. /**
  5714. * ieee80211_channel_to_freq_khz - convert channel number to frequency
  5715. * @chan: channel number
  5716. * @band: band, necessary due to channel number overlap
  5717. * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
  5718. */
  5719. u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
  5720. /**
  5721. * ieee80211_channel_to_frequency - convert channel number to frequency
  5722. * @chan: channel number
  5723. * @band: band, necessary due to channel number overlap
  5724. * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
  5725. */
  5726. static inline int
  5727. ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
  5728. {
  5729. return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
  5730. }
  5731. /**
  5732. * ieee80211_freq_khz_to_channel - convert frequency to channel number
  5733. * @freq: center frequency in KHz
  5734. * Return: The corresponding channel, or 0 if the conversion failed.
  5735. */
  5736. int ieee80211_freq_khz_to_channel(u32 freq);
  5737. /**
  5738. * ieee80211_frequency_to_channel - convert frequency to channel number
  5739. * @freq: center frequency in MHz
  5740. * Return: The corresponding channel, or 0 if the conversion failed.
  5741. */
  5742. static inline int
  5743. ieee80211_frequency_to_channel(int freq)
  5744. {
  5745. return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
  5746. }
  5747. /**
  5748. * ieee80211_get_channel_khz - get channel struct from wiphy for specified
  5749. * frequency
  5750. * @wiphy: the struct wiphy to get the channel for
  5751. * @freq: the center frequency (in KHz) of the channel
  5752. * Return: The channel struct from @wiphy at @freq.
  5753. */
  5754. struct ieee80211_channel *
  5755. ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
  5756. /**
  5757. * ieee80211_get_channel - get channel struct from wiphy for specified frequency
  5758. *
  5759. * @wiphy: the struct wiphy to get the channel for
  5760. * @freq: the center frequency (in MHz) of the channel
  5761. * Return: The channel struct from @wiphy at @freq.
  5762. */
  5763. static inline struct ieee80211_channel *
  5764. ieee80211_get_channel(struct wiphy *wiphy, int freq)
  5765. {
  5766. return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
  5767. }
  5768. /**
  5769. * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
  5770. * @chan: control channel to check
  5771. *
  5772. * The Preferred Scanning Channels (PSC) are defined in
  5773. * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
  5774. */
  5775. static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
  5776. {
  5777. if (chan->band != NL80211_BAND_6GHZ)
  5778. return false;
  5779. return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
  5780. }
  5781. /**
  5782. * ieee80211_get_response_rate - get basic rate for a given rate
  5783. *
  5784. * @sband: the band to look for rates in
  5785. * @basic_rates: bitmap of basic rates
  5786. * @bitrate: the bitrate for which to find the basic rate
  5787. *
  5788. * Return: The basic rate corresponding to a given bitrate, that
  5789. * is the next lower bitrate contained in the basic rate map,
  5790. * which is, for this function, given as a bitmap of indices of
  5791. * rates in the band's bitrate table.
  5792. */
  5793. const struct ieee80211_rate *
  5794. ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
  5795. u32 basic_rates, int bitrate);
  5796. /**
  5797. * ieee80211_mandatory_rates - get mandatory rates for a given band
  5798. * @sband: the band to look for rates in
  5799. * @scan_width: width of the control channel
  5800. *
  5801. * This function returns a bitmap of the mandatory rates for the given
  5802. * band, bits are set according to the rate position in the bitrates array.
  5803. */
  5804. u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
  5805. enum nl80211_bss_scan_width scan_width);
  5806. /*
  5807. * Radiotap parsing functions -- for controlled injection support
  5808. *
  5809. * Implemented in net/wireless/radiotap.c
  5810. * Documentation in Documentation/networking/radiotap-headers.rst
  5811. */
  5812. struct radiotap_align_size {
  5813. uint8_t align:4, size:4;
  5814. };
  5815. struct ieee80211_radiotap_namespace {
  5816. const struct radiotap_align_size *align_size;
  5817. int n_bits;
  5818. uint32_t oui;
  5819. uint8_t subns;
  5820. };
  5821. struct ieee80211_radiotap_vendor_namespaces {
  5822. const struct ieee80211_radiotap_namespace *ns;
  5823. int n_ns;
  5824. };
  5825. /**
  5826. * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
  5827. * @this_arg_index: index of current arg, valid after each successful call
  5828. * to ieee80211_radiotap_iterator_next()
  5829. * @this_arg: pointer to current radiotap arg; it is valid after each
  5830. * call to ieee80211_radiotap_iterator_next() but also after
  5831. * ieee80211_radiotap_iterator_init() where it will point to
  5832. * the beginning of the actual data portion
  5833. * @this_arg_size: length of the current arg, for convenience
  5834. * @current_namespace: pointer to the current namespace definition
  5835. * (or internally %NULL if the current namespace is unknown)
  5836. * @is_radiotap_ns: indicates whether the current namespace is the default
  5837. * radiotap namespace or not
  5838. *
  5839. * @_rtheader: pointer to the radiotap header we are walking through
  5840. * @_max_length: length of radiotap header in cpu byte ordering
  5841. * @_arg_index: next argument index
  5842. * @_arg: next argument pointer
  5843. * @_next_bitmap: internal pointer to next present u32
  5844. * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
  5845. * @_vns: vendor namespace definitions
  5846. * @_next_ns_data: beginning of the next namespace's data
  5847. * @_reset_on_ext: internal; reset the arg index to 0 when going to the
  5848. * next bitmap word
  5849. *
  5850. * Describes the radiotap parser state. Fields prefixed with an underscore
  5851. * must not be used by users of the parser, only by the parser internally.
  5852. */
  5853. struct ieee80211_radiotap_iterator {
  5854. struct ieee80211_radiotap_header *_rtheader;
  5855. const struct ieee80211_radiotap_vendor_namespaces *_vns;
  5856. const struct ieee80211_radiotap_namespace *current_namespace;
  5857. unsigned char *_arg, *_next_ns_data;
  5858. __le32 *_next_bitmap;
  5859. unsigned char *this_arg;
  5860. int this_arg_index;
  5861. int this_arg_size;
  5862. int is_radiotap_ns;
  5863. int _max_length;
  5864. int _arg_index;
  5865. uint32_t _bitmap_shifter;
  5866. int _reset_on_ext;
  5867. };
  5868. int
  5869. ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
  5870. struct ieee80211_radiotap_header *radiotap_header,
  5871. int max_length,
  5872. const struct ieee80211_radiotap_vendor_namespaces *vns);
  5873. int
  5874. ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
  5875. extern const unsigned char rfc1042_header[6];
  5876. extern const unsigned char bridge_tunnel_header[6];
  5877. /**
  5878. * ieee80211_get_hdrlen_from_skb - get header length from data
  5879. *
  5880. * @skb: the frame
  5881. *
  5882. * Given an skb with a raw 802.11 header at the data pointer this function
  5883. * returns the 802.11 header length.
  5884. *
  5885. * Return: The 802.11 header length in bytes (not including encryption
  5886. * headers). Or 0 if the data in the sk_buff is too short to contain a valid
  5887. * 802.11 header.
  5888. */
  5889. unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
  5890. /**
  5891. * ieee80211_hdrlen - get header length in bytes from frame control
  5892. * @fc: frame control field in little-endian format
  5893. * Return: The header length in bytes.
  5894. */
  5895. unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
  5896. /**
  5897. * ieee80211_get_mesh_hdrlen - get mesh extension header length
  5898. * @meshhdr: the mesh extension header, only the flags field
  5899. * (first byte) will be accessed
  5900. * Return: The length of the extension header, which is always at
  5901. * least 6 bytes and at most 18 if address 5 and 6 are present.
  5902. */
  5903. unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
  5904. /**
  5905. * DOC: Data path helpers
  5906. *
  5907. * In addition to generic utilities, cfg80211 also offers
  5908. * functions that help implement the data path for devices
  5909. * that do not do the 802.11/802.3 conversion on the device.
  5910. */
  5911. /**
  5912. * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
  5913. * @skb: the 802.11 data frame
  5914. * @ehdr: pointer to a &struct ethhdr that will get the header, instead
  5915. * of it being pushed into the SKB
  5916. * @addr: the device MAC address
  5917. * @iftype: the virtual interface type
  5918. * @data_offset: offset of payload after the 802.11 header
  5919. * @is_amsdu: true if the 802.11 header is A-MSDU
  5920. * Return: 0 on success. Non-zero on error.
  5921. */
  5922. int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
  5923. const u8 *addr, enum nl80211_iftype iftype,
  5924. u8 data_offset, bool is_amsdu);
  5925. /**
  5926. * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
  5927. * @skb: the 802.11 data frame
  5928. * @addr: the device MAC address
  5929. * @iftype: the virtual interface type
  5930. * Return: 0 on success. Non-zero on error.
  5931. */
  5932. static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5933. enum nl80211_iftype iftype)
  5934. {
  5935. return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
  5936. }
  5937. /**
  5938. * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
  5939. *
  5940. * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
  5941. * The @list will be empty if the decode fails. The @skb must be fully
  5942. * header-less before being passed in here; it is freed in this function.
  5943. *
  5944. * @skb: The input A-MSDU frame without any headers.
  5945. * @list: The output list of 802.3 frames. It must be allocated and
  5946. * initialized by the caller.
  5947. * @addr: The device MAC address.
  5948. * @iftype: The device interface type.
  5949. * @extra_headroom: The hardware extra headroom for SKBs in the @list.
  5950. * @check_da: DA to check in the inner ethernet header, or NULL
  5951. * @check_sa: SA to check in the inner ethernet header, or NULL
  5952. */
  5953. void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  5954. const u8 *addr, enum nl80211_iftype iftype,
  5955. const unsigned int extra_headroom,
  5956. const u8 *check_da, const u8 *check_sa);
  5957. /**
  5958. * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
  5959. * @skb: the data frame
  5960. * @qos_map: Interworking QoS mapping or %NULL if not in use
  5961. * Return: The 802.1p/1d tag.
  5962. */
  5963. unsigned int cfg80211_classify8021d(struct sk_buff *skb,
  5964. struct cfg80211_qos_map *qos_map);
  5965. /**
  5966. * cfg80211_find_elem_match - match information element and byte array in data
  5967. *
  5968. * @eid: element ID
  5969. * @ies: data consisting of IEs
  5970. * @len: length of data
  5971. * @match: byte array to match
  5972. * @match_len: number of bytes in the match array
  5973. * @match_offset: offset in the IE data where the byte array should match.
  5974. * Note the difference to cfg80211_find_ie_match() which considers
  5975. * the offset to start from the element ID byte, but here we take
  5976. * the data portion instead.
  5977. *
  5978. * Return: %NULL if the element ID could not be found or if
  5979. * the element is invalid (claims to be longer than the given
  5980. * data) or if the byte array doesn't match; otherwise return the
  5981. * requested element struct.
  5982. *
  5983. * Note: There are no checks on the element length other than
  5984. * having to fit into the given data and being large enough for the
  5985. * byte array to match.
  5986. */
  5987. const struct element *
  5988. cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
  5989. const u8 *match, unsigned int match_len,
  5990. unsigned int match_offset);
  5991. /**
  5992. * cfg80211_find_ie_match - match information element and byte array in data
  5993. *
  5994. * @eid: element ID
  5995. * @ies: data consisting of IEs
  5996. * @len: length of data
  5997. * @match: byte array to match
  5998. * @match_len: number of bytes in the match array
  5999. * @match_offset: offset in the IE where the byte array should match.
  6000. * If match_len is zero, this must also be set to zero.
  6001. * Otherwise this must be set to 2 or more, because the first
  6002. * byte is the element id, which is already compared to eid, and
  6003. * the second byte is the IE length.
  6004. *
  6005. * Return: %NULL if the element ID could not be found or if
  6006. * the element is invalid (claims to be longer than the given
  6007. * data) or if the byte array doesn't match, or a pointer to the first
  6008. * byte of the requested element, that is the byte containing the
  6009. * element ID.
  6010. *
  6011. * Note: There are no checks on the element length other than
  6012. * having to fit into the given data and being large enough for the
  6013. * byte array to match.
  6014. */
  6015. static inline const u8 *
  6016. cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
  6017. const u8 *match, unsigned int match_len,
  6018. unsigned int match_offset)
  6019. {
  6020. /* match_offset can't be smaller than 2, unless match_len is
  6021. * zero, in which case match_offset must be zero as well.
  6022. */
  6023. if (WARN_ON((match_len && match_offset < 2) ||
  6024. (!match_len && match_offset)))
  6025. return NULL;
  6026. return (const void *)cfg80211_find_elem_match(eid, ies, len,
  6027. match, match_len,
  6028. match_offset ?
  6029. match_offset - 2 : 0);
  6030. }
  6031. /**
  6032. * cfg80211_find_elem - find information element in data
  6033. *
  6034. * @eid: element ID
  6035. * @ies: data consisting of IEs
  6036. * @len: length of data
  6037. *
  6038. * Return: %NULL if the element ID could not be found or if
  6039. * the element is invalid (claims to be longer than the given
  6040. * data) or if the byte array doesn't match; otherwise return the
  6041. * requested element struct.
  6042. *
  6043. * Note: There are no checks on the element length other than
  6044. * having to fit into the given data.
  6045. */
  6046. static inline const struct element *
  6047. cfg80211_find_elem(u8 eid, const u8 *ies, int len)
  6048. {
  6049. return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
  6050. }
  6051. /**
  6052. * cfg80211_find_ie - find information element in data
  6053. *
  6054. * @eid: element ID
  6055. * @ies: data consisting of IEs
  6056. * @len: length of data
  6057. *
  6058. * Return: %NULL if the element ID could not be found or if
  6059. * the element is invalid (claims to be longer than the given
  6060. * data), or a pointer to the first byte of the requested
  6061. * element, that is the byte containing the element ID.
  6062. *
  6063. * Note: There are no checks on the element length other than
  6064. * having to fit into the given data.
  6065. */
  6066. static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
  6067. {
  6068. return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
  6069. }
  6070. /**
  6071. * cfg80211_find_ext_elem - find information element with EID Extension in data
  6072. *
  6073. * @ext_eid: element ID Extension
  6074. * @ies: data consisting of IEs
  6075. * @len: length of data
  6076. *
  6077. * Return: %NULL if the etended element could not be found or if
  6078. * the element is invalid (claims to be longer than the given
  6079. * data) or if the byte array doesn't match; otherwise return the
  6080. * requested element struct.
  6081. *
  6082. * Note: There are no checks on the element length other than
  6083. * having to fit into the given data.
  6084. */
  6085. static inline const struct element *
  6086. cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
  6087. {
  6088. return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
  6089. &ext_eid, 1, 0);
  6090. }
  6091. /**
  6092. * cfg80211_find_ext_ie - find information element with EID Extension in data
  6093. *
  6094. * @ext_eid: element ID Extension
  6095. * @ies: data consisting of IEs
  6096. * @len: length of data
  6097. *
  6098. * Return: %NULL if the extended element ID could not be found or if
  6099. * the element is invalid (claims to be longer than the given
  6100. * data), or a pointer to the first byte of the requested
  6101. * element, that is the byte containing the element ID.
  6102. *
  6103. * Note: There are no checks on the element length other than
  6104. * having to fit into the given data.
  6105. */
  6106. static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
  6107. {
  6108. return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
  6109. &ext_eid, 1, 2);
  6110. }
  6111. /**
  6112. * cfg80211_find_vendor_elem - find vendor specific information element in data
  6113. *
  6114. * @oui: vendor OUI
  6115. * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
  6116. * @ies: data consisting of IEs
  6117. * @len: length of data
  6118. *
  6119. * Return: %NULL if the vendor specific element ID could not be found or if the
  6120. * element is invalid (claims to be longer than the given data); otherwise
  6121. * return the element structure for the requested element.
  6122. *
  6123. * Note: There are no checks on the element length other than having to fit into
  6124. * the given data.
  6125. */
  6126. const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
  6127. const u8 *ies,
  6128. unsigned int len);
  6129. /**
  6130. * cfg80211_find_vendor_ie - find vendor specific information element in data
  6131. *
  6132. * @oui: vendor OUI
  6133. * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
  6134. * @ies: data consisting of IEs
  6135. * @len: length of data
  6136. *
  6137. * Return: %NULL if the vendor specific element ID could not be found or if the
  6138. * element is invalid (claims to be longer than the given data), or a pointer to
  6139. * the first byte of the requested element, that is the byte containing the
  6140. * element ID.
  6141. *
  6142. * Note: There are no checks on the element length other than having to fit into
  6143. * the given data.
  6144. */
  6145. static inline const u8 *
  6146. cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
  6147. const u8 *ies, unsigned int len)
  6148. {
  6149. return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
  6150. }
  6151. /**
  6152. * cfg80211_send_layer2_update - send layer 2 update frame
  6153. *
  6154. * @dev: network device
  6155. * @addr: STA MAC address
  6156. *
  6157. * Wireless drivers can use this function to update forwarding tables in bridge
  6158. * devices upon STA association.
  6159. */
  6160. void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
  6161. /**
  6162. * DOC: Regulatory enforcement infrastructure
  6163. *
  6164. * TODO
  6165. */
  6166. /**
  6167. * regulatory_hint - driver hint to the wireless core a regulatory domain
  6168. * @wiphy: the wireless device giving the hint (used only for reporting
  6169. * conflicts)
  6170. * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
  6171. * should be in. If @rd is set this should be NULL. Note that if you
  6172. * set this to NULL you should still set rd->alpha2 to some accepted
  6173. * alpha2.
  6174. *
  6175. * Wireless drivers can use this function to hint to the wireless core
  6176. * what it believes should be the current regulatory domain by
  6177. * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
  6178. * domain should be in or by providing a completely build regulatory domain.
  6179. * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
  6180. * for a regulatory domain structure for the respective country.
  6181. *
  6182. * The wiphy must have been registered to cfg80211 prior to this call.
  6183. * For cfg80211 drivers this means you must first use wiphy_register(),
  6184. * for mac80211 drivers you must first use ieee80211_register_hw().
  6185. *
  6186. * Drivers should check the return value, its possible you can get
  6187. * an -ENOMEM.
  6188. *
  6189. * Return: 0 on success. -ENOMEM.
  6190. */
  6191. int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
  6192. /**
  6193. * regulatory_set_wiphy_regd - set regdom info for self managed drivers
  6194. * @wiphy: the wireless device we want to process the regulatory domain on
  6195. * @rd: the regulatory domain informatoin to use for this wiphy
  6196. *
  6197. * Set the regulatory domain information for self-managed wiphys, only they
  6198. * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
  6199. * information.
  6200. *
  6201. * Return: 0 on success. -EINVAL, -EPERM
  6202. */
  6203. int regulatory_set_wiphy_regd(struct wiphy *wiphy,
  6204. struct ieee80211_regdomain *rd);
  6205. /**
  6206. * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
  6207. * @wiphy: the wireless device we want to process the regulatory domain on
  6208. * @rd: the regulatory domain information to use for this wiphy
  6209. *
  6210. * This functions requires the RTNL and the wiphy mutex to be held and
  6211. * applies the new regdomain synchronously to this wiphy. For more details
  6212. * see regulatory_set_wiphy_regd().
  6213. *
  6214. * Return: 0 on success. -EINVAL, -EPERM
  6215. */
  6216. int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
  6217. struct ieee80211_regdomain *rd);
  6218. /**
  6219. * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
  6220. * @wiphy: the wireless device we want to process the regulatory domain on
  6221. * @regd: the custom regulatory domain to use for this wiphy
  6222. *
  6223. * Drivers can sometimes have custom regulatory domains which do not apply
  6224. * to a specific country. Drivers can use this to apply such custom regulatory
  6225. * domains. This routine must be called prior to wiphy registration. The
  6226. * custom regulatory domain will be trusted completely and as such previous
  6227. * default channel settings will be disregarded. If no rule is found for a
  6228. * channel on the regulatory domain the channel will be disabled.
  6229. * Drivers using this for a wiphy should also set the wiphy flag
  6230. * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
  6231. * that called this helper.
  6232. */
  6233. void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
  6234. const struct ieee80211_regdomain *regd);
  6235. /**
  6236. * freq_reg_info - get regulatory information for the given frequency
  6237. * @wiphy: the wiphy for which we want to process this rule for
  6238. * @center_freq: Frequency in KHz for which we want regulatory information for
  6239. *
  6240. * Use this function to get the regulatory rule for a specific frequency on
  6241. * a given wireless device. If the device has a specific regulatory domain
  6242. * it wants to follow we respect that unless a country IE has been received
  6243. * and processed already.
  6244. *
  6245. * Return: A valid pointer, or, when an error occurs, for example if no rule
  6246. * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
  6247. * check and PTR_ERR() to obtain the numeric return value. The numeric return
  6248. * value will be -ERANGE if we determine the given center_freq does not even
  6249. * have a regulatory rule for a frequency range in the center_freq's band.
  6250. * See freq_in_rule_band() for our current definition of a band -- this is
  6251. * purely subjective and right now it's 802.11 specific.
  6252. */
  6253. const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
  6254. u32 center_freq);
  6255. /**
  6256. * reg_initiator_name - map regulatory request initiator enum to name
  6257. * @initiator: the regulatory request initiator
  6258. *
  6259. * You can use this to map the regulatory request initiator enum to a
  6260. * proper string representation.
  6261. */
  6262. const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
  6263. /**
  6264. * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
  6265. * @wiphy: wiphy for which pre-CAC capability is checked.
  6266. *
  6267. * Pre-CAC is allowed only in some regdomains (notable ETSI).
  6268. */
  6269. bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
  6270. /**
  6271. * DOC: Internal regulatory db functions
  6272. *
  6273. */
  6274. /**
  6275. * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
  6276. * Regulatory self-managed driver can use it to proactively
  6277. *
  6278. * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
  6279. * @freq: the freqency(in MHz) to be queried.
  6280. * @rule: pointer to store the wmm rule from the regulatory db.
  6281. *
  6282. * Self-managed wireless drivers can use this function to query
  6283. * the internal regulatory database to check whether the given
  6284. * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
  6285. *
  6286. * Drivers should check the return value, its possible you can get
  6287. * an -ENODATA.
  6288. *
  6289. * Return: 0 on success. -ENODATA.
  6290. */
  6291. int reg_query_regdb_wmm(char *alpha2, int freq,
  6292. struct ieee80211_reg_rule *rule);
  6293. /*
  6294. * callbacks for asynchronous cfg80211 methods, notification
  6295. * functions and BSS handling helpers
  6296. */
  6297. /**
  6298. * cfg80211_scan_done - notify that scan finished
  6299. *
  6300. * @request: the corresponding scan request
  6301. * @info: information about the completed scan
  6302. */
  6303. void cfg80211_scan_done(struct cfg80211_scan_request *request,
  6304. struct cfg80211_scan_info *info);
  6305. /**
  6306. * cfg80211_sched_scan_results - notify that new scan results are available
  6307. *
  6308. * @wiphy: the wiphy which got scheduled scan results
  6309. * @reqid: identifier for the related scheduled scan request
  6310. */
  6311. void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
  6312. /**
  6313. * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
  6314. *
  6315. * @wiphy: the wiphy on which the scheduled scan stopped
  6316. * @reqid: identifier for the related scheduled scan request
  6317. *
  6318. * The driver can call this function to inform cfg80211 that the
  6319. * scheduled scan had to be stopped, for whatever reason. The driver
  6320. * is then called back via the sched_scan_stop operation when done.
  6321. */
  6322. void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
  6323. /**
  6324. * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
  6325. *
  6326. * @wiphy: the wiphy on which the scheduled scan stopped
  6327. * @reqid: identifier for the related scheduled scan request
  6328. *
  6329. * The driver can call this function to inform cfg80211 that the
  6330. * scheduled scan had to be stopped, for whatever reason. The driver
  6331. * is then called back via the sched_scan_stop operation when done.
  6332. * This function should be called with the wiphy mutex held.
  6333. */
  6334. void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
  6335. /**
  6336. * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
  6337. * @wiphy: the wiphy reporting the BSS
  6338. * @data: the BSS metadata
  6339. * @mgmt: the management frame (probe response or beacon)
  6340. * @len: length of the management frame
  6341. * @gfp: context flags
  6342. *
  6343. * This informs cfg80211 that BSS information was found and
  6344. * the BSS should be updated/added.
  6345. *
  6346. * Return: A referenced struct, must be released with cfg80211_put_bss()!
  6347. * Or %NULL on error.
  6348. */
  6349. struct cfg80211_bss * __must_check
  6350. cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
  6351. struct cfg80211_inform_bss *data,
  6352. struct ieee80211_mgmt *mgmt, size_t len,
  6353. gfp_t gfp);
  6354. static inline struct cfg80211_bss * __must_check
  6355. cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
  6356. struct ieee80211_channel *rx_channel,
  6357. enum nl80211_bss_scan_width scan_width,
  6358. struct ieee80211_mgmt *mgmt, size_t len,
  6359. s32 signal, gfp_t gfp)
  6360. {
  6361. struct cfg80211_inform_bss data = {
  6362. .chan = rx_channel,
  6363. .scan_width = scan_width,
  6364. .signal = signal,
  6365. };
  6366. return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
  6367. }
  6368. static inline struct cfg80211_bss * __must_check
  6369. cfg80211_inform_bss_frame(struct wiphy *wiphy,
  6370. struct ieee80211_channel *rx_channel,
  6371. struct ieee80211_mgmt *mgmt, size_t len,
  6372. s32 signal, gfp_t gfp)
  6373. {
  6374. struct cfg80211_inform_bss data = {
  6375. .chan = rx_channel,
  6376. .scan_width = NL80211_BSS_CHAN_WIDTH_20,
  6377. .signal = signal,
  6378. };
  6379. return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
  6380. }
  6381. /**
  6382. * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
  6383. * @bssid: transmitter BSSID
  6384. * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
  6385. * @mbssid_index: BSSID index, taken from Multiple BSSID index element
  6386. * @new_bssid: calculated nontransmitted BSSID
  6387. */
  6388. static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
  6389. u8 mbssid_index, u8 *new_bssid)
  6390. {
  6391. u64 bssid_u64 = ether_addr_to_u64(bssid);
  6392. u64 mask = GENMASK_ULL(max_bssid - 1, 0);
  6393. u64 new_bssid_u64;
  6394. new_bssid_u64 = bssid_u64 & ~mask;
  6395. new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
  6396. u64_to_ether_addr(new_bssid_u64, new_bssid);
  6397. }
  6398. /**
  6399. * cfg80211_is_element_inherited - returns if element ID should be inherited
  6400. * @element: element to check
  6401. * @non_inherit_element: non inheritance element
  6402. */
  6403. bool cfg80211_is_element_inherited(const struct element *element,
  6404. const struct element *non_inherit_element);
  6405. /**
  6406. * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
  6407. * @ie: ies
  6408. * @ielen: length of IEs
  6409. * @mbssid_elem: current MBSSID element
  6410. * @sub_elem: current MBSSID subelement (profile)
  6411. * @merged_ie: location of the merged profile
  6412. * @max_copy_len: max merged profile length
  6413. */
  6414. size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
  6415. const struct element *mbssid_elem,
  6416. const struct element *sub_elem,
  6417. u8 *merged_ie, size_t max_copy_len);
  6418. /**
  6419. * enum cfg80211_bss_frame_type - frame type that the BSS data came from
  6420. * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
  6421. * from a beacon or probe response
  6422. * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
  6423. * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
  6424. */
  6425. enum cfg80211_bss_frame_type {
  6426. CFG80211_BSS_FTYPE_UNKNOWN,
  6427. CFG80211_BSS_FTYPE_BEACON,
  6428. CFG80211_BSS_FTYPE_PRESP,
  6429. };
  6430. /**
  6431. * cfg80211_get_ies_channel_number - returns the channel number from ies
  6432. * @ie: IEs
  6433. * @ielen: length of IEs
  6434. * @band: enum nl80211_band of the channel
  6435. * @ftype: frame type
  6436. *
  6437. * Returns the channel number, or -1 if none could be determined.
  6438. */
  6439. int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
  6440. enum nl80211_band band,
  6441. enum cfg80211_bss_frame_type ftype);
  6442. /**
  6443. * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
  6444. *
  6445. * @wiphy: the wiphy reporting the BSS
  6446. * @data: the BSS metadata
  6447. * @ftype: frame type (if known)
  6448. * @bssid: the BSSID of the BSS
  6449. * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
  6450. * @capability: the capability field sent by the peer
  6451. * @beacon_interval: the beacon interval announced by the peer
  6452. * @ie: additional IEs sent by the peer
  6453. * @ielen: length of the additional IEs
  6454. * @gfp: context flags
  6455. *
  6456. * This informs cfg80211 that BSS information was found and
  6457. * the BSS should be updated/added.
  6458. *
  6459. * Return: A referenced struct, must be released with cfg80211_put_bss()!
  6460. * Or %NULL on error.
  6461. */
  6462. struct cfg80211_bss * __must_check
  6463. cfg80211_inform_bss_data(struct wiphy *wiphy,
  6464. struct cfg80211_inform_bss *data,
  6465. enum cfg80211_bss_frame_type ftype,
  6466. const u8 *bssid, u64 tsf, u16 capability,
  6467. u16 beacon_interval, const u8 *ie, size_t ielen,
  6468. gfp_t gfp);
  6469. static inline struct cfg80211_bss * __must_check
  6470. cfg80211_inform_bss_width(struct wiphy *wiphy,
  6471. struct ieee80211_channel *rx_channel,
  6472. enum nl80211_bss_scan_width scan_width,
  6473. enum cfg80211_bss_frame_type ftype,
  6474. const u8 *bssid, u64 tsf, u16 capability,
  6475. u16 beacon_interval, const u8 *ie, size_t ielen,
  6476. s32 signal, gfp_t gfp)
  6477. {
  6478. struct cfg80211_inform_bss data = {
  6479. .chan = rx_channel,
  6480. .scan_width = scan_width,
  6481. .signal = signal,
  6482. };
  6483. return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
  6484. capability, beacon_interval, ie, ielen,
  6485. gfp);
  6486. }
  6487. static inline struct cfg80211_bss * __must_check
  6488. cfg80211_inform_bss(struct wiphy *wiphy,
  6489. struct ieee80211_channel *rx_channel,
  6490. enum cfg80211_bss_frame_type ftype,
  6491. const u8 *bssid, u64 tsf, u16 capability,
  6492. u16 beacon_interval, const u8 *ie, size_t ielen,
  6493. s32 signal, gfp_t gfp)
  6494. {
  6495. struct cfg80211_inform_bss data = {
  6496. .chan = rx_channel,
  6497. .scan_width = NL80211_BSS_CHAN_WIDTH_20,
  6498. .signal = signal,
  6499. };
  6500. return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
  6501. capability, beacon_interval, ie, ielen,
  6502. gfp);
  6503. }
  6504. /**
  6505. * cfg80211_get_bss - get a BSS reference
  6506. * @wiphy: the wiphy this BSS struct belongs to
  6507. * @channel: the channel to search on (or %NULL)
  6508. * @bssid: the desired BSSID (or %NULL)
  6509. * @ssid: the desired SSID (or %NULL)
  6510. * @ssid_len: length of the SSID (or 0)
  6511. * @bss_type: type of BSS, see &enum ieee80211_bss_type
  6512. * @privacy: privacy filter, see &enum ieee80211_privacy
  6513. */
  6514. struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
  6515. struct ieee80211_channel *channel,
  6516. const u8 *bssid,
  6517. const u8 *ssid, size_t ssid_len,
  6518. enum ieee80211_bss_type bss_type,
  6519. enum ieee80211_privacy privacy);
  6520. static inline struct cfg80211_bss *
  6521. cfg80211_get_ibss(struct wiphy *wiphy,
  6522. struct ieee80211_channel *channel,
  6523. const u8 *ssid, size_t ssid_len)
  6524. {
  6525. return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
  6526. IEEE80211_BSS_TYPE_IBSS,
  6527. IEEE80211_PRIVACY_ANY);
  6528. }
  6529. /**
  6530. * cfg80211_ref_bss - reference BSS struct
  6531. * @wiphy: the wiphy this BSS struct belongs to
  6532. * @bss: the BSS struct to reference
  6533. *
  6534. * Increments the refcount of the given BSS struct.
  6535. */
  6536. void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
  6537. /**
  6538. * cfg80211_put_bss - unref BSS struct
  6539. * @wiphy: the wiphy this BSS struct belongs to
  6540. * @bss: the BSS struct
  6541. *
  6542. * Decrements the refcount of the given BSS struct.
  6543. */
  6544. void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
  6545. /**
  6546. * cfg80211_unlink_bss - unlink BSS from internal data structures
  6547. * @wiphy: the wiphy
  6548. * @bss: the bss to remove
  6549. *
  6550. * This function removes the given BSS from the internal data structures
  6551. * thereby making it no longer show up in scan results etc. Use this
  6552. * function when you detect a BSS is gone. Normally BSSes will also time
  6553. * out, so it is not necessary to use this function at all.
  6554. */
  6555. void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
  6556. /**
  6557. * cfg80211_bss_iter - iterate all BSS entries
  6558. *
  6559. * This function iterates over the BSS entries associated with the given wiphy
  6560. * and calls the callback for the iterated BSS. The iterator function is not
  6561. * allowed to call functions that might modify the internal state of the BSS DB.
  6562. *
  6563. * @wiphy: the wiphy
  6564. * @chandef: if given, the iterator function will be called only if the channel
  6565. * of the currently iterated BSS is a subset of the given channel.
  6566. * @iter: the iterator function to call
  6567. * @iter_data: an argument to the iterator function
  6568. */
  6569. void cfg80211_bss_iter(struct wiphy *wiphy,
  6570. struct cfg80211_chan_def *chandef,
  6571. void (*iter)(struct wiphy *wiphy,
  6572. struct cfg80211_bss *bss,
  6573. void *data),
  6574. void *iter_data);
  6575. static inline enum nl80211_bss_scan_width
  6576. cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
  6577. {
  6578. switch (chandef->width) {
  6579. case NL80211_CHAN_WIDTH_5:
  6580. return NL80211_BSS_CHAN_WIDTH_5;
  6581. case NL80211_CHAN_WIDTH_10:
  6582. return NL80211_BSS_CHAN_WIDTH_10;
  6583. default:
  6584. return NL80211_BSS_CHAN_WIDTH_20;
  6585. }
  6586. }
  6587. /**
  6588. * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
  6589. * @dev: network device
  6590. * @buf: authentication frame (header + body)
  6591. * @len: length of the frame data
  6592. *
  6593. * This function is called whenever an authentication, disassociation or
  6594. * deauthentication frame has been received and processed in station mode.
  6595. * After being asked to authenticate via cfg80211_ops::auth() the driver must
  6596. * call either this function or cfg80211_auth_timeout().
  6597. * After being asked to associate via cfg80211_ops::assoc() the driver must
  6598. * call either this function or cfg80211_auth_timeout().
  6599. * While connected, the driver must calls this for received and processed
  6600. * disassociation and deauthentication frames. If the frame couldn't be used
  6601. * because it was unprotected, the driver must call the function
  6602. * cfg80211_rx_unprot_mlme_mgmt() instead.
  6603. *
  6604. * This function may sleep. The caller must hold the corresponding wdev's mutex.
  6605. */
  6606. void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
  6607. /**
  6608. * cfg80211_auth_timeout - notification of timed out authentication
  6609. * @dev: network device
  6610. * @addr: The MAC address of the device with which the authentication timed out
  6611. *
  6612. * This function may sleep. The caller must hold the corresponding wdev's
  6613. * mutex.
  6614. */
  6615. void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
  6616. /**
  6617. * struct cfg80211_rx_assoc_resp - association response data
  6618. * @bss: the BSS that association was requested with, ownership of the pointer
  6619. * moves to cfg80211 in the call to cfg80211_rx_assoc_resp()
  6620. * @buf: (Re)Association Response frame (header + body)
  6621. * @len: length of the frame data
  6622. * @uapsd_queues: bitmap of queues configured for uapsd. Same format
  6623. * as the AC bitmap in the QoS info field
  6624. * @req_ies: information elements from the (Re)Association Request frame
  6625. * @req_ies_len: length of req_ies data
  6626. * @ap_mld_addr: AP MLD address (in case of MLO)
  6627. * @links: per-link information indexed by link ID, use links[0] for
  6628. * non-MLO connections
  6629. * @links.status: Set this (along with a BSS pointer) for links that
  6630. * were rejected by the AP.
  6631. */
  6632. struct cfg80211_rx_assoc_resp {
  6633. const u8 *buf;
  6634. size_t len;
  6635. const u8 *req_ies;
  6636. size_t req_ies_len;
  6637. int uapsd_queues;
  6638. const u8 *ap_mld_addr;
  6639. struct {
  6640. const u8 *addr;
  6641. struct cfg80211_bss *bss;
  6642. u16 status;
  6643. } links[IEEE80211_MLD_MAX_NUM_LINKS];
  6644. };
  6645. /**
  6646. * cfg80211_rx_assoc_resp - notification of processed association response
  6647. * @dev: network device
  6648. * @data: association response data, &struct cfg80211_rx_assoc_resp
  6649. *
  6650. * After being asked to associate via cfg80211_ops::assoc() the driver must
  6651. * call either this function or cfg80211_auth_timeout().
  6652. *
  6653. * This function may sleep. The caller must hold the corresponding wdev's mutex.
  6654. */
  6655. void cfg80211_rx_assoc_resp(struct net_device *dev,
  6656. struct cfg80211_rx_assoc_resp *data);
  6657. /**
  6658. * struct cfg80211_assoc_failure - association failure data
  6659. * @ap_mld_addr: AP MLD address, or %NULL
  6660. * @bss: list of BSSes, must use entry 0 for non-MLO connections
  6661. * (@ap_mld_addr is %NULL)
  6662. * @timeout: indicates the association failed due to timeout, otherwise
  6663. * the association was abandoned for a reason reported through some
  6664. * other API (e.g. deauth RX)
  6665. */
  6666. struct cfg80211_assoc_failure {
  6667. const u8 *ap_mld_addr;
  6668. struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];
  6669. bool timeout;
  6670. };
  6671. /**
  6672. * cfg80211_assoc_failure - notification of association failure
  6673. * @dev: network device
  6674. * @data: data describing the association failure
  6675. *
  6676. * This function may sleep. The caller must hold the corresponding wdev's mutex.
  6677. */
  6678. void cfg80211_assoc_failure(struct net_device *dev,
  6679. struct cfg80211_assoc_failure *data);
  6680. /**
  6681. * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
  6682. * @dev: network device
  6683. * @buf: 802.11 frame (header + body)
  6684. * @len: length of the frame data
  6685. * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
  6686. *
  6687. * This function is called whenever deauthentication has been processed in
  6688. * station mode. This includes both received deauthentication frames and
  6689. * locally generated ones. This function may sleep. The caller must hold the
  6690. * corresponding wdev's mutex.
  6691. */
  6692. void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
  6693. bool reconnect);
  6694. /**
  6695. * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
  6696. * @dev: network device
  6697. * @buf: received management frame (header + body)
  6698. * @len: length of the frame data
  6699. *
  6700. * This function is called whenever a received deauthentication or dissassoc
  6701. * frame has been dropped in station mode because of MFP being used but the
  6702. * frame was not protected. This is also used to notify reception of a Beacon
  6703. * frame that was dropped because it did not include a valid MME MIC while
  6704. * beacon protection was enabled (BIGTK configured in station mode).
  6705. *
  6706. * This function may sleep.
  6707. */
  6708. void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
  6709. const u8 *buf, size_t len);
  6710. /**
  6711. * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
  6712. * @dev: network device
  6713. * @addr: The source MAC address of the frame
  6714. * @key_type: The key type that the received frame used
  6715. * @key_id: Key identifier (0..3). Can be -1 if missing.
  6716. * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
  6717. * @gfp: allocation flags
  6718. *
  6719. * This function is called whenever the local MAC detects a MIC failure in a
  6720. * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
  6721. * primitive.
  6722. */
  6723. void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
  6724. enum nl80211_key_type key_type, int key_id,
  6725. const u8 *tsc, gfp_t gfp);
  6726. /**
  6727. * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
  6728. *
  6729. * @dev: network device
  6730. * @bssid: the BSSID of the IBSS joined
  6731. * @channel: the channel of the IBSS joined
  6732. * @gfp: allocation flags
  6733. *
  6734. * This function notifies cfg80211 that the device joined an IBSS or
  6735. * switched to a different BSSID. Before this function can be called,
  6736. * either a beacon has to have been received from the IBSS, or one of
  6737. * the cfg80211_inform_bss{,_frame} functions must have been called
  6738. * with the locally generated beacon -- this guarantees that there is
  6739. * always a scan result for this IBSS. cfg80211 will handle the rest.
  6740. */
  6741. void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
  6742. struct ieee80211_channel *channel, gfp_t gfp);
  6743. /**
  6744. * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
  6745. * candidate
  6746. *
  6747. * @dev: network device
  6748. * @macaddr: the MAC address of the new candidate
  6749. * @ie: information elements advertised by the peer candidate
  6750. * @ie_len: length of the information elements buffer
  6751. * @sig_dbm: signal level in dBm
  6752. * @gfp: allocation flags
  6753. *
  6754. * This function notifies cfg80211 that the mesh peer candidate has been
  6755. * detected, most likely via a beacon or, less likely, via a probe response.
  6756. * cfg80211 then sends a notification to userspace.
  6757. */
  6758. void cfg80211_notify_new_peer_candidate(struct net_device *dev,
  6759. const u8 *macaddr, const u8 *ie, u8 ie_len,
  6760. int sig_dbm, gfp_t gfp);
  6761. /**
  6762. * DOC: RFkill integration
  6763. *
  6764. * RFkill integration in cfg80211 is almost invisible to drivers,
  6765. * as cfg80211 automatically registers an rfkill instance for each
  6766. * wireless device it knows about. Soft kill is also translated
  6767. * into disconnecting and turning all interfaces off, drivers are
  6768. * expected to turn off the device when all interfaces are down.
  6769. *
  6770. * However, devices may have a hard RFkill line, in which case they
  6771. * also need to interact with the rfkill subsystem, via cfg80211.
  6772. * They can do this with a few helper functions documented here.
  6773. */
  6774. /**
  6775. * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
  6776. * @wiphy: the wiphy
  6777. * @blocked: block status
  6778. * @reason: one of reasons in &enum rfkill_hard_block_reasons
  6779. */
  6780. void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
  6781. enum rfkill_hard_block_reasons reason);
  6782. static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
  6783. {
  6784. wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
  6785. RFKILL_HARD_BLOCK_SIGNAL);
  6786. }
  6787. /**
  6788. * wiphy_rfkill_start_polling - start polling rfkill
  6789. * @wiphy: the wiphy
  6790. */
  6791. void wiphy_rfkill_start_polling(struct wiphy *wiphy);
  6792. /**
  6793. * wiphy_rfkill_stop_polling - stop polling rfkill
  6794. * @wiphy: the wiphy
  6795. */
  6796. static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
  6797. {
  6798. rfkill_pause_polling(wiphy->rfkill);
  6799. }
  6800. /**
  6801. * DOC: Vendor commands
  6802. *
  6803. * Occasionally, there are special protocol or firmware features that
  6804. * can't be implemented very openly. For this and similar cases, the
  6805. * vendor command functionality allows implementing the features with
  6806. * (typically closed-source) userspace and firmware, using nl80211 as
  6807. * the configuration mechanism.
  6808. *
  6809. * A driver supporting vendor commands must register them as an array
  6810. * in struct wiphy, with handlers for each one, each command has an
  6811. * OUI and sub command ID to identify it.
  6812. *
  6813. * Note that this feature should not be (ab)used to implement protocol
  6814. * features that could openly be shared across drivers. In particular,
  6815. * it must never be required to use vendor commands to implement any
  6816. * "normal" functionality that higher-level userspace like connection
  6817. * managers etc. need.
  6818. */
  6819. struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
  6820. enum nl80211_commands cmd,
  6821. enum nl80211_attrs attr,
  6822. int approxlen);
  6823. struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
  6824. struct wireless_dev *wdev,
  6825. enum nl80211_commands cmd,
  6826. enum nl80211_attrs attr,
  6827. unsigned int portid,
  6828. int vendor_event_idx,
  6829. int approxlen, gfp_t gfp);
  6830. void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
  6831. /**
  6832. * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
  6833. * @wiphy: the wiphy
  6834. * @approxlen: an upper bound of the length of the data that will
  6835. * be put into the skb
  6836. *
  6837. * This function allocates and pre-fills an skb for a reply to
  6838. * a vendor command. Since it is intended for a reply, calling
  6839. * it outside of a vendor command's doit() operation is invalid.
  6840. *
  6841. * The returned skb is pre-filled with some identifying data in
  6842. * a way that any data that is put into the skb (with skb_put(),
  6843. * nla_put() or similar) will end up being within the
  6844. * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
  6845. * with the skb is adding data for the corresponding userspace tool
  6846. * which can then read that data out of the vendor data attribute.
  6847. * You must not modify the skb in any other way.
  6848. *
  6849. * When done, call cfg80211_vendor_cmd_reply() with the skb and return
  6850. * its error code as the result of the doit() operation.
  6851. *
  6852. * Return: An allocated and pre-filled skb. %NULL if any errors happen.
  6853. */
  6854. static inline struct sk_buff *
  6855. cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
  6856. {
  6857. return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
  6858. NL80211_ATTR_VENDOR_DATA, approxlen);
  6859. }
  6860. /**
  6861. * cfg80211_vendor_cmd_reply - send the reply skb
  6862. * @skb: The skb, must have been allocated with
  6863. * cfg80211_vendor_cmd_alloc_reply_skb()
  6864. *
  6865. * Since calling this function will usually be the last thing
  6866. * before returning from the vendor command doit() you should
  6867. * return the error code. Note that this function consumes the
  6868. * skb regardless of the return value.
  6869. *
  6870. * Return: An error code or 0 on success.
  6871. */
  6872. int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
  6873. /**
  6874. * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
  6875. * @wiphy: the wiphy
  6876. *
  6877. * Return the current netlink port ID in a vendor command handler.
  6878. * Valid to call only there.
  6879. */
  6880. unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
  6881. /**
  6882. * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
  6883. * @wiphy: the wiphy
  6884. * @wdev: the wireless device
  6885. * @event_idx: index of the vendor event in the wiphy's vendor_events
  6886. * @approxlen: an upper bound of the length of the data that will
  6887. * be put into the skb
  6888. * @gfp: allocation flags
  6889. *
  6890. * This function allocates and pre-fills an skb for an event on the
  6891. * vendor-specific multicast group.
  6892. *
  6893. * If wdev != NULL, both the ifindex and identifier of the specified
  6894. * wireless device are added to the event message before the vendor data
  6895. * attribute.
  6896. *
  6897. * When done filling the skb, call cfg80211_vendor_event() with the
  6898. * skb to send the event.
  6899. *
  6900. * Return: An allocated and pre-filled skb. %NULL if any errors happen.
  6901. */
  6902. static inline struct sk_buff *
  6903. cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
  6904. int approxlen, int event_idx, gfp_t gfp)
  6905. {
  6906. return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
  6907. NL80211_ATTR_VENDOR_DATA,
  6908. 0, event_idx, approxlen, gfp);
  6909. }
  6910. /**
  6911. * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
  6912. * @wiphy: the wiphy
  6913. * @wdev: the wireless device
  6914. * @event_idx: index of the vendor event in the wiphy's vendor_events
  6915. * @portid: port ID of the receiver
  6916. * @approxlen: an upper bound of the length of the data that will
  6917. * be put into the skb
  6918. * @gfp: allocation flags
  6919. *
  6920. * This function allocates and pre-fills an skb for an event to send to
  6921. * a specific (userland) socket. This socket would previously have been
  6922. * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
  6923. * care to register a netlink notifier to see when the socket closes.
  6924. *
  6925. * If wdev != NULL, both the ifindex and identifier of the specified
  6926. * wireless device are added to the event message before the vendor data
  6927. * attribute.
  6928. *
  6929. * When done filling the skb, call cfg80211_vendor_event() with the
  6930. * skb to send the event.
  6931. *
  6932. * Return: An allocated and pre-filled skb. %NULL if any errors happen.
  6933. */
  6934. static inline struct sk_buff *
  6935. cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
  6936. struct wireless_dev *wdev,
  6937. unsigned int portid, int approxlen,
  6938. int event_idx, gfp_t gfp)
  6939. {
  6940. return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
  6941. NL80211_ATTR_VENDOR_DATA,
  6942. portid, event_idx, approxlen, gfp);
  6943. }
  6944. /**
  6945. * cfg80211_vendor_event - send the event
  6946. * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
  6947. * @gfp: allocation flags
  6948. *
  6949. * This function sends the given @skb, which must have been allocated
  6950. * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
  6951. */
  6952. static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
  6953. {
  6954. __cfg80211_send_event_skb(skb, gfp);
  6955. }
  6956. #ifdef CONFIG_NL80211_TESTMODE
  6957. /**
  6958. * DOC: Test mode
  6959. *
  6960. * Test mode is a set of utility functions to allow drivers to
  6961. * interact with driver-specific tools to aid, for instance,
  6962. * factory programming.
  6963. *
  6964. * This chapter describes how drivers interact with it, for more
  6965. * information see the nl80211 book's chapter on it.
  6966. */
  6967. /**
  6968. * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
  6969. * @wiphy: the wiphy
  6970. * @approxlen: an upper bound of the length of the data that will
  6971. * be put into the skb
  6972. *
  6973. * This function allocates and pre-fills an skb for a reply to
  6974. * the testmode command. Since it is intended for a reply, calling
  6975. * it outside of the @testmode_cmd operation is invalid.
  6976. *
  6977. * The returned skb is pre-filled with the wiphy index and set up in
  6978. * a way that any data that is put into the skb (with skb_put(),
  6979. * nla_put() or similar) will end up being within the
  6980. * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
  6981. * with the skb is adding data for the corresponding userspace tool
  6982. * which can then read that data out of the testdata attribute. You
  6983. * must not modify the skb in any other way.
  6984. *
  6985. * When done, call cfg80211_testmode_reply() with the skb and return
  6986. * its error code as the result of the @testmode_cmd operation.
  6987. *
  6988. * Return: An allocated and pre-filled skb. %NULL if any errors happen.
  6989. */
  6990. static inline struct sk_buff *
  6991. cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
  6992. {
  6993. return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
  6994. NL80211_ATTR_TESTDATA, approxlen);
  6995. }
  6996. /**
  6997. * cfg80211_testmode_reply - send the reply skb
  6998. * @skb: The skb, must have been allocated with
  6999. * cfg80211_testmode_alloc_reply_skb()
  7000. *
  7001. * Since calling this function will usually be the last thing
  7002. * before returning from the @testmode_cmd you should return
  7003. * the error code. Note that this function consumes the skb
  7004. * regardless of the return value.
  7005. *
  7006. * Return: An error code or 0 on success.
  7007. */
  7008. static inline int cfg80211_testmode_reply(struct sk_buff *skb)
  7009. {
  7010. return cfg80211_vendor_cmd_reply(skb);
  7011. }
  7012. /**
  7013. * cfg80211_testmode_alloc_event_skb - allocate testmode event
  7014. * @wiphy: the wiphy
  7015. * @approxlen: an upper bound of the length of the data that will
  7016. * be put into the skb
  7017. * @gfp: allocation flags
  7018. *
  7019. * This function allocates and pre-fills an skb for an event on the
  7020. * testmode multicast group.
  7021. *
  7022. * The returned skb is set up in the same way as with
  7023. * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
  7024. * there, you should simply add data to it that will then end up in the
  7025. * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
  7026. * in any other way.
  7027. *
  7028. * When done filling the skb, call cfg80211_testmode_event() with the
  7029. * skb to send the event.
  7030. *
  7031. * Return: An allocated and pre-filled skb. %NULL if any errors happen.
  7032. */
  7033. static inline struct sk_buff *
  7034. cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
  7035. {
  7036. return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
  7037. NL80211_ATTR_TESTDATA, 0, -1,
  7038. approxlen, gfp);
  7039. }
  7040. /**
  7041. * cfg80211_testmode_event - send the event
  7042. * @skb: The skb, must have been allocated with
  7043. * cfg80211_testmode_alloc_event_skb()
  7044. * @gfp: allocation flags
  7045. *
  7046. * This function sends the given @skb, which must have been allocated
  7047. * by cfg80211_testmode_alloc_event_skb(), as an event. It always
  7048. * consumes it.
  7049. */
  7050. static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
  7051. {
  7052. __cfg80211_send_event_skb(skb, gfp);
  7053. }
  7054. #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
  7055. #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
  7056. #else
  7057. #define CFG80211_TESTMODE_CMD(cmd)
  7058. #define CFG80211_TESTMODE_DUMP(cmd)
  7059. #endif
  7060. /**
  7061. * struct cfg80211_fils_resp_params - FILS connection response params
  7062. * @kek: KEK derived from a successful FILS connection (may be %NULL)
  7063. * @kek_len: Length of @fils_kek in octets
  7064. * @update_erp_next_seq_num: Boolean value to specify whether the value in
  7065. * @erp_next_seq_num is valid.
  7066. * @erp_next_seq_num: The next sequence number to use in ERP message in
  7067. * FILS Authentication. This value should be specified irrespective of the
  7068. * status for a FILS connection.
  7069. * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
  7070. * @pmk_len: Length of @pmk in octets
  7071. * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
  7072. * used for this FILS connection (may be %NULL).
  7073. */
  7074. struct cfg80211_fils_resp_params {
  7075. const u8 *kek;
  7076. size_t kek_len;
  7077. bool update_erp_next_seq_num;
  7078. u16 erp_next_seq_num;
  7079. const u8 *pmk;
  7080. size_t pmk_len;
  7081. const u8 *pmkid;
  7082. };
  7083. /**
  7084. * struct cfg80211_connect_resp_params - Connection response params
  7085. * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
  7086. * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
  7087. * the real status code for failures. If this call is used to report a
  7088. * failure due to a timeout (e.g., not receiving an Authentication frame
  7089. * from the AP) instead of an explicit rejection by the AP, -1 is used to
  7090. * indicate that this is a failure, but without a status code.
  7091. * @timeout_reason is used to report the reason for the timeout in that
  7092. * case.
  7093. * @req_ie: Association request IEs (may be %NULL)
  7094. * @req_ie_len: Association request IEs length
  7095. * @resp_ie: Association response IEs (may be %NULL)
  7096. * @resp_ie_len: Association response IEs length
  7097. * @fils: FILS connection response parameters.
  7098. * @timeout_reason: Reason for connection timeout. This is used when the
  7099. * connection fails due to a timeout instead of an explicit rejection from
  7100. * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
  7101. * not known. This value is used only if @status < 0 to indicate that the
  7102. * failure is due to a timeout and not due to explicit rejection by the AP.
  7103. * This value is ignored in other cases (@status >= 0).
  7104. * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise
  7105. * zero.
  7106. * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.
  7107. * @links : For MLO connection, contains link info for the valid links indicated
  7108. * using @valid_links. For non-MLO connection, links[0] contains the
  7109. * connected AP info.
  7110. * @links.addr: For MLO connection, MAC address of the STA link. Otherwise
  7111. * %NULL.
  7112. * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO
  7113. * connection, links[0].bssid points to the BSSID of the AP (may be %NULL).
  7114. * @links.bss: For MLO connection, entry of bss to which STA link is connected.
  7115. * For non-MLO connection, links[0].bss points to entry of bss to which STA
  7116. * is connected. It can be obtained through cfg80211_get_bss() (may be
  7117. * %NULL). It is recommended to store the bss from the connect_request and
  7118. * hold a reference to it and return through this param to avoid a warning
  7119. * if the bss is expired during the connection, esp. for those drivers
  7120. * implementing connect op. Only one parameter among @bssid and @bss needs
  7121. * to be specified.
  7122. * @links.status: per-link status code, to report a status code that's not
  7123. * %WLAN_STATUS_SUCCESS for a given link, it must also be in the
  7124. * @valid_links bitmap and may have a BSS pointer (which is then released)
  7125. */
  7126. struct cfg80211_connect_resp_params {
  7127. int status;
  7128. const u8 *req_ie;
  7129. size_t req_ie_len;
  7130. const u8 *resp_ie;
  7131. size_t resp_ie_len;
  7132. struct cfg80211_fils_resp_params fils;
  7133. enum nl80211_timeout_reason timeout_reason;
  7134. const u8 *ap_mld_addr;
  7135. u16 valid_links;
  7136. struct {
  7137. const u8 *addr;
  7138. const u8 *bssid;
  7139. struct cfg80211_bss *bss;
  7140. u16 status;
  7141. } links[IEEE80211_MLD_MAX_NUM_LINKS];
  7142. };
  7143. /**
  7144. * cfg80211_connect_done - notify cfg80211 of connection result
  7145. *
  7146. * @dev: network device
  7147. * @params: connection response parameters
  7148. * @gfp: allocation flags
  7149. *
  7150. * It should be called by the underlying driver once execution of the connection
  7151. * request from connect() has been completed. This is similar to
  7152. * cfg80211_connect_bss(), but takes a structure pointer for connection response
  7153. * parameters. Only one of the functions among cfg80211_connect_bss(),
  7154. * cfg80211_connect_result(), cfg80211_connect_timeout(),
  7155. * and cfg80211_connect_done() should be called.
  7156. */
  7157. void cfg80211_connect_done(struct net_device *dev,
  7158. struct cfg80211_connect_resp_params *params,
  7159. gfp_t gfp);
  7160. /**
  7161. * cfg80211_connect_bss - notify cfg80211 of connection result
  7162. *
  7163. * @dev: network device
  7164. * @bssid: the BSSID of the AP
  7165. * @bss: Entry of bss to which STA got connected to, can be obtained through
  7166. * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
  7167. * bss from the connect_request and hold a reference to it and return
  7168. * through this param to avoid a warning if the bss is expired during the
  7169. * connection, esp. for those drivers implementing connect op.
  7170. * Only one parameter among @bssid and @bss needs to be specified.
  7171. * @req_ie: association request IEs (maybe be %NULL)
  7172. * @req_ie_len: association request IEs length
  7173. * @resp_ie: association response IEs (may be %NULL)
  7174. * @resp_ie_len: assoc response IEs length
  7175. * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
  7176. * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
  7177. * the real status code for failures. If this call is used to report a
  7178. * failure due to a timeout (e.g., not receiving an Authentication frame
  7179. * from the AP) instead of an explicit rejection by the AP, -1 is used to
  7180. * indicate that this is a failure, but without a status code.
  7181. * @timeout_reason is used to report the reason for the timeout in that
  7182. * case.
  7183. * @gfp: allocation flags
  7184. * @timeout_reason: reason for connection timeout. This is used when the
  7185. * connection fails due to a timeout instead of an explicit rejection from
  7186. * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
  7187. * not known. This value is used only if @status < 0 to indicate that the
  7188. * failure is due to a timeout and not due to explicit rejection by the AP.
  7189. * This value is ignored in other cases (@status >= 0).
  7190. *
  7191. * It should be called by the underlying driver once execution of the connection
  7192. * request from connect() has been completed. This is similar to
  7193. * cfg80211_connect_result(), but with the option of identifying the exact bss
  7194. * entry for the connection. Only one of the functions among
  7195. * cfg80211_connect_bss(), cfg80211_connect_result(),
  7196. * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
  7197. */
  7198. static inline void
  7199. cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
  7200. struct cfg80211_bss *bss, const u8 *req_ie,
  7201. size_t req_ie_len, const u8 *resp_ie,
  7202. size_t resp_ie_len, int status, gfp_t gfp,
  7203. enum nl80211_timeout_reason timeout_reason)
  7204. {
  7205. struct cfg80211_connect_resp_params params;
  7206. memset(&params, 0, sizeof(params));
  7207. params.status = status;
  7208. params.links[0].bssid = bssid;
  7209. params.links[0].bss = bss;
  7210. params.req_ie = req_ie;
  7211. params.req_ie_len = req_ie_len;
  7212. params.resp_ie = resp_ie;
  7213. params.resp_ie_len = resp_ie_len;
  7214. params.timeout_reason = timeout_reason;
  7215. cfg80211_connect_done(dev, &params, gfp);
  7216. }
  7217. /**
  7218. * cfg80211_connect_result - notify cfg80211 of connection result
  7219. *
  7220. * @dev: network device
  7221. * @bssid: the BSSID of the AP
  7222. * @req_ie: association request IEs (maybe be %NULL)
  7223. * @req_ie_len: association request IEs length
  7224. * @resp_ie: association response IEs (may be %NULL)
  7225. * @resp_ie_len: assoc response IEs length
  7226. * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
  7227. * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
  7228. * the real status code for failures.
  7229. * @gfp: allocation flags
  7230. *
  7231. * It should be called by the underlying driver once execution of the connection
  7232. * request from connect() has been completed. This is similar to
  7233. * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
  7234. * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
  7235. * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
  7236. */
  7237. static inline void
  7238. cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
  7239. const u8 *req_ie, size_t req_ie_len,
  7240. const u8 *resp_ie, size_t resp_ie_len,
  7241. u16 status, gfp_t gfp)
  7242. {
  7243. cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
  7244. resp_ie_len, status, gfp,
  7245. NL80211_TIMEOUT_UNSPECIFIED);
  7246. }
  7247. /**
  7248. * cfg80211_connect_timeout - notify cfg80211 of connection timeout
  7249. *
  7250. * @dev: network device
  7251. * @bssid: the BSSID of the AP
  7252. * @req_ie: association request IEs (maybe be %NULL)
  7253. * @req_ie_len: association request IEs length
  7254. * @gfp: allocation flags
  7255. * @timeout_reason: reason for connection timeout.
  7256. *
  7257. * It should be called by the underlying driver whenever connect() has failed
  7258. * in a sequence where no explicit authentication/association rejection was
  7259. * received from the AP. This could happen, e.g., due to not being able to send
  7260. * out the Authentication or Association Request frame or timing out while
  7261. * waiting for the response. Only one of the functions among
  7262. * cfg80211_connect_bss(), cfg80211_connect_result(),
  7263. * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
  7264. */
  7265. static inline void
  7266. cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
  7267. const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
  7268. enum nl80211_timeout_reason timeout_reason)
  7269. {
  7270. cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
  7271. gfp, timeout_reason);
  7272. }
  7273. /**
  7274. * struct cfg80211_roam_info - driver initiated roaming information
  7275. *
  7276. * @req_ie: association request IEs (maybe be %NULL)
  7277. * @req_ie_len: association request IEs length
  7278. * @resp_ie: association response IEs (may be %NULL)
  7279. * @resp_ie_len: assoc response IEs length
  7280. * @fils: FILS related roaming information.
  7281. * @valid_links: For MLO roaming, BIT mask of the new valid links is set.
  7282. * Otherwise zero.
  7283. * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.
  7284. * @links : For MLO roaming, contains new link info for the valid links set in
  7285. * @valid_links. For non-MLO roaming, links[0] contains the new AP info.
  7286. * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.
  7287. * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO
  7288. * roaming, links[0].bssid points to the BSSID of the new AP. May be
  7289. * %NULL if %links.bss is set.
  7290. * @links.channel: the channel of the new AP.
  7291. * @links.bss: For MLO roaming, entry of new bss to which STA link got
  7292. * roamed. For non-MLO roaming, links[0].bss points to entry of bss to
  7293. * which STA got roamed (may be %NULL if %links.bssid is set)
  7294. */
  7295. struct cfg80211_roam_info {
  7296. const u8 *req_ie;
  7297. size_t req_ie_len;
  7298. const u8 *resp_ie;
  7299. size_t resp_ie_len;
  7300. struct cfg80211_fils_resp_params fils;
  7301. const u8 *ap_mld_addr;
  7302. u16 valid_links;
  7303. struct {
  7304. const u8 *addr;
  7305. const u8 *bssid;
  7306. struct ieee80211_channel *channel;
  7307. struct cfg80211_bss *bss;
  7308. } links[IEEE80211_MLD_MAX_NUM_LINKS];
  7309. };
  7310. /**
  7311. * cfg80211_roamed - notify cfg80211 of roaming
  7312. *
  7313. * @dev: network device
  7314. * @info: information about the new BSS. struct &cfg80211_roam_info.
  7315. * @gfp: allocation flags
  7316. *
  7317. * This function may be called with the driver passing either the BSSID of the
  7318. * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
  7319. * It should be called by the underlying driver whenever it roamed from one AP
  7320. * to another while connected. Drivers which have roaming implemented in
  7321. * firmware should pass the bss entry to avoid a race in bss entry timeout where
  7322. * the bss entry of the new AP is seen in the driver, but gets timed out by the
  7323. * time it is accessed in __cfg80211_roamed() due to delay in scheduling
  7324. * rdev->event_work. In case of any failures, the reference is released
  7325. * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
  7326. * released while disconnecting from the current bss.
  7327. */
  7328. void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
  7329. gfp_t gfp);
  7330. /**
  7331. * cfg80211_port_authorized - notify cfg80211 of successful security association
  7332. *
  7333. * @dev: network device
  7334. * @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address
  7335. * in case of AP/P2P GO
  7336. * @td_bitmap: transition disable policy
  7337. * @td_bitmap_len: Length of transition disable policy
  7338. * @gfp: allocation flags
  7339. *
  7340. * This function should be called by a driver that supports 4 way handshake
  7341. * offload after a security association was successfully established (i.e.,
  7342. * the 4 way handshake was completed successfully). The call to this function
  7343. * should be preceded with a call to cfg80211_connect_result(),
  7344. * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
  7345. * indicate the 802.11 association.
  7346. * This function can also be called by AP/P2P GO driver that supports
  7347. * authentication offload. In this case the peer_mac passed is that of
  7348. * associated STA/GC.
  7349. */
  7350. void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr,
  7351. const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);
  7352. /**
  7353. * cfg80211_disconnected - notify cfg80211 that connection was dropped
  7354. *
  7355. * @dev: network device
  7356. * @ie: information elements of the deauth/disassoc frame (may be %NULL)
  7357. * @ie_len: length of IEs
  7358. * @reason: reason code for the disconnection, set it to 0 if unknown
  7359. * @locally_generated: disconnection was requested locally
  7360. * @gfp: allocation flags
  7361. *
  7362. * After it calls this function, the driver should enter an idle state
  7363. * and not try to connect to any AP any more.
  7364. */
  7365. void cfg80211_disconnected(struct net_device *dev, u16 reason,
  7366. const u8 *ie, size_t ie_len,
  7367. bool locally_generated, gfp_t gfp);
  7368. /**
  7369. * cfg80211_ready_on_channel - notification of remain_on_channel start
  7370. * @wdev: wireless device
  7371. * @cookie: the request cookie
  7372. * @chan: The current channel (from remain_on_channel request)
  7373. * @duration: Duration in milliseconds that the driver intents to remain on the
  7374. * channel
  7375. * @gfp: allocation flags
  7376. */
  7377. void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
  7378. struct ieee80211_channel *chan,
  7379. unsigned int duration, gfp_t gfp);
  7380. /**
  7381. * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
  7382. * @wdev: wireless device
  7383. * @cookie: the request cookie
  7384. * @chan: The current channel (from remain_on_channel request)
  7385. * @gfp: allocation flags
  7386. */
  7387. void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
  7388. struct ieee80211_channel *chan,
  7389. gfp_t gfp);
  7390. /**
  7391. * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
  7392. * @wdev: wireless device
  7393. * @cookie: the requested cookie
  7394. * @chan: The current channel (from tx_mgmt request)
  7395. * @gfp: allocation flags
  7396. */
  7397. void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
  7398. struct ieee80211_channel *chan, gfp_t gfp);
  7399. /**
  7400. * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
  7401. *
  7402. * @sinfo: the station information
  7403. * @gfp: allocation flags
  7404. */
  7405. int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
  7406. /**
  7407. * cfg80211_sinfo_release_content - release contents of station info
  7408. * @sinfo: the station information
  7409. *
  7410. * Releases any potentially allocated sub-information of the station
  7411. * information, but not the struct itself (since it's typically on
  7412. * the stack.)
  7413. */
  7414. static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
  7415. {
  7416. kfree(sinfo->pertid);
  7417. }
  7418. /**
  7419. * cfg80211_new_sta - notify userspace about station
  7420. *
  7421. * @dev: the netdev
  7422. * @mac_addr: the station's address
  7423. * @sinfo: the station information
  7424. * @gfp: allocation flags
  7425. */
  7426. void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
  7427. struct station_info *sinfo, gfp_t gfp);
  7428. /**
  7429. * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
  7430. * @dev: the netdev
  7431. * @mac_addr: the station's address
  7432. * @sinfo: the station information/statistics
  7433. * @gfp: allocation flags
  7434. */
  7435. void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
  7436. struct station_info *sinfo, gfp_t gfp);
  7437. /**
  7438. * cfg80211_del_sta - notify userspace about deletion of a station
  7439. *
  7440. * @dev: the netdev
  7441. * @mac_addr: the station's address
  7442. * @gfp: allocation flags
  7443. */
  7444. static inline void cfg80211_del_sta(struct net_device *dev,
  7445. const u8 *mac_addr, gfp_t gfp)
  7446. {
  7447. cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
  7448. }
  7449. /**
  7450. * cfg80211_conn_failed - connection request failed notification
  7451. *
  7452. * @dev: the netdev
  7453. * @mac_addr: the station's address
  7454. * @reason: the reason for connection failure
  7455. * @gfp: allocation flags
  7456. *
  7457. * Whenever a station tries to connect to an AP and if the station
  7458. * could not connect to the AP as the AP has rejected the connection
  7459. * for some reasons, this function is called.
  7460. *
  7461. * The reason for connection failure can be any of the value from
  7462. * nl80211_connect_failed_reason enum
  7463. */
  7464. void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
  7465. enum nl80211_connect_failed_reason reason,
  7466. gfp_t gfp);
  7467. /**
  7468. * struct cfg80211_rx_info - received management frame info
  7469. *
  7470. * @freq: Frequency on which the frame was received in kHz
  7471. * @sig_dbm: signal strength in dBm, or 0 if unknown
  7472. * @have_link_id: indicates the frame was received on a link of
  7473. * an MLD, i.e. the @link_id field is valid
  7474. * @link_id: the ID of the link the frame was received on
  7475. * @buf: Management frame (header + body)
  7476. * @len: length of the frame data
  7477. * @flags: flags, as defined in enum nl80211_rxmgmt_flags
  7478. * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
  7479. * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
  7480. */
  7481. struct cfg80211_rx_info {
  7482. int freq;
  7483. int sig_dbm;
  7484. bool have_link_id;
  7485. u8 link_id;
  7486. const u8 *buf;
  7487. size_t len;
  7488. u32 flags;
  7489. u64 rx_tstamp;
  7490. u64 ack_tstamp;
  7491. };
  7492. /**
  7493. * cfg80211_rx_mgmt_ext - management frame notification with extended info
  7494. * @wdev: wireless device receiving the frame
  7495. * @info: RX info as defined in struct cfg80211_rx_info
  7496. *
  7497. * This function is called whenever an Action frame is received for a station
  7498. * mode interface, but is not processed in kernel.
  7499. *
  7500. * Return: %true if a user space application has registered for this frame.
  7501. * For action frames, that makes it responsible for rejecting unrecognized
  7502. * action frames; %false otherwise, in which case for action frames the
  7503. * driver is responsible for rejecting the frame.
  7504. */
  7505. bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,
  7506. struct cfg80211_rx_info *info);
  7507. /**
  7508. * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
  7509. * @wdev: wireless device receiving the frame
  7510. * @freq: Frequency on which the frame was received in KHz
  7511. * @sig_dbm: signal strength in dBm, or 0 if unknown
  7512. * @buf: Management frame (header + body)
  7513. * @len: length of the frame data
  7514. * @flags: flags, as defined in enum nl80211_rxmgmt_flags
  7515. *
  7516. * This function is called whenever an Action frame is received for a station
  7517. * mode interface, but is not processed in kernel.
  7518. *
  7519. * Return: %true if a user space application has registered for this frame.
  7520. * For action frames, that makes it responsible for rejecting unrecognized
  7521. * action frames; %false otherwise, in which case for action frames the
  7522. * driver is responsible for rejecting the frame.
  7523. */
  7524. static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,
  7525. int sig_dbm, const u8 *buf, size_t len,
  7526. u32 flags)
  7527. {
  7528. struct cfg80211_rx_info info = {
  7529. .freq = freq,
  7530. .sig_dbm = sig_dbm,
  7531. .buf = buf,
  7532. .len = len,
  7533. .flags = flags
  7534. };
  7535. return cfg80211_rx_mgmt_ext(wdev, &info);
  7536. }
  7537. /**
  7538. * cfg80211_rx_mgmt - notification of received, unprocessed management frame
  7539. * @wdev: wireless device receiving the frame
  7540. * @freq: Frequency on which the frame was received in MHz
  7541. * @sig_dbm: signal strength in dBm, or 0 if unknown
  7542. * @buf: Management frame (header + body)
  7543. * @len: length of the frame data
  7544. * @flags: flags, as defined in enum nl80211_rxmgmt_flags
  7545. *
  7546. * This function is called whenever an Action frame is received for a station
  7547. * mode interface, but is not processed in kernel.
  7548. *
  7549. * Return: %true if a user space application has registered for this frame.
  7550. * For action frames, that makes it responsible for rejecting unrecognized
  7551. * action frames; %false otherwise, in which case for action frames the
  7552. * driver is responsible for rejecting the frame.
  7553. */
  7554. static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
  7555. int sig_dbm, const u8 *buf, size_t len,
  7556. u32 flags)
  7557. {
  7558. struct cfg80211_rx_info info = {
  7559. .freq = MHZ_TO_KHZ(freq),
  7560. .sig_dbm = sig_dbm,
  7561. .buf = buf,
  7562. .len = len,
  7563. .flags = flags
  7564. };
  7565. return cfg80211_rx_mgmt_ext(wdev, &info);
  7566. }
  7567. /**
  7568. * struct cfg80211_tx_status - TX status for management frame information
  7569. *
  7570. * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
  7571. * @tx_tstamp: hardware TX timestamp in nanoseconds
  7572. * @ack_tstamp: hardware ack RX timestamp in nanoseconds
  7573. * @buf: Management frame (header + body)
  7574. * @len: length of the frame data
  7575. * @ack: Whether frame was acknowledged
  7576. */
  7577. struct cfg80211_tx_status {
  7578. u64 cookie;
  7579. u64 tx_tstamp;
  7580. u64 ack_tstamp;
  7581. const u8 *buf;
  7582. size_t len;
  7583. bool ack;
  7584. };
  7585. /**
  7586. * cfg80211_mgmt_tx_status_ext - TX status notification with extended info
  7587. * @wdev: wireless device receiving the frame
  7588. * @status: TX status data
  7589. * @gfp: context flags
  7590. *
  7591. * This function is called whenever a management frame was requested to be
  7592. * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
  7593. * transmission attempt with extended info.
  7594. */
  7595. void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,
  7596. struct cfg80211_tx_status *status, gfp_t gfp);
  7597. /**
  7598. * cfg80211_mgmt_tx_status - notification of TX status for management frame
  7599. * @wdev: wireless device receiving the frame
  7600. * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
  7601. * @buf: Management frame (header + body)
  7602. * @len: length of the frame data
  7603. * @ack: Whether frame was acknowledged
  7604. * @gfp: context flags
  7605. *
  7606. * This function is called whenever a management frame was requested to be
  7607. * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
  7608. * transmission attempt.
  7609. */
  7610. static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,
  7611. u64 cookie, const u8 *buf,
  7612. size_t len, bool ack, gfp_t gfp)
  7613. {
  7614. struct cfg80211_tx_status status = {
  7615. .cookie = cookie,
  7616. .buf = buf,
  7617. .len = len,
  7618. .ack = ack
  7619. };
  7620. cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);
  7621. }
  7622. /**
  7623. * cfg80211_control_port_tx_status - notification of TX status for control
  7624. * port frames
  7625. * @wdev: wireless device receiving the frame
  7626. * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
  7627. * @buf: Data frame (header + body)
  7628. * @len: length of the frame data
  7629. * @ack: Whether frame was acknowledged
  7630. * @gfp: context flags
  7631. *
  7632. * This function is called whenever a control port frame was requested to be
  7633. * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
  7634. * the transmission attempt.
  7635. */
  7636. void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
  7637. const u8 *buf, size_t len, bool ack,
  7638. gfp_t gfp);
  7639. /**
  7640. * cfg80211_rx_control_port - notification about a received control port frame
  7641. * @dev: The device the frame matched to
  7642. * @skb: The skbuf with the control port frame. It is assumed that the skbuf
  7643. * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
  7644. * This function does not take ownership of the skb, so the caller is
  7645. * responsible for any cleanup. The caller must also ensure that
  7646. * skb->protocol is set appropriately.
  7647. * @unencrypted: Whether the frame was received unencrypted
  7648. * @link_id: the link the frame was received on, -1 if not applicable or unknown
  7649. *
  7650. * This function is used to inform userspace about a received control port
  7651. * frame. It should only be used if userspace indicated it wants to receive
  7652. * control port frames over nl80211.
  7653. *
  7654. * The frame is the data portion of the 802.3 or 802.11 data frame with all
  7655. * network layer headers removed (e.g. the raw EAPoL frame).
  7656. *
  7657. * Return: %true if the frame was passed to userspace
  7658. */
  7659. bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,
  7660. bool unencrypted, int link_id);
  7661. /**
  7662. * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
  7663. * @dev: network device
  7664. * @rssi_event: the triggered RSSI event
  7665. * @rssi_level: new RSSI level value or 0 if not available
  7666. * @gfp: context flags
  7667. *
  7668. * This function is called when a configured connection quality monitoring
  7669. * rssi threshold reached event occurs.
  7670. */
  7671. void cfg80211_cqm_rssi_notify(struct net_device *dev,
  7672. enum nl80211_cqm_rssi_threshold_event rssi_event,
  7673. s32 rssi_level, gfp_t gfp);
  7674. /**
  7675. * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
  7676. * @dev: network device
  7677. * @peer: peer's MAC address
  7678. * @num_packets: how many packets were lost -- should be a fixed threshold
  7679. * but probably no less than maybe 50, or maybe a throughput dependent
  7680. * threshold (to account for temporary interference)
  7681. * @gfp: context flags
  7682. */
  7683. void cfg80211_cqm_pktloss_notify(struct net_device *dev,
  7684. const u8 *peer, u32 num_packets, gfp_t gfp);
  7685. /**
  7686. * cfg80211_cqm_txe_notify - TX error rate event
  7687. * @dev: network device
  7688. * @peer: peer's MAC address
  7689. * @num_packets: how many packets were lost
  7690. * @rate: % of packets which failed transmission
  7691. * @intvl: interval (in s) over which the TX failure threshold was breached.
  7692. * @gfp: context flags
  7693. *
  7694. * Notify userspace when configured % TX failures over number of packets in a
  7695. * given interval is exceeded.
  7696. */
  7697. void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
  7698. u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
  7699. /**
  7700. * cfg80211_cqm_beacon_loss_notify - beacon loss event
  7701. * @dev: network device
  7702. * @gfp: context flags
  7703. *
  7704. * Notify userspace about beacon loss from the connected AP.
  7705. */
  7706. void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
  7707. /**
  7708. * __cfg80211_radar_event - radar detection event
  7709. * @wiphy: the wiphy
  7710. * @chandef: chandef for the current channel
  7711. * @offchan: the radar has been detected on the offchannel chain
  7712. * @gfp: context flags
  7713. *
  7714. * This function is called when a radar is detected on the current chanenl.
  7715. */
  7716. void __cfg80211_radar_event(struct wiphy *wiphy,
  7717. struct cfg80211_chan_def *chandef,
  7718. bool offchan, gfp_t gfp);
  7719. static inline void
  7720. cfg80211_radar_event(struct wiphy *wiphy,
  7721. struct cfg80211_chan_def *chandef,
  7722. gfp_t gfp)
  7723. {
  7724. __cfg80211_radar_event(wiphy, chandef, false, gfp);
  7725. }
  7726. static inline void
  7727. cfg80211_background_radar_event(struct wiphy *wiphy,
  7728. struct cfg80211_chan_def *chandef,
  7729. gfp_t gfp)
  7730. {
  7731. __cfg80211_radar_event(wiphy, chandef, true, gfp);
  7732. }
  7733. /**
  7734. * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
  7735. * @dev: network device
  7736. * @mac: MAC address of a station which opmode got modified
  7737. * @sta_opmode: station's current opmode value
  7738. * @gfp: context flags
  7739. *
  7740. * Driver should call this function when station's opmode modified via action
  7741. * frame.
  7742. */
  7743. void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
  7744. struct sta_opmode_info *sta_opmode,
  7745. gfp_t gfp);
  7746. /**
  7747. * cfg80211_cac_event - Channel availability check (CAC) event
  7748. * @netdev: network device
  7749. * @chandef: chandef for the current channel
  7750. * @event: type of event
  7751. * @gfp: context flags
  7752. *
  7753. * This function is called when a Channel availability check (CAC) is finished
  7754. * or aborted. This must be called to notify the completion of a CAC process,
  7755. * also by full-MAC drivers.
  7756. */
  7757. void cfg80211_cac_event(struct net_device *netdev,
  7758. const struct cfg80211_chan_def *chandef,
  7759. enum nl80211_radar_event event, gfp_t gfp);
  7760. /**
  7761. * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
  7762. * @wiphy: the wiphy
  7763. *
  7764. * This function is called by the driver when a Channel Availability Check
  7765. * (CAC) is aborted by a offchannel dedicated chain.
  7766. */
  7767. void cfg80211_background_cac_abort(struct wiphy *wiphy);
  7768. /**
  7769. * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
  7770. * @dev: network device
  7771. * @bssid: BSSID of AP (to avoid races)
  7772. * @replay_ctr: new replay counter
  7773. * @gfp: allocation flags
  7774. */
  7775. void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
  7776. const u8 *replay_ctr, gfp_t gfp);
  7777. /**
  7778. * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
  7779. * @dev: network device
  7780. * @index: candidate index (the smaller the index, the higher the priority)
  7781. * @bssid: BSSID of AP
  7782. * @preauth: Whether AP advertises support for RSN pre-authentication
  7783. * @gfp: allocation flags
  7784. */
  7785. void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
  7786. const u8 *bssid, bool preauth, gfp_t gfp);
  7787. /**
  7788. * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
  7789. * @dev: The device the frame matched to
  7790. * @addr: the transmitter address
  7791. * @gfp: context flags
  7792. *
  7793. * This function is used in AP mode (only!) to inform userspace that
  7794. * a spurious class 3 frame was received, to be able to deauth the
  7795. * sender.
  7796. * Return: %true if the frame was passed to userspace (or this failed
  7797. * for a reason other than not having a subscription.)
  7798. */
  7799. bool cfg80211_rx_spurious_frame(struct net_device *dev,
  7800. const u8 *addr, gfp_t gfp);
  7801. /**
  7802. * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
  7803. * @dev: The device the frame matched to
  7804. * @addr: the transmitter address
  7805. * @gfp: context flags
  7806. *
  7807. * This function is used in AP mode (only!) to inform userspace that
  7808. * an associated station sent a 4addr frame but that wasn't expected.
  7809. * It is allowed and desirable to send this event only once for each
  7810. * station to avoid event flooding.
  7811. * Return: %true if the frame was passed to userspace (or this failed
  7812. * for a reason other than not having a subscription.)
  7813. */
  7814. bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
  7815. const u8 *addr, gfp_t gfp);
  7816. /**
  7817. * cfg80211_probe_status - notify userspace about probe status
  7818. * @dev: the device the probe was sent on
  7819. * @addr: the address of the peer
  7820. * @cookie: the cookie filled in @probe_client previously
  7821. * @acked: indicates whether probe was acked or not
  7822. * @ack_signal: signal strength (in dBm) of the ACK frame.
  7823. * @is_valid_ack_signal: indicates the ack_signal is valid or not.
  7824. * @gfp: allocation flags
  7825. */
  7826. void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
  7827. u64 cookie, bool acked, s32 ack_signal,
  7828. bool is_valid_ack_signal, gfp_t gfp);
  7829. /**
  7830. * cfg80211_report_obss_beacon_khz - report beacon from other APs
  7831. * @wiphy: The wiphy that received the beacon
  7832. * @frame: the frame
  7833. * @len: length of the frame
  7834. * @freq: frequency the frame was received on in KHz
  7835. * @sig_dbm: signal strength in dBm, or 0 if unknown
  7836. *
  7837. * Use this function to report to userspace when a beacon was
  7838. * received. It is not useful to call this when there is no
  7839. * netdev that is in AP/GO mode.
  7840. */
  7841. void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
  7842. size_t len, int freq, int sig_dbm);
  7843. /**
  7844. * cfg80211_report_obss_beacon - report beacon from other APs
  7845. * @wiphy: The wiphy that received the beacon
  7846. * @frame: the frame
  7847. * @len: length of the frame
  7848. * @freq: frequency the frame was received on
  7849. * @sig_dbm: signal strength in dBm, or 0 if unknown
  7850. *
  7851. * Use this function to report to userspace when a beacon was
  7852. * received. It is not useful to call this when there is no
  7853. * netdev that is in AP/GO mode.
  7854. */
  7855. static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
  7856. const u8 *frame, size_t len,
  7857. int freq, int sig_dbm)
  7858. {
  7859. cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
  7860. sig_dbm);
  7861. }
  7862. /**
  7863. * cfg80211_reg_can_beacon - check if beaconing is allowed
  7864. * @wiphy: the wiphy
  7865. * @chandef: the channel definition
  7866. * @iftype: interface type
  7867. *
  7868. * Return: %true if there is no secondary channel or the secondary channel(s)
  7869. * can be used for beaconing (i.e. is not a radar channel etc.)
  7870. */
  7871. bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
  7872. struct cfg80211_chan_def *chandef,
  7873. enum nl80211_iftype iftype);
  7874. /**
  7875. * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
  7876. * @wiphy: the wiphy
  7877. * @chandef: the channel definition
  7878. * @iftype: interface type
  7879. *
  7880. * Return: %true if there is no secondary channel or the secondary channel(s)
  7881. * can be used for beaconing (i.e. is not a radar channel etc.). This version
  7882. * also checks if IR-relaxation conditions apply, to allow beaconing under
  7883. * more permissive conditions.
  7884. *
  7885. * Requires the wiphy mutex to be held.
  7886. */
  7887. bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
  7888. struct cfg80211_chan_def *chandef,
  7889. enum nl80211_iftype iftype);
  7890. /*
  7891. * cfg80211_ch_switch_notify - update wdev channel and notify userspace
  7892. * @dev: the device which switched channels
  7893. * @chandef: the new channel definition
  7894. * @link_id: the link ID for MLO, must be 0 for non-MLO
  7895. * @punct_bitmap: the new puncturing bitmap
  7896. *
  7897. * Caller must acquire wdev_lock, therefore must only be called from sleepable
  7898. * driver context!
  7899. */
  7900. void cfg80211_ch_switch_notify(struct net_device *dev,
  7901. struct cfg80211_chan_def *chandef,
  7902. unsigned int link_id, u16 punct_bitmap);
  7903. /*
  7904. * cfg80211_ch_switch_started_notify - notify channel switch start
  7905. * @dev: the device on which the channel switch started
  7906. * @chandef: the future channel definition
  7907. * @link_id: the link ID for MLO, must be 0 for non-MLO
  7908. * @count: the number of TBTTs until the channel switch happens
  7909. * @quiet: whether or not immediate quiet was requested by the AP
  7910. * @punct_bitmap: the future puncturing bitmap
  7911. *
  7912. * Inform the userspace about the channel switch that has just
  7913. * started, so that it can take appropriate actions (eg. starting
  7914. * channel switch on other vifs), if necessary.
  7915. */
  7916. void cfg80211_ch_switch_started_notify(struct net_device *dev,
  7917. struct cfg80211_chan_def *chandef,
  7918. unsigned int link_id, u8 count,
  7919. bool quiet, u16 punct_bitmap);
  7920. /**
  7921. * ieee80211_operating_class_to_band - convert operating class to band
  7922. *
  7923. * @operating_class: the operating class to convert
  7924. * @band: band pointer to fill
  7925. *
  7926. * Returns %true if the conversion was successful, %false otherwise.
  7927. */
  7928. bool ieee80211_operating_class_to_band(u8 operating_class,
  7929. enum nl80211_band *band);
  7930. /**
  7931. * ieee80211_chandef_to_operating_class - convert chandef to operation class
  7932. *
  7933. * @chandef: the chandef to convert
  7934. * @op_class: a pointer to the resulting operating class
  7935. *
  7936. * Returns %true if the conversion was successful, %false otherwise.
  7937. */
  7938. bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
  7939. u8 *op_class);
  7940. /**
  7941. * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
  7942. *
  7943. * @chandef: the chandef to convert
  7944. *
  7945. * Returns the center frequency of chandef (1st segment) in KHz.
  7946. */
  7947. static inline u32
  7948. ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
  7949. {
  7950. return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
  7951. }
  7952. /*
  7953. * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
  7954. * @dev: the device on which the operation is requested
  7955. * @peer: the MAC address of the peer device
  7956. * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
  7957. * NL80211_TDLS_TEARDOWN)
  7958. * @reason_code: the reason code for teardown request
  7959. * @gfp: allocation flags
  7960. *
  7961. * This function is used to request userspace to perform TDLS operation that
  7962. * requires knowledge of keys, i.e., link setup or teardown when the AP
  7963. * connection uses encryption. This is optional mechanism for the driver to use
  7964. * if it can automatically determine when a TDLS link could be useful (e.g.,
  7965. * based on traffic and signal strength for a peer).
  7966. */
  7967. void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
  7968. enum nl80211_tdls_operation oper,
  7969. u16 reason_code, gfp_t gfp);
  7970. /*
  7971. * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
  7972. * @rate: given rate_info to calculate bitrate from
  7973. *
  7974. * return 0 if MCS index >= 32
  7975. */
  7976. u32 cfg80211_calculate_bitrate(struct rate_info *rate);
  7977. /**
  7978. * cfg80211_unregister_wdev - remove the given wdev
  7979. * @wdev: struct wireless_dev to remove
  7980. *
  7981. * This function removes the device so it can no longer be used. It is necessary
  7982. * to call this function even when cfg80211 requests the removal of the device
  7983. * by calling the del_virtual_intf() callback. The function must also be called
  7984. * when the driver wishes to unregister the wdev, e.g. when the hardware device
  7985. * is unbound from the driver.
  7986. *
  7987. * Requires the RTNL and wiphy mutex to be held.
  7988. */
  7989. void cfg80211_unregister_wdev(struct wireless_dev *wdev);
  7990. /**
  7991. * cfg80211_register_netdevice - register the given netdev
  7992. * @dev: the netdev to register
  7993. *
  7994. * Note: In contexts coming from cfg80211 callbacks, you must call this rather
  7995. * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
  7996. * held. Otherwise, both register_netdevice() and register_netdev() are usable
  7997. * instead as well.
  7998. *
  7999. * Requires the RTNL and wiphy mutex to be held.
  8000. */
  8001. int cfg80211_register_netdevice(struct net_device *dev);
  8002. /**
  8003. * cfg80211_unregister_netdevice - unregister the given netdev
  8004. * @dev: the netdev to register
  8005. *
  8006. * Note: In contexts coming from cfg80211 callbacks, you must call this rather
  8007. * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
  8008. * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
  8009. * usable instead as well.
  8010. *
  8011. * Requires the RTNL and wiphy mutex to be held.
  8012. */
  8013. static inline void cfg80211_unregister_netdevice(struct net_device *dev)
  8014. {
  8015. cfg80211_unregister_wdev(dev->ieee80211_ptr);
  8016. }
  8017. /**
  8018. * struct cfg80211_ft_event_params - FT Information Elements
  8019. * @ies: FT IEs
  8020. * @ies_len: length of the FT IE in bytes
  8021. * @target_ap: target AP's MAC address
  8022. * @ric_ies: RIC IE
  8023. * @ric_ies_len: length of the RIC IE in bytes
  8024. */
  8025. struct cfg80211_ft_event_params {
  8026. const u8 *ies;
  8027. size_t ies_len;
  8028. const u8 *target_ap;
  8029. const u8 *ric_ies;
  8030. size_t ric_ies_len;
  8031. };
  8032. /**
  8033. * cfg80211_ft_event - notify userspace about FT IE and RIC IE
  8034. * @netdev: network device
  8035. * @ft_event: IE information
  8036. */
  8037. void cfg80211_ft_event(struct net_device *netdev,
  8038. struct cfg80211_ft_event_params *ft_event);
  8039. /**
  8040. * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
  8041. * @ies: the input IE buffer
  8042. * @len: the input length
  8043. * @attr: the attribute ID to find
  8044. * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
  8045. * if the function is only called to get the needed buffer size
  8046. * @bufsize: size of the output buffer
  8047. *
  8048. * The function finds a given P2P attribute in the (vendor) IEs and
  8049. * copies its contents to the given buffer.
  8050. *
  8051. * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
  8052. * malformed or the attribute can't be found (respectively), or the
  8053. * length of the found attribute (which can be zero).
  8054. */
  8055. int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
  8056. enum ieee80211_p2p_attr_id attr,
  8057. u8 *buf, unsigned int bufsize);
  8058. /**
  8059. * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
  8060. * @ies: the IE buffer
  8061. * @ielen: the length of the IE buffer
  8062. * @ids: an array with element IDs that are allowed before
  8063. * the split. A WLAN_EID_EXTENSION value means that the next
  8064. * EID in the list is a sub-element of the EXTENSION IE.
  8065. * @n_ids: the size of the element ID array
  8066. * @after_ric: array IE types that come after the RIC element
  8067. * @n_after_ric: size of the @after_ric array
  8068. * @offset: offset where to start splitting in the buffer
  8069. *
  8070. * This function splits an IE buffer by updating the @offset
  8071. * variable to point to the location where the buffer should be
  8072. * split.
  8073. *
  8074. * It assumes that the given IE buffer is well-formed, this
  8075. * has to be guaranteed by the caller!
  8076. *
  8077. * It also assumes that the IEs in the buffer are ordered
  8078. * correctly, if not the result of using this function will not
  8079. * be ordered correctly either, i.e. it does no reordering.
  8080. *
  8081. * The function returns the offset where the next part of the
  8082. * buffer starts, which may be @ielen if the entire (remainder)
  8083. * of the buffer should be used.
  8084. */
  8085. size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
  8086. const u8 *ids, int n_ids,
  8087. const u8 *after_ric, int n_after_ric,
  8088. size_t offset);
  8089. /**
  8090. * ieee80211_ie_split - split an IE buffer according to ordering
  8091. * @ies: the IE buffer
  8092. * @ielen: the length of the IE buffer
  8093. * @ids: an array with element IDs that are allowed before
  8094. * the split. A WLAN_EID_EXTENSION value means that the next
  8095. * EID in the list is a sub-element of the EXTENSION IE.
  8096. * @n_ids: the size of the element ID array
  8097. * @offset: offset where to start splitting in the buffer
  8098. *
  8099. * This function splits an IE buffer by updating the @offset
  8100. * variable to point to the location where the buffer should be
  8101. * split.
  8102. *
  8103. * It assumes that the given IE buffer is well-formed, this
  8104. * has to be guaranteed by the caller!
  8105. *
  8106. * It also assumes that the IEs in the buffer are ordered
  8107. * correctly, if not the result of using this function will not
  8108. * be ordered correctly either, i.e. it does no reordering.
  8109. *
  8110. * The function returns the offset where the next part of the
  8111. * buffer starts, which may be @ielen if the entire (remainder)
  8112. * of the buffer should be used.
  8113. */
  8114. static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
  8115. const u8 *ids, int n_ids, size_t offset)
  8116. {
  8117. return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
  8118. }
  8119. /**
  8120. * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
  8121. * @wdev: the wireless device reporting the wakeup
  8122. * @wakeup: the wakeup report
  8123. * @gfp: allocation flags
  8124. *
  8125. * This function reports that the given device woke up. If it
  8126. * caused the wakeup, report the reason(s), otherwise you may
  8127. * pass %NULL as the @wakeup parameter to advertise that something
  8128. * else caused the wakeup.
  8129. */
  8130. void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
  8131. struct cfg80211_wowlan_wakeup *wakeup,
  8132. gfp_t gfp);
  8133. /**
  8134. * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
  8135. *
  8136. * @wdev: the wireless device for which critical protocol is stopped.
  8137. * @gfp: allocation flags
  8138. *
  8139. * This function can be called by the driver to indicate it has reverted
  8140. * operation back to normal. One reason could be that the duration given
  8141. * by .crit_proto_start() has expired.
  8142. */
  8143. void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
  8144. /**
  8145. * ieee80211_get_num_supported_channels - get number of channels device has
  8146. * @wiphy: the wiphy
  8147. *
  8148. * Return: the number of channels supported by the device.
  8149. */
  8150. unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
  8151. /**
  8152. * cfg80211_check_combinations - check interface combinations
  8153. *
  8154. * @wiphy: the wiphy
  8155. * @params: the interface combinations parameter
  8156. *
  8157. * This function can be called by the driver to check whether a
  8158. * combination of interfaces and their types are allowed according to
  8159. * the interface combinations.
  8160. */
  8161. int cfg80211_check_combinations(struct wiphy *wiphy,
  8162. struct iface_combination_params *params);
  8163. /**
  8164. * cfg80211_iter_combinations - iterate over matching combinations
  8165. *
  8166. * @wiphy: the wiphy
  8167. * @params: the interface combinations parameter
  8168. * @iter: function to call for each matching combination
  8169. * @data: pointer to pass to iter function
  8170. *
  8171. * This function can be called by the driver to check what possible
  8172. * combinations it fits in at a given moment, e.g. for channel switching
  8173. * purposes.
  8174. */
  8175. int cfg80211_iter_combinations(struct wiphy *wiphy,
  8176. struct iface_combination_params *params,
  8177. void (*iter)(const struct ieee80211_iface_combination *c,
  8178. void *data),
  8179. void *data);
  8180. /*
  8181. * cfg80211_stop_iface - trigger interface disconnection
  8182. *
  8183. * @wiphy: the wiphy
  8184. * @wdev: wireless device
  8185. * @gfp: context flags
  8186. *
  8187. * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
  8188. * disconnected.
  8189. *
  8190. * Note: This doesn't need any locks and is asynchronous.
  8191. */
  8192. void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
  8193. gfp_t gfp);
  8194. /**
  8195. * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
  8196. * @wiphy: the wiphy to shut down
  8197. *
  8198. * This function shuts down all interfaces belonging to this wiphy by
  8199. * calling dev_close() (and treating non-netdev interfaces as needed).
  8200. * It shouldn't really be used unless there are some fatal device errors
  8201. * that really can't be recovered in any other way.
  8202. *
  8203. * Callers must hold the RTNL and be able to deal with callbacks into
  8204. * the driver while the function is running.
  8205. */
  8206. void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
  8207. /**
  8208. * wiphy_ext_feature_set - set the extended feature flag
  8209. *
  8210. * @wiphy: the wiphy to modify.
  8211. * @ftidx: extended feature bit index.
  8212. *
  8213. * The extended features are flagged in multiple bytes (see
  8214. * &struct wiphy.@ext_features)
  8215. */
  8216. static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
  8217. enum nl80211_ext_feature_index ftidx)
  8218. {
  8219. u8 *ft_byte;
  8220. ft_byte = &wiphy->ext_features[ftidx / 8];
  8221. *ft_byte |= BIT(ftidx % 8);
  8222. }
  8223. /**
  8224. * wiphy_ext_feature_isset - check the extended feature flag
  8225. *
  8226. * @wiphy: the wiphy to modify.
  8227. * @ftidx: extended feature bit index.
  8228. *
  8229. * The extended features are flagged in multiple bytes (see
  8230. * &struct wiphy.@ext_features)
  8231. */
  8232. static inline bool
  8233. wiphy_ext_feature_isset(struct wiphy *wiphy,
  8234. enum nl80211_ext_feature_index ftidx)
  8235. {
  8236. u8 ft_byte;
  8237. ft_byte = wiphy->ext_features[ftidx / 8];
  8238. return (ft_byte & BIT(ftidx % 8)) != 0;
  8239. }
  8240. /**
  8241. * cfg80211_free_nan_func - free NAN function
  8242. * @f: NAN function that should be freed
  8243. *
  8244. * Frees all the NAN function and all it's allocated members.
  8245. */
  8246. void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
  8247. /**
  8248. * struct cfg80211_nan_match_params - NAN match parameters
  8249. * @type: the type of the function that triggered a match. If it is
  8250. * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
  8251. * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
  8252. * result.
  8253. * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
  8254. * @inst_id: the local instance id
  8255. * @peer_inst_id: the instance id of the peer's function
  8256. * @addr: the MAC address of the peer
  8257. * @info_len: the length of the &info
  8258. * @info: the Service Specific Info from the peer (if any)
  8259. * @cookie: unique identifier of the corresponding function
  8260. */
  8261. struct cfg80211_nan_match_params {
  8262. enum nl80211_nan_function_type type;
  8263. u8 inst_id;
  8264. u8 peer_inst_id;
  8265. const u8 *addr;
  8266. u8 info_len;
  8267. const u8 *info;
  8268. u64 cookie;
  8269. };
  8270. /**
  8271. * cfg80211_nan_match - report a match for a NAN function.
  8272. * @wdev: the wireless device reporting the match
  8273. * @match: match notification parameters
  8274. * @gfp: allocation flags
  8275. *
  8276. * This function reports that the a NAN function had a match. This
  8277. * can be a subscribe that had a match or a solicited publish that
  8278. * was sent. It can also be a follow up that was received.
  8279. */
  8280. void cfg80211_nan_match(struct wireless_dev *wdev,
  8281. struct cfg80211_nan_match_params *match, gfp_t gfp);
  8282. /**
  8283. * cfg80211_nan_func_terminated - notify about NAN function termination.
  8284. *
  8285. * @wdev: the wireless device reporting the match
  8286. * @inst_id: the local instance id
  8287. * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
  8288. * @cookie: unique NAN function identifier
  8289. * @gfp: allocation flags
  8290. *
  8291. * This function reports that the a NAN function is terminated.
  8292. */
  8293. void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
  8294. u8 inst_id,
  8295. enum nl80211_nan_func_term_reason reason,
  8296. u64 cookie, gfp_t gfp);
  8297. /* ethtool helper */
  8298. void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
  8299. /**
  8300. * cfg80211_external_auth_request - userspace request for authentication
  8301. * @netdev: network device
  8302. * @params: External authentication parameters
  8303. * @gfp: allocation flags
  8304. * Returns: 0 on success, < 0 on error
  8305. */
  8306. int cfg80211_external_auth_request(struct net_device *netdev,
  8307. struct cfg80211_external_auth_params *params,
  8308. gfp_t gfp);
  8309. /**
  8310. * cfg80211_pmsr_report - report peer measurement result data
  8311. * @wdev: the wireless device reporting the measurement
  8312. * @req: the original measurement request
  8313. * @result: the result data
  8314. * @gfp: allocation flags
  8315. */
  8316. void cfg80211_pmsr_report(struct wireless_dev *wdev,
  8317. struct cfg80211_pmsr_request *req,
  8318. struct cfg80211_pmsr_result *result,
  8319. gfp_t gfp);
  8320. /**
  8321. * cfg80211_pmsr_complete - report peer measurement completed
  8322. * @wdev: the wireless device reporting the measurement
  8323. * @req: the original measurement request
  8324. * @gfp: allocation flags
  8325. *
  8326. * Report that the entire measurement completed, after this
  8327. * the request pointer will no longer be valid.
  8328. */
  8329. void cfg80211_pmsr_complete(struct wireless_dev *wdev,
  8330. struct cfg80211_pmsr_request *req,
  8331. gfp_t gfp);
  8332. /**
  8333. * cfg80211_iftype_allowed - check whether the interface can be allowed
  8334. * @wiphy: the wiphy
  8335. * @iftype: interface type
  8336. * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
  8337. * @check_swif: check iftype against software interfaces
  8338. *
  8339. * Check whether the interface is allowed to operate; additionally, this API
  8340. * can be used to check iftype against the software interfaces when
  8341. * check_swif is '1'.
  8342. */
  8343. bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
  8344. bool is_4addr, u8 check_swif);
  8345. /**
  8346. * cfg80211_assoc_comeback - notification of association that was
  8347. * temporarly rejected with a comeback
  8348. * @netdev: network device
  8349. * @ap_addr: AP (MLD) address that rejected the assocation
  8350. * @timeout: timeout interval value TUs.
  8351. *
  8352. * this function may sleep. the caller must hold the corresponding wdev's mutex.
  8353. */
  8354. void cfg80211_assoc_comeback(struct net_device *netdev,
  8355. const u8 *ap_addr, u32 timeout);
  8356. /* Logging, debugging and troubleshooting/diagnostic helpers. */
  8357. /* wiphy_printk helpers, similar to dev_printk */
  8358. #define wiphy_printk(level, wiphy, format, args...) \
  8359. dev_printk(level, &(wiphy)->dev, format, ##args)
  8360. #define wiphy_emerg(wiphy, format, args...) \
  8361. dev_emerg(&(wiphy)->dev, format, ##args)
  8362. #define wiphy_alert(wiphy, format, args...) \
  8363. dev_alert(&(wiphy)->dev, format, ##args)
  8364. #define wiphy_crit(wiphy, format, args...) \
  8365. dev_crit(&(wiphy)->dev, format, ##args)
  8366. #define wiphy_err(wiphy, format, args...) \
  8367. dev_err(&(wiphy)->dev, format, ##args)
  8368. #define wiphy_warn(wiphy, format, args...) \
  8369. dev_warn(&(wiphy)->dev, format, ##args)
  8370. #define wiphy_notice(wiphy, format, args...) \
  8371. dev_notice(&(wiphy)->dev, format, ##args)
  8372. #define wiphy_info(wiphy, format, args...) \
  8373. dev_info(&(wiphy)->dev, format, ##args)
  8374. #define wiphy_info_once(wiphy, format, args...) \
  8375. dev_info_once(&(wiphy)->dev, format, ##args)
  8376. #define wiphy_err_ratelimited(wiphy, format, args...) \
  8377. dev_err_ratelimited(&(wiphy)->dev, format, ##args)
  8378. #define wiphy_warn_ratelimited(wiphy, format, args...) \
  8379. dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
  8380. #define wiphy_debug(wiphy, format, args...) \
  8381. wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
  8382. #define wiphy_dbg(wiphy, format, args...) \
  8383. dev_dbg(&(wiphy)->dev, format, ##args)
  8384. #if defined(VERBOSE_DEBUG)
  8385. #define wiphy_vdbg wiphy_dbg
  8386. #else
  8387. #define wiphy_vdbg(wiphy, format, args...) \
  8388. ({ \
  8389. if (0) \
  8390. wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
  8391. 0; \
  8392. })
  8393. #endif
  8394. /*
  8395. * wiphy_WARN() acts like wiphy_printk(), but with the key difference
  8396. * of using a WARN/WARN_ON to get the message out, including the
  8397. * file/line information and a backtrace.
  8398. */
  8399. #define wiphy_WARN(wiphy, format, args...) \
  8400. WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
  8401. /**
  8402. * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
  8403. * @netdev: network device
  8404. * @owe_info: peer's owe info
  8405. * @gfp: allocation flags
  8406. */
  8407. void cfg80211_update_owe_info_event(struct net_device *netdev,
  8408. struct cfg80211_update_owe_info *owe_info,
  8409. gfp_t gfp);
  8410. /**
  8411. * cfg80211_bss_flush - resets all the scan entries
  8412. * @wiphy: the wiphy
  8413. */
  8414. void cfg80211_bss_flush(struct wiphy *wiphy);
  8415. /**
  8416. * cfg80211_bss_color_notify - notify about bss color event
  8417. * @dev: network device
  8418. * @gfp: allocation flags
  8419. * @cmd: the actual event we want to notify
  8420. * @count: the number of TBTTs until the color change happens
  8421. * @color_bitmap: representations of the colors that the local BSS is aware of
  8422. */
  8423. int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp,
  8424. enum nl80211_commands cmd, u8 count,
  8425. u64 color_bitmap);
  8426. /**
  8427. * cfg80211_obss_color_collision_notify - notify about bss color collision
  8428. * @dev: network device
  8429. * @color_bitmap: representations of the colors that the local BSS is aware of
  8430. * @gfp: allocation flags
  8431. */
  8432. static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
  8433. u64 color_bitmap, gfp_t gfp)
  8434. {
  8435. return cfg80211_bss_color_notify(dev, gfp,
  8436. NL80211_CMD_OBSS_COLOR_COLLISION,
  8437. 0, color_bitmap);
  8438. }
  8439. /**
  8440. * cfg80211_color_change_started_notify - notify color change start
  8441. * @dev: the device on which the color is switched
  8442. * @count: the number of TBTTs until the color change happens
  8443. *
  8444. * Inform the userspace about the color change that has started.
  8445. */
  8446. static inline int cfg80211_color_change_started_notify(struct net_device *dev,
  8447. u8 count)
  8448. {
  8449. return cfg80211_bss_color_notify(dev, GFP_KERNEL,
  8450. NL80211_CMD_COLOR_CHANGE_STARTED,
  8451. count, 0);
  8452. }
  8453. /**
  8454. * cfg80211_color_change_aborted_notify - notify color change abort
  8455. * @dev: the device on which the color is switched
  8456. *
  8457. * Inform the userspace about the color change that has aborted.
  8458. */
  8459. static inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
  8460. {
  8461. return cfg80211_bss_color_notify(dev, GFP_KERNEL,
  8462. NL80211_CMD_COLOR_CHANGE_ABORTED,
  8463. 0, 0);
  8464. }
  8465. /**
  8466. * cfg80211_color_change_notify - notify color change completion
  8467. * @dev: the device on which the color was switched
  8468. *
  8469. * Inform the userspace about the color change that has completed.
  8470. */
  8471. static inline int cfg80211_color_change_notify(struct net_device *dev)
  8472. {
  8473. return cfg80211_bss_color_notify(dev, GFP_KERNEL,
  8474. NL80211_CMD_COLOR_CHANGE_COMPLETED,
  8475. 0, 0);
  8476. }
  8477. /**
  8478. * cfg80211_valid_disable_subchannel_bitmap - validate puncturing bitmap
  8479. * @bitmap: bitmap to be validated
  8480. * @chandef: channel definition
  8481. *
  8482. * Validate the puncturing bitmap.
  8483. *
  8484. * Return: %true if the bitmap is valid. %false otherwise.
  8485. */
  8486. bool cfg80211_valid_disable_subchannel_bitmap(u16 *bitmap,
  8487. const struct cfg80211_chan_def *chandef);
  8488. #endif /* __NET_CFG80211_H */