mac80211.h 310 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * mac80211 <-> driver interface
  4. *
  5. * Copyright 2002-2005, Devicescape Software, Inc.
  6. * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  7. * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
  8. * Copyright 2013-2014 Intel Mobile Communications GmbH
  9. * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
  10. * Copyright (C) 2018 - 2026 Intel Corporation
  11. */
  12. #ifndef MAC80211_H
  13. #define MAC80211_H
  14. #include <linux/bug.h>
  15. #include <linux/kernel.h>
  16. #include <linux/if_ether.h>
  17. #include <linux/skbuff.h>
  18. #include <linux/ieee80211.h>
  19. #include <linux/lockdep.h>
  20. #include <net/cfg80211.h>
  21. #include <net/codel.h>
  22. #include <net/ieee80211_radiotap.h>
  23. #include <linux/unaligned.h>
  24. /**
  25. * DOC: Introduction
  26. *
  27. * mac80211 is the Linux stack for 802.11 hardware that implements
  28. * only partial functionality in hard- or firmware. This document
  29. * defines the interface between mac80211 and low-level hardware
  30. * drivers.
  31. */
  32. /**
  33. * DOC: Calling mac80211 from interrupts
  34. *
  35. * Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be
  36. * called in hardware interrupt context. The low-level driver must not call any
  37. * other functions in hardware interrupt context. If there is a need for such
  38. * call, the low-level driver should first ACK the interrupt and perform the
  39. * IEEE 802.11 code call after this, e.g. from a scheduled workqueue or even
  40. * tasklet function.
  41. *
  42. * NOTE: If the driver opts to use the _irqsafe() functions, it may not also
  43. * use the non-IRQ-safe functions!
  44. */
  45. /**
  46. * DOC: Warning
  47. *
  48. * If you're reading this document and not the header file itself, it will
  49. * be incomplete because not all documentation has been converted yet.
  50. */
  51. /**
  52. * DOC: Frame format
  53. *
  54. * As a general rule, when frames are passed between mac80211 and the driver,
  55. * they start with the IEEE 802.11 header and include the same octets that are
  56. * sent over the air except for the FCS which should be calculated by the
  57. * hardware.
  58. *
  59. * There are, however, various exceptions to this rule for advanced features:
  60. *
  61. * The first exception is for hardware encryption and decryption offload
  62. * where the IV/ICV may or may not be generated in hardware.
  63. *
  64. * Secondly, when the hardware handles fragmentation, the frame handed to
  65. * the driver from mac80211 is the MSDU, not the MPDU.
  66. */
  67. /**
  68. * DOC: mac80211 workqueue
  69. *
  70. * mac80211 provides its own workqueue for drivers and internal mac80211 use.
  71. * The workqueue is a single threaded workqueue and can only be accessed by
  72. * helpers for sanity checking. Drivers must ensure all work added onto the
  73. * mac80211 workqueue should be cancelled on the driver stop() callback.
  74. *
  75. * mac80211 will flush the workqueue upon interface removal and during
  76. * suspend.
  77. *
  78. * All work performed on the mac80211 workqueue must not acquire the RTNL lock.
  79. *
  80. */
  81. /**
  82. * DOC: mac80211 software tx queueing
  83. *
  84. * mac80211 uses an intermediate queueing implementation, designed to allow the
  85. * driver to keep hardware queues short and to provide some fairness between
  86. * different stations/interfaces.
  87. *
  88. * Drivers must provide the .wake_tx_queue driver operation by either
  89. * linking it to ieee80211_handle_wake_tx_queue() or implementing a custom
  90. * handler.
  91. *
  92. * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with
  93. * another per-sta for non-data/non-mgmt and bufferable management frames, and
  94. * a single per-vif queue for multicast data frames.
  95. *
  96. * The driver is expected to initialize its private per-queue data for stations
  97. * and interfaces in the .add_interface and .sta_add ops.
  98. *
  99. * The driver can't access the internal TX queues (iTXQs) directly.
  100. * Whenever mac80211 adds a new frame to a queue, it calls the .wake_tx_queue
  101. * driver op.
  102. * Drivers implementing a custom .wake_tx_queue op can get them by calling
  103. * ieee80211_tx_dequeue(). Drivers using ieee80211_handle_wake_tx_queue() will
  104. * simply get the individual frames pushed via the .tx driver operation.
  105. *
  106. * Drivers can optionally delegate responsibility for scheduling queues to
  107. * mac80211, to take advantage of airtime fairness accounting. In this case, to
  108. * obtain the next queue to pull frames from, the driver calls
  109. * ieee80211_next_txq(). The driver is then expected to return the txq using
  110. * ieee80211_return_txq().
  111. *
  112. * For AP powersave TIM handling, the driver only needs to indicate if it has
  113. * buffered packets in the driver specific data structures by calling
  114. * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
  115. * struct, mac80211 sets the appropriate TIM PVB bits and calls
  116. * .release_buffered_frames().
  117. * In that callback the driver is therefore expected to release its own
  118. * buffered frames and afterwards also frames from the ieee80211_txq (obtained
  119. * via the usual ieee80211_tx_dequeue).
  120. */
  121. /**
  122. * DOC: HW timestamping
  123. *
  124. * Timing Measurement and Fine Timing Measurement require accurate timestamps
  125. * of the action frames TX/RX and their respective acks.
  126. *
  127. * To report hardware timestamps for Timing Measurement or Fine Timing
  128. * Measurement frame RX, the low level driver should set the SKB's hwtstamp
  129. * field to the frame RX timestamp and report the ack TX timestamp in the
  130. * ieee80211_rx_status struct.
  131. *
  132. * Similarly, to report hardware timestamps for Timing Measurement or Fine
  133. * Timing Measurement frame TX, the driver should set the SKB's hwtstamp field
  134. * to the frame TX timestamp and report the ack RX timestamp in the
  135. * ieee80211_tx_status struct.
  136. */
  137. struct device;
  138. /**
  139. * enum ieee80211_max_queues - maximum number of queues
  140. *
  141. * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
  142. * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set
  143. */
  144. enum ieee80211_max_queues {
  145. IEEE80211_MAX_QUEUES = 16,
  146. IEEE80211_MAX_QUEUE_MAP = BIT(IEEE80211_MAX_QUEUES) - 1,
  147. };
  148. #define IEEE80211_INVAL_HW_QUEUE 0xff
  149. /**
  150. * enum ieee80211_ac_numbers - AC numbers as used in mac80211
  151. * @IEEE80211_AC_VO: voice
  152. * @IEEE80211_AC_VI: video
  153. * @IEEE80211_AC_BE: best effort
  154. * @IEEE80211_AC_BK: background
  155. */
  156. enum ieee80211_ac_numbers {
  157. IEEE80211_AC_VO = 0,
  158. IEEE80211_AC_VI = 1,
  159. IEEE80211_AC_BE = 2,
  160. IEEE80211_AC_BK = 3,
  161. };
  162. /**
  163. * struct ieee80211_tx_queue_params - transmit queue configuration
  164. *
  165. * The information provided in this structure is required for QoS
  166. * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
  167. *
  168. * @aifs: arbitration interframe space [0..255]
  169. * @cw_min: minimum contention window [a value of the form
  170. * 2^n-1 in the range 1..32767]
  171. * @cw_max: maximum contention window [like @cw_min]
  172. * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
  173. * @acm: is mandatory admission control required for the access category
  174. * @uapsd: is U-APSD mode enabled for the queue
  175. * @mu_edca: is the MU EDCA configured
  176. * @mu_edca_param_rec: MU EDCA Parameter Record for HE
  177. */
  178. struct ieee80211_tx_queue_params {
  179. u16 txop;
  180. u16 cw_min;
  181. u16 cw_max;
  182. u8 aifs;
  183. bool acm;
  184. bool uapsd;
  185. bool mu_edca;
  186. struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec;
  187. };
  188. struct ieee80211_low_level_stats {
  189. unsigned int dot11ACKFailureCount;
  190. unsigned int dot11RTSFailureCount;
  191. unsigned int dot11FCSErrorCount;
  192. unsigned int dot11RTSSuccessCount;
  193. };
  194. /**
  195. * enum ieee80211_chanctx_change - change flag for channel context
  196. * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed
  197. * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed
  198. * @IEEE80211_CHANCTX_CHANGE_RADAR: radar detection flag changed
  199. * @IEEE80211_CHANCTX_CHANGE_CHANNEL: switched to another operating channel,
  200. * this is used only with channel switching with CSA
  201. * @IEEE80211_CHANCTX_CHANGE_MIN_DEF: The min chandef changed
  202. * @IEEE80211_CHANCTX_CHANGE_AP: The AP channel definition changed, so (wider
  203. * bandwidth) OFDMA settings need to be changed
  204. * @IEEE80211_CHANCTX_CHANGE_PUNCTURING: The punctured channel(s) bitmap
  205. * was changed.
  206. */
  207. enum ieee80211_chanctx_change {
  208. IEEE80211_CHANCTX_CHANGE_WIDTH = BIT(0),
  209. IEEE80211_CHANCTX_CHANGE_RX_CHAINS = BIT(1),
  210. IEEE80211_CHANCTX_CHANGE_RADAR = BIT(2),
  211. IEEE80211_CHANCTX_CHANGE_CHANNEL = BIT(3),
  212. IEEE80211_CHANCTX_CHANGE_MIN_DEF = BIT(4),
  213. IEEE80211_CHANCTX_CHANGE_AP = BIT(5),
  214. IEEE80211_CHANCTX_CHANGE_PUNCTURING = BIT(6),
  215. };
  216. /**
  217. * struct ieee80211_chan_req - A channel "request"
  218. * @oper: channel definition to use for operation
  219. * @ap: the channel definition of the AP, if any
  220. * (otherwise the chan member is %NULL)
  221. */
  222. struct ieee80211_chan_req {
  223. struct cfg80211_chan_def oper;
  224. struct cfg80211_chan_def ap;
  225. };
  226. /**
  227. * struct ieee80211_chanctx_conf - channel context that vifs may be tuned to
  228. *
  229. * This is the driver-visible part. The ieee80211_chanctx
  230. * that contains it is visible in mac80211 only.
  231. *
  232. * @def: the channel definition
  233. * @min_def: the minimum channel definition currently required.
  234. * @ap: the channel definition the AP actually is operating as,
  235. * for use with (wider bandwidth) OFDMA
  236. * @radio_idx: index of the wiphy radio used used for this channel
  237. * @rx_chains_static: The number of RX chains that must always be
  238. * active on the channel to receive MIMO transmissions
  239. * @rx_chains_dynamic: The number of RX chains that must be enabled
  240. * after RTS/CTS handshake to receive SMPS MIMO transmissions;
  241. * this will always be >= @rx_chains_static.
  242. * @radar_enabled: whether radar detection is enabled on this channel.
  243. * @drv_priv: data area for driver use, will always be aligned to
  244. * sizeof(void *), size is determined in hw information.
  245. */
  246. struct ieee80211_chanctx_conf {
  247. struct cfg80211_chan_def def;
  248. struct cfg80211_chan_def min_def;
  249. struct cfg80211_chan_def ap;
  250. int radio_idx;
  251. u8 rx_chains_static, rx_chains_dynamic;
  252. bool radar_enabled;
  253. u8 drv_priv[] __aligned(sizeof(void *));
  254. };
  255. /**
  256. * enum ieee80211_chanctx_switch_mode - channel context switch mode
  257. * @CHANCTX_SWMODE_REASSIGN_VIF: Both old and new contexts already
  258. * exist (and will continue to exist), but the virtual interface
  259. * needs to be switched from one to the other.
  260. * @CHANCTX_SWMODE_SWAP_CONTEXTS: The old context exists but will stop
  261. * to exist with this call, the new context doesn't exist but
  262. * will be active after this call, the virtual interface switches
  263. * from the old to the new (note that the driver may of course
  264. * implement this as an on-the-fly chandef switch of the existing
  265. * hardware context, but the mac80211 pointer for the old context
  266. * will cease to exist and only the new one will later be used
  267. * for changes/removal.)
  268. */
  269. enum ieee80211_chanctx_switch_mode {
  270. CHANCTX_SWMODE_REASSIGN_VIF,
  271. CHANCTX_SWMODE_SWAP_CONTEXTS,
  272. };
  273. /**
  274. * struct ieee80211_vif_chanctx_switch - vif chanctx switch information
  275. *
  276. * This is structure is used to pass information about a vif that
  277. * needs to switch from one chanctx to another. The
  278. * &ieee80211_chanctx_switch_mode defines how the switch should be
  279. * done.
  280. *
  281. * @vif: the vif that should be switched from old_ctx to new_ctx
  282. * @link_conf: the link conf that's switching
  283. * @old_ctx: the old context to which the vif was assigned
  284. * @new_ctx: the new context to which the vif must be assigned
  285. */
  286. struct ieee80211_vif_chanctx_switch {
  287. struct ieee80211_vif *vif;
  288. struct ieee80211_bss_conf *link_conf;
  289. struct ieee80211_chanctx_conf *old_ctx;
  290. struct ieee80211_chanctx_conf *new_ctx;
  291. };
  292. /**
  293. * enum ieee80211_bss_change - BSS change notification flags
  294. *
  295. * These flags are used with the bss_info_changed(), link_info_changed()
  296. * and vif_cfg_changed() callbacks to indicate which parameter(s) changed.
  297. *
  298. * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated),
  299. * also implies a change in the AID.
  300. * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed
  301. * @BSS_CHANGED_ERP_PREAMBLE: preamble changed
  302. * @BSS_CHANGED_ERP_SLOT: slot timing changed
  303. * @BSS_CHANGED_HT: 802.11n parameters changed
  304. * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
  305. * @BSS_CHANGED_BEACON_INT: Beacon interval changed
  306. * @BSS_CHANGED_BSSID: BSSID changed, for whatever
  307. * reason (IBSS and managed mode)
  308. * @BSS_CHANGED_BEACON: Beacon data changed, retrieve
  309. * new beacon (beaconing modes)
  310. * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
  311. * enabled/disabled (beaconing modes)
  312. * @BSS_CHANGED_CQM: Connection quality monitor config changed
  313. * @BSS_CHANGED_IBSS: IBSS join status changed
  314. * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed.
  315. * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note
  316. * that it is only ever disabled for station mode.
  317. * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
  318. * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode)
  319. * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
  320. * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
  321. * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
  322. * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
  323. * changed
  324. * @BSS_CHANGED_BEACON_INFO: Data from the AP's beacon became available:
  325. * currently dtim_period only is under consideration.
  326. * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed,
  327. * note that this is only called when it changes after the channel
  328. * context had been assigned.
  329. * @BSS_CHANGED_OCB: OCB join status changed
  330. * @BSS_CHANGED_MU_GROUPS: VHT MU-MIMO group id or user position changed
  331. * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected
  332. * keep alive) changed.
  333. * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface
  334. * @BSS_CHANGED_FTM_RESPONDER: fine timing measurement request responder
  335. * functionality changed for this BSS (AP mode).
  336. * @BSS_CHANGED_TWT: TWT status changed
  337. * @BSS_CHANGED_HE_OBSS_PD: OBSS Packet Detection status changed.
  338. * @BSS_CHANGED_HE_BSS_COLOR: BSS Color has changed
  339. * @BSS_CHANGED_FILS_DISCOVERY: FILS discovery status changed.
  340. * @BSS_CHANGED_UNSOL_BCAST_PROBE_RESP: Unsolicited broadcast probe response
  341. * status changed.
  342. * @BSS_CHANGED_MLD_VALID_LINKS: MLD valid links status changed.
  343. * @BSS_CHANGED_MLD_TTLM: negotiated TID to link mapping was changed
  344. * @BSS_CHANGED_TPE: transmit power envelope changed
  345. */
  346. enum ieee80211_bss_change {
  347. BSS_CHANGED_ASSOC = 1<<0,
  348. BSS_CHANGED_ERP_CTS_PROT = 1<<1,
  349. BSS_CHANGED_ERP_PREAMBLE = 1<<2,
  350. BSS_CHANGED_ERP_SLOT = 1<<3,
  351. BSS_CHANGED_HT = 1<<4,
  352. BSS_CHANGED_BASIC_RATES = 1<<5,
  353. BSS_CHANGED_BEACON_INT = 1<<6,
  354. BSS_CHANGED_BSSID = 1<<7,
  355. BSS_CHANGED_BEACON = 1<<8,
  356. BSS_CHANGED_BEACON_ENABLED = 1<<9,
  357. BSS_CHANGED_CQM = 1<<10,
  358. BSS_CHANGED_IBSS = 1<<11,
  359. BSS_CHANGED_ARP_FILTER = 1<<12,
  360. BSS_CHANGED_QOS = 1<<13,
  361. BSS_CHANGED_IDLE = 1<<14,
  362. BSS_CHANGED_SSID = 1<<15,
  363. BSS_CHANGED_AP_PROBE_RESP = 1<<16,
  364. BSS_CHANGED_PS = 1<<17,
  365. BSS_CHANGED_TXPOWER = 1<<18,
  366. BSS_CHANGED_P2P_PS = 1<<19,
  367. BSS_CHANGED_BEACON_INFO = 1<<20,
  368. BSS_CHANGED_BANDWIDTH = 1<<21,
  369. BSS_CHANGED_OCB = 1<<22,
  370. BSS_CHANGED_MU_GROUPS = 1<<23,
  371. BSS_CHANGED_KEEP_ALIVE = 1<<24,
  372. BSS_CHANGED_MCAST_RATE = 1<<25,
  373. BSS_CHANGED_FTM_RESPONDER = 1<<26,
  374. BSS_CHANGED_TWT = 1<<27,
  375. BSS_CHANGED_HE_OBSS_PD = 1<<28,
  376. BSS_CHANGED_HE_BSS_COLOR = 1<<29,
  377. BSS_CHANGED_FILS_DISCOVERY = 1<<30,
  378. BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = BIT_ULL(31),
  379. BSS_CHANGED_MLD_VALID_LINKS = BIT_ULL(33),
  380. BSS_CHANGED_MLD_TTLM = BIT_ULL(34),
  381. BSS_CHANGED_TPE = BIT_ULL(35),
  382. /* when adding here, make sure to change ieee80211_reconfig */
  383. };
  384. /*
  385. * The maximum number of IPv4 addresses listed for ARP filtering. If the number
  386. * of addresses for an interface increase beyond this value, hardware ARP
  387. * filtering will be disabled.
  388. */
  389. #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
  390. /**
  391. * enum ieee80211_event_type - event to be notified to the low level driver
  392. * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver.
  393. * @MLME_EVENT: event related to MLME
  394. * @BAR_RX_EVENT: a BAR was received
  395. * @BA_FRAME_TIMEOUT: Frames were released from the reordering buffer because
  396. * they timed out. This won't be called for each frame released, but only
  397. * once each time the timeout triggers.
  398. */
  399. enum ieee80211_event_type {
  400. RSSI_EVENT,
  401. MLME_EVENT,
  402. BAR_RX_EVENT,
  403. BA_FRAME_TIMEOUT,
  404. };
  405. /**
  406. * enum ieee80211_rssi_event_data - relevant when event type is %RSSI_EVENT
  407. * @RSSI_EVENT_HIGH: AP's rssi went below the threshold set by the driver.
  408. * @RSSI_EVENT_LOW: AP's rssi went above the threshold set by the driver.
  409. */
  410. enum ieee80211_rssi_event_data {
  411. RSSI_EVENT_HIGH,
  412. RSSI_EVENT_LOW,
  413. };
  414. /**
  415. * struct ieee80211_rssi_event - data attached to an %RSSI_EVENT
  416. * @data: See &enum ieee80211_rssi_event_data
  417. */
  418. struct ieee80211_rssi_event {
  419. enum ieee80211_rssi_event_data data;
  420. };
  421. /**
  422. * enum ieee80211_mlme_event_data - relevant when event type is %MLME_EVENT
  423. * @AUTH_EVENT: the MLME operation is authentication
  424. * @ASSOC_EVENT: the MLME operation is association
  425. * @DEAUTH_RX_EVENT: deauth received..
  426. * @DEAUTH_TX_EVENT: deauth sent.
  427. */
  428. enum ieee80211_mlme_event_data {
  429. AUTH_EVENT,
  430. ASSOC_EVENT,
  431. DEAUTH_RX_EVENT,
  432. DEAUTH_TX_EVENT,
  433. };
  434. /**
  435. * enum ieee80211_mlme_event_status - relevant when event type is %MLME_EVENT
  436. * @MLME_SUCCESS: the MLME operation completed successfully.
  437. * @MLME_DENIED: the MLME operation was denied by the peer.
  438. * @MLME_TIMEOUT: the MLME operation timed out.
  439. */
  440. enum ieee80211_mlme_event_status {
  441. MLME_SUCCESS,
  442. MLME_DENIED,
  443. MLME_TIMEOUT,
  444. };
  445. /**
  446. * struct ieee80211_mlme_event - data attached to an %MLME_EVENT
  447. * @data: See &enum ieee80211_mlme_event_data
  448. * @status: See &enum ieee80211_mlme_event_status
  449. * @reason: the reason code if applicable
  450. */
  451. struct ieee80211_mlme_event {
  452. enum ieee80211_mlme_event_data data;
  453. enum ieee80211_mlme_event_status status;
  454. u16 reason;
  455. };
  456. /**
  457. * struct ieee80211_ba_event - data attached for BlockAck related events
  458. * @sta: pointer to the &ieee80211_sta to which this event relates
  459. * @tid: the tid
  460. * @ssn: the starting sequence number (for %BAR_RX_EVENT)
  461. */
  462. struct ieee80211_ba_event {
  463. struct ieee80211_sta *sta;
  464. u16 tid;
  465. u16 ssn;
  466. };
  467. /**
  468. * struct ieee80211_event - event to be sent to the driver
  469. * @type: The event itself. See &enum ieee80211_event_type.
  470. * @u.rssi: relevant if &type is %RSSI_EVENT
  471. * @u.mlme: relevant if &type is %AUTH_EVENT
  472. * @u.ba: relevant if &type is %BAR_RX_EVENT or %BA_FRAME_TIMEOUT
  473. * @u:union holding the fields above
  474. */
  475. struct ieee80211_event {
  476. enum ieee80211_event_type type;
  477. union {
  478. struct ieee80211_rssi_event rssi;
  479. struct ieee80211_mlme_event mlme;
  480. struct ieee80211_ba_event ba;
  481. } u;
  482. };
  483. /**
  484. * struct ieee80211_mu_group_data - STA's VHT MU-MIMO group data
  485. *
  486. * This structure describes the group id data of VHT MU-MIMO
  487. *
  488. * @membership: 64 bits array - a bit is set if station is member of the group
  489. * @position: 2 bits per group id indicating the position in the group
  490. */
  491. struct ieee80211_mu_group_data {
  492. u8 membership[WLAN_MEMBERSHIP_LEN];
  493. u8 position[WLAN_USER_POSITION_LEN];
  494. };
  495. /**
  496. * struct ieee80211_ftm_responder_params - FTM responder parameters
  497. *
  498. * @lci: LCI subelement content
  499. * @civicloc: CIVIC location subelement content
  500. * @lci_len: LCI data length
  501. * @civicloc_len: Civic data length
  502. */
  503. struct ieee80211_ftm_responder_params {
  504. const u8 *lci;
  505. const u8 *civicloc;
  506. size_t lci_len;
  507. size_t civicloc_len;
  508. };
  509. /**
  510. * struct ieee80211_fils_discovery - FILS discovery parameters from
  511. * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
  512. *
  513. * @min_interval: Minimum packet interval in TUs (0 - 10000)
  514. * @max_interval: Maximum packet interval in TUs (0 - 10000)
  515. */
  516. struct ieee80211_fils_discovery {
  517. u32 min_interval;
  518. u32 max_interval;
  519. };
  520. #define IEEE80211_TPE_EIRP_ENTRIES_320MHZ 5
  521. struct ieee80211_parsed_tpe_eirp {
  522. bool valid;
  523. s8 power[IEEE80211_TPE_EIRP_ENTRIES_320MHZ];
  524. u8 count;
  525. };
  526. #define IEEE80211_TPE_PSD_ENTRIES_320MHZ 16
  527. struct ieee80211_parsed_tpe_psd {
  528. bool valid;
  529. s8 power[IEEE80211_TPE_PSD_ENTRIES_320MHZ];
  530. u8 count, n;
  531. };
  532. /**
  533. * struct ieee80211_parsed_tpe - parsed transmit power envelope information
  534. * @max_local: maximum local EIRP, one value for 20, 40, 80, 160, 320 MHz each
  535. * (indexed by TX power category)
  536. * @max_reg_client: maximum regulatory client EIRP, one value for 20, 40, 80,
  537. * 160, 320 MHz each
  538. * (indexed by TX power category)
  539. * @psd_local: maximum local power spectral density, one value for each 20 MHz
  540. * subchannel per bss_conf's chanreq.oper
  541. * (indexed by TX power category)
  542. * @psd_reg_client: maximum regulatory power spectral density, one value for
  543. * each 20 MHz subchannel per bss_conf's chanreq.oper
  544. * (indexed by TX power category)
  545. */
  546. struct ieee80211_parsed_tpe {
  547. struct ieee80211_parsed_tpe_eirp max_local[2], max_reg_client[2];
  548. struct ieee80211_parsed_tpe_psd psd_local[2], psd_reg_client[2];
  549. };
  550. /**
  551. * struct ieee80211_bss_conf - holds the BSS's changing parameters
  552. *
  553. * This structure keeps information about a BSS (and an association
  554. * to that BSS) that can change during the lifetime of the BSS.
  555. *
  556. * @vif: reference to owning VIF
  557. * @bss: the cfg80211 bss descriptor. Valid only for a station, and only
  558. * when associated. Note: This contains information which is not
  559. * necessarily authenticated. For example, information coming from probe
  560. * responses.
  561. * @addr: (link) address used locally
  562. * @link_id: link ID, or 0 for non-MLO
  563. * @htc_trig_based_pkt_ext: default PE in 4us units, if BSS supports HE
  564. * @uora_exists: is the UORA element advertised by AP
  565. * @uora_ocw_range: UORA element's OCW Range field
  566. * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
  567. * @he_support: does this BSS support HE
  568. * @twt_requester: does this BSS support TWT requester (relevant for managed
  569. * mode only, set if the AP advertises TWT responder role)
  570. * @twt_responder: does this BSS support TWT requester (relevant for managed
  571. * mode only, set if the AP advertises TWT responder role)
  572. * @twt_protected: does this BSS support protected TWT frames
  573. * @twt_broadcast: does this BSS support broadcast TWT
  574. * @use_cts_prot: use CTS protection
  575. * @use_short_preamble: use 802.11b short preamble
  576. * @use_short_slot: use short slot time (only relevant for ERP)
  577. * @dtim_period: num of beacons before the next DTIM, for beaconing,
  578. * valid in station mode only if after the driver was notified
  579. * with the %BSS_CHANGED_BEACON_INFO flag, will be non-zero then.
  580. * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old
  581. * as it may have been received during scanning long ago). If the
  582. * HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can
  583. * only come from a beacon, but might not become valid until after
  584. * association when a beacon is received (which is notified with the
  585. * %BSS_CHANGED_DTIM flag.). See also sync_dtim_count important notice.
  586. * @sync_device_ts: the device timestamp corresponding to the sync_tsf,
  587. * the driver/device can use this to calculate synchronisation
  588. * (see @sync_tsf). See also sync_dtim_count important notice.
  589. * @sync_dtim_count: Only valid when %IEEE80211_HW_TIMING_BEACON_ONLY
  590. * is requested, see @sync_tsf/@sync_device_ts.
  591. * IMPORTANT: These three sync_* parameters would possibly be out of sync
  592. * by the time the driver will use them. The synchronized view is currently
  593. * guaranteed only in certain callbacks.
  594. * Note also that this is not used with MLD associations, mac80211 doesn't
  595. * know how to track beacons for all of the links for this.
  596. * @beacon_int: beacon interval
  597. * @assoc_capability: capabilities taken from assoc resp
  598. * @basic_rates: bitmap of basic rates, each bit stands for an
  599. * index into the rate table configured by the driver in
  600. * the current band.
  601. * @beacon_rate: associated AP's beacon TX rate
  602. * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
  603. * @bssid: The BSSID for this BSS
  604. * @enable_beacon: whether beaconing should be enabled or not
  605. * @chanreq: Channel request for this BSS -- the hardware might be
  606. * configured a higher bandwidth than this BSS uses, for example.
  607. * @mu_group: VHT MU-MIMO group membership data
  608. * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
  609. * This field is only valid when the channel is a wide HT/VHT channel.
  610. * Note that with TDLS this can be the case (channel is HT, protection must
  611. * be used from this field) even when the BSS association isn't using HT.
  612. * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
  613. * implies disabled. As with the cfg80211 callback, a change here should
  614. * cause an event to be sent indicating where the current value is in
  615. * relation to the newly configured threshold.
  616. * @cqm_rssi_low: Connection quality monitor RSSI lower threshold, a zero value
  617. * implies disabled. This is an alternative mechanism to the single
  618. * threshold event and can't be enabled simultaneously with it.
  619. * @cqm_rssi_high: Connection quality monitor RSSI upper threshold.
  620. * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
  621. * @qos: This is a QoS-enabled BSS.
  622. * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
  623. * @txpower: TX power in dBm. INT_MIN means not configured.
  624. * @txpower_type: TX power adjustment used to control per packet Transmit
  625. * Power Control (TPC) in lower driver for the current vif. In particular
  626. * TPC is enabled if value passed in %txpower_type is
  627. * NL80211_TX_POWER_LIMITED (allow using less than specified from
  628. * userspace), whereas TPC is disabled if %txpower_type is set to
  629. * NL80211_TX_POWER_FIXED (use value configured from userspace)
  630. * @p2p_noa_attr: P2P NoA attribute for P2P powersave
  631. * @allow_p2p_go_ps: indication for AP or P2P GO interface, whether it's allowed
  632. * to use P2P PS mechanism or not. AP/P2P GO is not allowed to use P2P PS
  633. * if it has associated clients without P2P PS support.
  634. * @max_idle_period: the time period during which the station can refrain from
  635. * transmitting frames to its associated AP without being disassociated.
  636. * In units of 1000 TUs. Zero value indicates that the AP did not include
  637. * a (valid) BSS Max Idle Period Element.
  638. * @protected_keep_alive: if set, indicates that the station should send an RSN
  639. * protected frame to the AP to reset the idle timer at the AP for the
  640. * station.
  641. * @ftm_responder: whether to enable or disable fine timing measurement FTM
  642. * responder functionality.
  643. * @ftmr_params: configurable lci/civic parameter when enabling FTM responder.
  644. * @nontransmitted: this BSS is a nontransmitted BSS profile
  645. * @tx_bss_conf: Pointer to the BSS configuration of transmitting interface
  646. * if MBSSID is enabled. This pointer is RCU-protected due to CSA finish
  647. * and BSS color change flows accessing it.
  648. * @transmitter_bssid: the address of transmitter AP
  649. * @bssid_index: index inside the multiple BSSID set
  650. * @bssid_indicator: 2^bssid_indicator is the maximum number of APs in set
  651. * @ema_ap: AP supports enhancements of discovery and advertisement of
  652. * nontransmitted BSSIDs
  653. * @profile_periodicity: the least number of beacon frames need to be received
  654. * in order to discover all the nontransmitted BSSIDs in the set.
  655. * @he_oper: HE operation information of the BSS (AP/Mesh) or of the AP we are
  656. * connected to (STA)
  657. * @he_obss_pd: OBSS Packet Detection parameters.
  658. * @he_bss_color: BSS coloring settings, if BSS supports HE
  659. * @fils_discovery: FILS discovery configuration
  660. * @unsol_bcast_probe_resp_interval: Unsolicited broadcast probe response
  661. * interval.
  662. * @beacon_tx_rate: The configured beacon transmit rate that needs to be passed
  663. * to driver when rate control is offloaded to firmware.
  664. * @power_type: power type of BSS for 6 GHz
  665. * @tpe: transmit power envelope information
  666. * @pwr_reduction: power constraint of BSS.
  667. * @eht_support: does this BSS support EHT
  668. * @epcs_support: does this BSS support EPCS
  669. * @uhr_support: does this BSS support UHR
  670. * @csa_active: marks whether a channel switch is going on.
  671. * @mu_mimo_owner: indicates interface owns MU-MIMO capability
  672. * @chanctx_conf: The channel context this interface is assigned to, or %NULL
  673. * when it is not assigned. This pointer is RCU-protected due to the TX
  674. * path needing to access it; even though the netdev carrier will always
  675. * be off when it is %NULL there can still be races and packets could be
  676. * processed after it switches back to %NULL.
  677. * @color_change_active: marks whether a color change is ongoing.
  678. * @color_change_color: the bss color that will be used after the change.
  679. * @ht_ldpc: in AP mode, indicates interface has HT LDPC capability.
  680. * @vht_ldpc: in AP mode, indicates interface has VHT LDPC capability.
  681. * @he_ldpc: in AP mode, indicates interface has HE LDPC capability.
  682. * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU
  683. * beamformer
  684. * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU
  685. * beamformee
  686. * @vht_mu_beamformer: in AP mode, does this BSS support operation as an VHT MU
  687. * beamformer
  688. * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU
  689. * beamformee
  690. * @he_su_beamformer: in AP-mode, does this BSS support operation as an HE SU
  691. * beamformer
  692. * @he_su_beamformee: in AP-mode, does this BSS support operation as an HE SU
  693. * beamformee
  694. * @he_mu_beamformer: in AP-mode, does this BSS support operation as an HE MU
  695. * beamformer
  696. * @he_full_ul_mumimo: does this BSS support the reception (AP) or transmission
  697. * (non-AP STA) of an HE TB PPDU on an RU that spans the entire PPDU
  698. * bandwidth
  699. * @eht_su_beamformer: in AP-mode, does this BSS enable operation as an EHT SU
  700. * beamformer
  701. * @eht_su_beamformee: in AP-mode, does this BSS enable operation as an EHT SU
  702. * beamformee
  703. * @eht_mu_beamformer: in AP-mode, does this BSS enable operation as an EHT MU
  704. * beamformer
  705. * @eht_80mhz_full_bw_ul_mumimo: in AP-mode, does this BSS support the
  706. * reception of an EHT TB PPDU on an RU that spans the entire PPDU
  707. * bandwidth
  708. * @eht_disable_mcs15: disable EHT-MCS 15 reception capability.
  709. * @bss_param_ch_cnt: in BSS-mode, the BSS params change count. This
  710. * information is the latest known value. It can come from this link's
  711. * beacon or from a beacon sent by another link.
  712. * @bss_param_ch_cnt_link_id: in BSS-mode, the link_id to which the beacon
  713. * that updated &bss_param_ch_cnt belongs. E.g. if link 1 doesn't hear
  714. * its beacons, and link 2 sent a beacon with an RNR element that updated
  715. * link 1's BSS params change count, then, link 1's
  716. * bss_param_ch_cnt_link_id will be 2. That means that link 1 knows that
  717. * link 2 was the link that updated its bss_param_ch_cnt value.
  718. * In case link 1 hears its beacon again, bss_param_ch_cnt_link_id will
  719. * be updated to 1, even if bss_param_ch_cnt didn't change. This allows
  720. * the link to know that it heard the latest value from its own beacon
  721. * (as opposed to hearing its value from another link's beacon).
  722. * @s1g_long_beacon_period: number of beacon intervals between each long
  723. * beacon transmission.
  724. */
  725. struct ieee80211_bss_conf {
  726. struct ieee80211_vif *vif;
  727. struct cfg80211_bss *bss;
  728. const u8 *bssid;
  729. unsigned int link_id;
  730. u8 addr[ETH_ALEN] __aligned(2);
  731. u8 htc_trig_based_pkt_ext;
  732. bool uora_exists;
  733. u8 uora_ocw_range;
  734. u16 frame_time_rts_th;
  735. bool he_support;
  736. bool twt_requester;
  737. bool twt_responder;
  738. bool twt_protected;
  739. bool twt_broadcast;
  740. /* erp related data */
  741. bool use_cts_prot;
  742. bool use_short_preamble;
  743. bool use_short_slot;
  744. bool enable_beacon;
  745. u8 dtim_period;
  746. u16 beacon_int;
  747. u16 assoc_capability;
  748. u64 sync_tsf;
  749. u32 sync_device_ts;
  750. u8 sync_dtim_count;
  751. u32 basic_rates;
  752. struct ieee80211_rate *beacon_rate;
  753. int mcast_rate[NUM_NL80211_BANDS];
  754. u16 ht_operation_mode;
  755. s32 cqm_rssi_thold;
  756. u32 cqm_rssi_hyst;
  757. s32 cqm_rssi_low;
  758. s32 cqm_rssi_high;
  759. struct ieee80211_chan_req chanreq;
  760. struct ieee80211_mu_group_data mu_group;
  761. bool qos;
  762. bool hidden_ssid;
  763. int txpower;
  764. enum nl80211_tx_power_setting txpower_type;
  765. struct ieee80211_p2p_noa_attr p2p_noa_attr;
  766. bool allow_p2p_go_ps;
  767. u16 max_idle_period;
  768. bool protected_keep_alive;
  769. bool ftm_responder;
  770. struct ieee80211_ftm_responder_params *ftmr_params;
  771. /* Multiple BSSID data */
  772. bool nontransmitted;
  773. struct ieee80211_bss_conf __rcu *tx_bss_conf;
  774. u8 transmitter_bssid[ETH_ALEN];
  775. u8 bssid_index;
  776. u8 bssid_indicator;
  777. bool ema_ap;
  778. u8 profile_periodicity;
  779. struct {
  780. u32 params;
  781. u16 nss_set;
  782. } he_oper;
  783. struct ieee80211_he_obss_pd he_obss_pd;
  784. struct cfg80211_he_bss_color he_bss_color;
  785. struct ieee80211_fils_discovery fils_discovery;
  786. u32 unsol_bcast_probe_resp_interval;
  787. struct cfg80211_bitrate_mask beacon_tx_rate;
  788. enum ieee80211_ap_reg_power power_type;
  789. struct ieee80211_parsed_tpe tpe;
  790. u8 pwr_reduction;
  791. bool eht_support;
  792. bool epcs_support;
  793. bool uhr_support;
  794. bool csa_active;
  795. bool mu_mimo_owner;
  796. struct ieee80211_chanctx_conf __rcu *chanctx_conf;
  797. bool color_change_active;
  798. u8 color_change_color;
  799. bool ht_ldpc;
  800. bool vht_ldpc;
  801. bool he_ldpc;
  802. bool vht_su_beamformer;
  803. bool vht_su_beamformee;
  804. bool vht_mu_beamformer;
  805. bool vht_mu_beamformee;
  806. bool he_su_beamformer;
  807. bool he_su_beamformee;
  808. bool he_mu_beamformer;
  809. bool he_full_ul_mumimo;
  810. bool eht_su_beamformer;
  811. bool eht_su_beamformee;
  812. bool eht_mu_beamformer;
  813. bool eht_80mhz_full_bw_ul_mumimo;
  814. bool eht_disable_mcs15;
  815. u8 bss_param_ch_cnt;
  816. u8 bss_param_ch_cnt_link_id;
  817. u8 s1g_long_beacon_period;
  818. };
  819. /**
  820. * enum mac80211_tx_info_flags - flags to describe transmission information/status
  821. *
  822. * These flags are used with the @flags member of &ieee80211_tx_info.
  823. *
  824. * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
  825. * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
  826. * number to this frame, taking care of not overwriting the fragment
  827. * number and increasing the sequence number only when the
  828. * IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly
  829. * assign sequence numbers to QoS-data frames but cannot do so correctly
  830. * for non-QoS-data and management frames because beacons need them from
  831. * that counter as well and mac80211 cannot guarantee proper sequencing.
  832. * If this flag is set, the driver should instruct the hardware to
  833. * assign a sequence number to the frame or assign one itself. Cf. IEEE
  834. * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
  835. * beacons and always be clear for frames without a sequence number field.
  836. * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
  837. * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
  838. * station
  839. * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
  840. * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
  841. * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
  842. * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
  843. * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
  844. * because the destination STA was in powersave mode. Note that to
  845. * avoid race conditions, the filter must be set by the hardware or
  846. * firmware upon receiving a frame that indicates that the station
  847. * went to sleep (must be done on device to filter frames already on
  848. * the queue) and may only be unset after mac80211 gives the OK for
  849. * that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above),
  850. * since only then is it guaranteed that no more frames are in the
  851. * hardware queue.
  852. * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
  853. * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
  854. * is for the whole aggregation.
  855. * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned,
  856. * so consider using block ack request (BAR).
  857. * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
  858. * set by rate control algorithms to indicate probe rate, will
  859. * be cleared for fragmented frames (except on the last fragment)
  860. * @IEEE80211_TX_INTFL_OFFCHAN_TX_OK: Internal to mac80211. Used to indicate
  861. * that a frame can be transmitted while the queues are stopped for
  862. * off-channel operation.
  863. * @IEEE80211_TX_CTL_HW_80211_ENCAP: This frame uses hardware encapsulation
  864. * (header conversion)
  865. * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
  866. * used to indicate that a frame was already retried due to PS
  867. * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
  868. * used to indicate frame should not be encrypted
  869. * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
  870. * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
  871. * be sent although the station is in powersave mode.
  872. * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
  873. * transmit function after the current frame, this can be used
  874. * by drivers to kick the DMA queue only if unset or when the
  875. * queue gets full.
  876. * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted
  877. * after TX status because the destination was asleep, it must not
  878. * be modified again (no seqno assignment, crypto, etc.)
  879. * @IEEE80211_TX_INTFL_MLME_CONN_TX: This frame was transmitted by the MLME
  880. * code for connection establishment, this indicates that its status
  881. * should kick the MLME state machine.
  882. * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
  883. * MLME command (internal to mac80211 to figure out whether to send TX
  884. * status to user space)
  885. * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame
  886. * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this
  887. * frame and selects the maximum number of streams that it can use.
  888. * @IEEE80211_TX_CTL_TX_OFFCHAN: Marks this packet to be transmitted on
  889. * the off-channel channel when a remain-on-channel offload is done
  890. * in hardware -- normal packets still flow and are expected to be
  891. * handled properly by the device.
  892. * @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP
  893. * testing. It will be sent out with incorrect Michael MIC key to allow
  894. * TKIP countermeasures to be tested.
  895. * @IEEE80211_TX_CTL_NO_CCK_RATE: This frame will be sent at non CCK rate.
  896. * This flag is actually used for management frame especially for P2P
  897. * frames not being sent at CCK rate in 2GHz band.
  898. * @IEEE80211_TX_STATUS_EOSP: This packet marks the end of service period,
  899. * when its status is reported the service period ends. For frames in
  900. * an SP that mac80211 transmits, it is already set; for driver frames
  901. * the driver may set this flag. It is also used to do the same for
  902. * PS-Poll responses.
  903. * @IEEE80211_TX_CTL_USE_MINRATE: This frame will be sent at lowest rate.
  904. * This flag is used to send nullfunc frame at minimum rate when
  905. * the nullfunc is used for connection monitoring purpose.
  906. * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it
  907. * would be fragmented by size (this is optional, only used for
  908. * monitor injection).
  909. * @IEEE80211_TX_STAT_NOACK_TRANSMITTED: A frame that was marked with
  910. * IEEE80211_TX_CTL_NO_ACK has been successfully transmitted without
  911. * any errors (like issues specific to the driver/HW).
  912. * This flag must not be set for frames that don't request no-ack
  913. * behaviour with IEEE80211_TX_CTL_NO_ACK.
  914. *
  915. * Note: If you have to add new flags to the enumeration, then don't
  916. * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
  917. */
  918. enum mac80211_tx_info_flags {
  919. IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
  920. IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1),
  921. IEEE80211_TX_CTL_NO_ACK = BIT(2),
  922. IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(3),
  923. IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(4),
  924. IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(5),
  925. IEEE80211_TX_CTL_AMPDU = BIT(6),
  926. IEEE80211_TX_CTL_INJECTED = BIT(7),
  927. IEEE80211_TX_STAT_TX_FILTERED = BIT(8),
  928. IEEE80211_TX_STAT_ACK = BIT(9),
  929. IEEE80211_TX_STAT_AMPDU = BIT(10),
  930. IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
  931. IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
  932. IEEE80211_TX_INTFL_OFFCHAN_TX_OK = BIT(13),
  933. IEEE80211_TX_CTL_HW_80211_ENCAP = BIT(14),
  934. IEEE80211_TX_INTFL_RETRIED = BIT(15),
  935. IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
  936. IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
  937. IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
  938. IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
  939. IEEE80211_TX_INTFL_MLME_CONN_TX = BIT(20),
  940. IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
  941. IEEE80211_TX_CTL_LDPC = BIT(22),
  942. IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
  943. IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25),
  944. IEEE80211_TX_INTFL_TKIP_MIC_FAILURE = BIT(26),
  945. IEEE80211_TX_CTL_NO_CCK_RATE = BIT(27),
  946. IEEE80211_TX_STATUS_EOSP = BIT(28),
  947. IEEE80211_TX_CTL_USE_MINRATE = BIT(29),
  948. IEEE80211_TX_CTL_DONTFRAG = BIT(30),
  949. IEEE80211_TX_STAT_NOACK_TRANSMITTED = BIT(31),
  950. };
  951. #define IEEE80211_TX_CTL_STBC_SHIFT 23
  952. #define IEEE80211_TX_RC_S1G_MCS IEEE80211_TX_RC_VHT_MCS
  953. /**
  954. * enum mac80211_tx_control_flags - flags to describe transmit control
  955. *
  956. * @IEEE80211_TX_CTRL_PORT_CTRL_PROTO: this frame is a port control
  957. * protocol frame (e.g. EAP)
  958. * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  959. * frame (PS-Poll or uAPSD).
  960. * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  961. * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  962. * @IEEE80211_TX_CTRL_FAST_XMIT: This frame is going through the fast_xmit path
  963. * @IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP: This frame skips mesh path lookup
  964. * @IEEE80211_TX_INTCFL_NEED_TXPROCESSING: completely internal to mac80211,
  965. * used to indicate that a pending frame requires TX processing before
  966. * it can be sent out.
  967. * @IEEE80211_TX_CTRL_NO_SEQNO: Do not overwrite the sequence number that
  968. * has already been assigned to this frame.
  969. * @IEEE80211_TX_CTRL_DONT_REORDER: This frame should not be reordered
  970. * relative to other frames that have this flag set, independent
  971. * of their QoS TID or other priority field values.
  972. * @IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX: first MLO TX, used mostly internally
  973. * for sequence number assignment
  974. * @IEEE80211_TX_CTRL_DONT_USE_RATE_MASK: Don't use rate mask for this frame
  975. * which is transmitted due to scanning or offchannel TX, not in normal
  976. * operation on the interface.
  977. * @IEEE80211_TX_CTRL_MLO_LINK: If not @IEEE80211_LINK_UNSPECIFIED, this
  978. * frame should be transmitted on the specific link. This really is
  979. * only relevant for frames that do not have data present, and is
  980. * also not used for 802.3 format frames. Note that even if the frame
  981. * is on a specific link, address translation might still apply if
  982. * it's intended for an MLD.
  983. *
  984. * These flags are used in tx_info->control.flags.
  985. */
  986. enum mac80211_tx_control_flags {
  987. IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  988. IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  989. IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  990. IEEE80211_TX_CTRL_AMSDU = BIT(3),
  991. IEEE80211_TX_CTRL_FAST_XMIT = BIT(4),
  992. IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP = BIT(5),
  993. IEEE80211_TX_INTCFL_NEED_TXPROCESSING = BIT(6),
  994. IEEE80211_TX_CTRL_NO_SEQNO = BIT(7),
  995. IEEE80211_TX_CTRL_DONT_REORDER = BIT(8),
  996. IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX = BIT(9),
  997. IEEE80211_TX_CTRL_DONT_USE_RATE_MASK = BIT(10),
  998. IEEE80211_TX_CTRL_MLO_LINK = 0xf0000000,
  999. };
  1000. #define IEEE80211_LINK_UNSPECIFIED 0xf
  1001. #define IEEE80211_TX_CTRL_MLO_LINK_UNSPEC \
  1002. u32_encode_bits(IEEE80211_LINK_UNSPECIFIED, \
  1003. IEEE80211_TX_CTRL_MLO_LINK)
  1004. /**
  1005. * enum mac80211_tx_status_flags - flags to describe transmit status
  1006. *
  1007. * @IEEE80211_TX_STATUS_ACK_SIGNAL_VALID: ACK signal is valid
  1008. *
  1009. * These flags are used in tx_info->status.flags.
  1010. */
  1011. enum mac80211_tx_status_flags {
  1012. IEEE80211_TX_STATUS_ACK_SIGNAL_VALID = BIT(0),
  1013. };
  1014. /*
  1015. * This definition is used as a mask to clear all temporary flags, which are
  1016. * set by the tx handlers for each transmission attempt by the mac80211 stack.
  1017. */
  1018. #define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK | \
  1019. IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT | \
  1020. IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
  1021. IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
  1022. IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
  1023. IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
  1024. IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
  1025. IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
  1026. /**
  1027. * enum mac80211_rate_control_flags - per-rate flags set by the
  1028. * Rate Control algorithm.
  1029. *
  1030. * These flags are set by the Rate control algorithm for each rate during tx,
  1031. * in the @flags member of struct ieee80211_tx_rate.
  1032. *
  1033. * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
  1034. * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
  1035. * This is set if the current BSS requires ERP protection.
  1036. * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
  1037. * @IEEE80211_TX_RC_MCS: HT rate.
  1038. * @IEEE80211_TX_RC_VHT_MCS: VHT MCS rate, in this case the idx field is split
  1039. * into a higher 4 bits (Nss) and lower 4 bits (MCS number)
  1040. * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
  1041. * Greenfield mode.
  1042. * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
  1043. * @IEEE80211_TX_RC_80_MHZ_WIDTH: Indicates 80 MHz transmission
  1044. * @IEEE80211_TX_RC_160_MHZ_WIDTH: Indicates 160 MHz transmission
  1045. * (80+80 isn't supported yet)
  1046. * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
  1047. * adjacent 20 MHz channels, if the current channel type is
  1048. * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
  1049. * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
  1050. */
  1051. enum mac80211_rate_control_flags {
  1052. IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
  1053. IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
  1054. IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
  1055. /* rate index is an HT/VHT MCS instead of an index */
  1056. IEEE80211_TX_RC_MCS = BIT(3),
  1057. IEEE80211_TX_RC_GREEN_FIELD = BIT(4),
  1058. IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5),
  1059. IEEE80211_TX_RC_DUP_DATA = BIT(6),
  1060. IEEE80211_TX_RC_SHORT_GI = BIT(7),
  1061. IEEE80211_TX_RC_VHT_MCS = BIT(8),
  1062. IEEE80211_TX_RC_80_MHZ_WIDTH = BIT(9),
  1063. IEEE80211_TX_RC_160_MHZ_WIDTH = BIT(10),
  1064. };
  1065. /* there are 40 bytes if you don't need the rateset to be kept */
  1066. #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
  1067. /* if you do need the rateset, then you have less space */
  1068. #define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
  1069. /* maximum number of rate stages */
  1070. #define IEEE80211_TX_MAX_RATES 4
  1071. /* maximum number of rate table entries */
  1072. #define IEEE80211_TX_RATE_TABLE_SIZE 4
  1073. /**
  1074. * struct ieee80211_tx_rate - rate selection/status
  1075. *
  1076. * @idx: rate index to attempt to send with
  1077. * @flags: rate control flags (&enum mac80211_rate_control_flags)
  1078. * @count: number of tries in this rate before going to the next rate
  1079. *
  1080. * A value of -1 for @idx indicates an invalid rate and, if used
  1081. * in an array of retry rates, that no more rates should be tried.
  1082. *
  1083. * When used for transmit status reporting, the driver should
  1084. * always report the rate along with the flags it used.
  1085. *
  1086. * &struct ieee80211_tx_info contains an array of these structs
  1087. * in the control information, and it will be filled by the rate
  1088. * control algorithm according to what should be sent. For example,
  1089. * if this array contains, in the format { <idx>, <count> } the
  1090. * information::
  1091. *
  1092. * { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
  1093. *
  1094. * then this means that the frame should be transmitted
  1095. * up to twice at rate 3, up to twice at rate 2, and up to four
  1096. * times at rate 1 if it doesn't get acknowledged. Say it gets
  1097. * acknowledged by the peer after the fifth attempt, the status
  1098. * information should then contain::
  1099. *
  1100. * { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
  1101. *
  1102. * since it was transmitted twice at rate 3, twice at rate 2
  1103. * and once at rate 1 after which we received an acknowledgement.
  1104. */
  1105. struct ieee80211_tx_rate {
  1106. s8 idx;
  1107. u16 count:5,
  1108. flags:11;
  1109. } __packed;
  1110. #define IEEE80211_MAX_TX_RETRY 31
  1111. static inline bool ieee80211_rate_valid(struct ieee80211_tx_rate *rate)
  1112. {
  1113. return rate->idx >= 0 && rate->count > 0;
  1114. }
  1115. static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
  1116. u8 mcs, u8 nss)
  1117. {
  1118. WARN_ON(mcs & ~0xF);
  1119. WARN_ON((nss - 1) & ~0x7);
  1120. rate->idx = ((nss - 1) << 4) | mcs;
  1121. }
  1122. static inline u8
  1123. ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate)
  1124. {
  1125. return rate->idx & 0xF;
  1126. }
  1127. static inline u8
  1128. ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)
  1129. {
  1130. return (rate->idx >> 4) + 1;
  1131. }
  1132. /**
  1133. * struct ieee80211_tx_info - skb transmit information
  1134. *
  1135. * This structure is placed in skb->cb for three uses:
  1136. * (1) mac80211 TX control - mac80211 tells the driver what to do
  1137. * (2) driver internal use (if applicable)
  1138. * (3) TX status information - driver tells mac80211 what happened
  1139. *
  1140. * @flags: transmit info flags, defined above
  1141. * @band: the band to transmit on (use e.g. for checking for races),
  1142. * not valid if the interface is an MLD since we won't know which
  1143. * link the frame will be transmitted on
  1144. * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
  1145. * @status_data: internal data for TX status handling, assigned privately,
  1146. * see also &enum ieee80211_status_data for the internal documentation
  1147. * @status_data_idr: indicates status data is IDR allocated ID for ack frame
  1148. * @tx_time_est: TX time estimate in units of 4us, used internally
  1149. * @control: union part for control data
  1150. * @control.rates: TX rates array to try
  1151. * @control.rts_cts_rate_idx: rate for RTS or CTS
  1152. * @control.use_rts: use RTS
  1153. * @control.use_cts_prot: use RTS/CTS
  1154. * @control.short_preamble: use short preamble (CCK only)
  1155. * @control.skip_table: skip externally configured rate table
  1156. * @control.jiffies: timestamp for expiry on powersave clients
  1157. * @control.vif: virtual interface (may be NULL)
  1158. * @control.hw_key: key to encrypt with (may be NULL)
  1159. * @control.flags: control flags, see &enum mac80211_tx_control_flags
  1160. * @control.enqueue_time: enqueue time (for iTXQs)
  1161. * @driver_rates: alias to @control.rates to reserve space
  1162. * @pad: padding
  1163. * @rate_driver_data: driver use area if driver needs @control.rates
  1164. * @status: union part for status data
  1165. * @status.rates: attempted rates
  1166. * @status.ack_signal: ACK signal
  1167. * @status.ampdu_ack_len: AMPDU ack length
  1168. * @status.ampdu_len: AMPDU length
  1169. * @status.antenna: (legacy, kept only for iwlegacy)
  1170. * @status.tx_time: airtime consumed for transmission; note this is only
  1171. * used for WMM AC, not for airtime fairness
  1172. * @status.flags: status flags, see &enum mac80211_tx_status_flags
  1173. * @status.status_driver_data: driver use area
  1174. * @ack: union part for pure ACK data
  1175. * @ack.cookie: cookie for the ACK
  1176. * @driver_data: array of driver_data pointers
  1177. */
  1178. struct ieee80211_tx_info {
  1179. /* common information */
  1180. u32 flags;
  1181. u32 band:3,
  1182. status_data_idr:1,
  1183. status_data:13,
  1184. hw_queue:4,
  1185. tx_time_est:10;
  1186. /* 1 free bit */
  1187. union {
  1188. struct {
  1189. union {
  1190. /* rate control */
  1191. struct {
  1192. struct ieee80211_tx_rate rates[
  1193. IEEE80211_TX_MAX_RATES];
  1194. s8 rts_cts_rate_idx;
  1195. u8 use_rts:1;
  1196. u8 use_cts_prot:1;
  1197. u8 short_preamble:1;
  1198. u8 skip_table:1;
  1199. /* for injection only (bitmap) */
  1200. u8 antennas:2;
  1201. /* 14 bits free */
  1202. };
  1203. /* only needed before rate control */
  1204. unsigned long jiffies;
  1205. };
  1206. /* NB: vif can be NULL for injected frames */
  1207. struct ieee80211_vif *vif;
  1208. struct ieee80211_key_conf *hw_key;
  1209. u32 flags;
  1210. codel_time_t enqueue_time;
  1211. } control;
  1212. struct {
  1213. u64 cookie;
  1214. } ack;
  1215. struct {
  1216. struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
  1217. s32 ack_signal;
  1218. u8 ampdu_ack_len;
  1219. u8 ampdu_len;
  1220. u8 antenna;
  1221. u8 pad;
  1222. u16 tx_time;
  1223. u8 flags;
  1224. u8 pad2;
  1225. void *status_driver_data[16 / sizeof(void *)];
  1226. } status;
  1227. struct {
  1228. struct ieee80211_tx_rate driver_rates[
  1229. IEEE80211_TX_MAX_RATES];
  1230. u8 pad[4];
  1231. void *rate_driver_data[
  1232. IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
  1233. };
  1234. void *driver_data[
  1235. IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
  1236. };
  1237. };
  1238. static inline u16
  1239. ieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u16 tx_time_est)
  1240. {
  1241. /* We only have 10 bits in tx_time_est, so store airtime
  1242. * in increments of 4us and clamp the maximum to 2**12-1
  1243. */
  1244. info->tx_time_est = min_t(u16, tx_time_est, 4095) >> 2;
  1245. return info->tx_time_est << 2;
  1246. }
  1247. static inline u16
  1248. ieee80211_info_get_tx_time_est(struct ieee80211_tx_info *info)
  1249. {
  1250. return info->tx_time_est << 2;
  1251. }
  1252. /***
  1253. * struct ieee80211_rate_status - mrr stage for status path
  1254. *
  1255. * This struct is used in struct ieee80211_tx_status to provide drivers a
  1256. * dynamic way to report about used rates and power levels per packet.
  1257. *
  1258. * @rate_idx The actual used rate.
  1259. * @try_count How often the rate was tried.
  1260. * @tx_power_idx An idx into the ieee80211_hw->tx_power_levels list of the
  1261. * corresponding wifi hardware. The idx shall point to the power level
  1262. * that was used when sending the packet.
  1263. */
  1264. struct ieee80211_rate_status {
  1265. struct rate_info rate_idx;
  1266. u8 try_count;
  1267. u8 tx_power_idx;
  1268. };
  1269. /**
  1270. * struct ieee80211_tx_status - extended tx status info for rate control
  1271. *
  1272. * @sta: Station that the packet was transmitted for
  1273. * @info: Basic tx status information
  1274. * @skb: Packet skb (can be NULL if not provided by the driver)
  1275. * @rates: Mrr stages that were used when sending the packet
  1276. * @n_rates: Number of mrr stages (count of instances for @rates)
  1277. * @free_list: list where processed skbs are stored to be free'd by the driver
  1278. * @ack_hwtstamp: Hardware timestamp of the received ack in nanoseconds
  1279. * Only needed for Timing measurement and Fine timing measurement action
  1280. * frames. Only reported by devices that have timestamping enabled.
  1281. */
  1282. struct ieee80211_tx_status {
  1283. struct ieee80211_sta *sta;
  1284. struct ieee80211_tx_info *info;
  1285. struct sk_buff *skb;
  1286. struct ieee80211_rate_status *rates;
  1287. ktime_t ack_hwtstamp;
  1288. u8 n_rates;
  1289. struct list_head *free_list;
  1290. };
  1291. /**
  1292. * struct ieee80211_scan_ies - descriptors for different blocks of IEs
  1293. *
  1294. * This structure is used to point to different blocks of IEs in HW scan
  1295. * and scheduled scan. These blocks contain the IEs passed by userspace
  1296. * and the ones generated by mac80211.
  1297. *
  1298. * @ies: pointers to band specific IEs.
  1299. * @len: lengths of band_specific IEs.
  1300. * @common_ies: IEs for all bands (especially vendor specific ones)
  1301. * @common_ie_len: length of the common_ies
  1302. */
  1303. struct ieee80211_scan_ies {
  1304. const u8 *ies[NUM_NL80211_BANDS];
  1305. size_t len[NUM_NL80211_BANDS];
  1306. const u8 *common_ies;
  1307. size_t common_ie_len;
  1308. };
  1309. static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
  1310. {
  1311. return (struct ieee80211_tx_info *)skb->cb;
  1312. }
  1313. static inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb)
  1314. {
  1315. return (struct ieee80211_rx_status *)skb->cb;
  1316. }
  1317. /**
  1318. * ieee80211_tx_info_clear_status - clear TX status
  1319. *
  1320. * @info: The &struct ieee80211_tx_info to be cleared.
  1321. *
  1322. * When the driver passes an skb back to mac80211, it must report
  1323. * a number of things in TX status. This function clears everything
  1324. * in the TX status but the rate control information (it does clear
  1325. * the count since you need to fill that in anyway).
  1326. *
  1327. * NOTE: While the rates array is kept intact, this will wipe all of the
  1328. * driver_data fields in info, so it's up to the driver to restore
  1329. * any fields it needs after calling this helper.
  1330. */
  1331. static inline void
  1332. ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  1333. {
  1334. int i;
  1335. BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
  1336. offsetof(struct ieee80211_tx_info, control.rates));
  1337. BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
  1338. offsetof(struct ieee80211_tx_info, driver_rates));
  1339. BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8);
  1340. /* clear the rate counts */
  1341. for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
  1342. info->status.rates[i].count = 0;
  1343. memset_after(&info->status, 0, rates);
  1344. }
  1345. /**
  1346. * enum mac80211_rx_flags - receive flags
  1347. *
  1348. * These flags are used with the @flag member of &struct ieee80211_rx_status.
  1349. * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame.
  1350. * Use together with %RX_FLAG_MMIC_STRIPPED.
  1351. * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware.
  1352. * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame,
  1353. * verification has been done by the hardware.
  1354. * @RX_FLAG_IV_STRIPPED: The IV and ICV are stripped from this frame.
  1355. * If this flag is set, the stack cannot do any replay detection
  1356. * hence the driver or hardware will have to do that.
  1357. * @RX_FLAG_PN_VALIDATED: Currently only valid for CCMP/GCMP frames, this
  1358. * flag indicates that the PN was verified for replay protection.
  1359. * Note that this flag is also currently only supported when a frame
  1360. * is also decrypted (ie. @RX_FLAG_DECRYPTED must be set)
  1361. * @RX_FLAG_DUP_VALIDATED: The driver should set this flag if it did
  1362. * de-duplication by itself.
  1363. * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on
  1364. * the frame.
  1365. * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
  1366. * the frame.
  1367. * @RX_FLAG_MACTIME: The timestamp passed in the RX status (@mactime
  1368. * field) is valid if this field is non-zero, and the position
  1369. * where the timestamp was sampled depends on the value.
  1370. * @RX_FLAG_MACTIME_START: The timestamp passed in the RX status (@mactime
  1371. * field) is valid and contains the time the first symbol of the MPDU
  1372. * was received. This is useful in monitor mode and for proper IBSS
  1373. * merging.
  1374. * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime
  1375. * field) is valid and contains the time the last symbol of the MPDU
  1376. * (including FCS) was received.
  1377. * @RX_FLAG_MACTIME_PLCP_START: The timestamp passed in the RX status (@mactime
  1378. * field) is valid and contains the time the SYNC preamble was received.
  1379. * @RX_FLAG_MACTIME_IS_RTAP_TS64: The timestamp passed in the RX status @mactime
  1380. * is only for use in the radiotap timestamp header, not otherwise a valid
  1381. * @mactime value. Note this is a separate flag so that we continue to see
  1382. * %RX_FLAG_MACTIME as unset. Also note that in this case the timestamp is
  1383. * reported to be 64 bits wide, not just 32.
  1384. * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
  1385. * Valid only for data frames (mainly A-MPDU)
  1386. * @RX_FLAG_AMPDU_DETAILS: A-MPDU details are known, in particular the reference
  1387. * number (@ampdu_reference) must be populated and be a distinct number for
  1388. * each A-MPDU
  1389. * @RX_FLAG_AMPDU_LAST_KNOWN: last subframe is known, should be set on all
  1390. * subframes of a single A-MPDU
  1391. * @RX_FLAG_AMPDU_IS_LAST: this subframe is the last subframe of the A-MPDU
  1392. * @RX_FLAG_AMPDU_DELIM_CRC_ERROR: A delimiter CRC error has been detected
  1393. * on this subframe
  1394. * @RX_FLAG_MIC_STRIPPED: The mic was stripped of this packet. Decryption was
  1395. * done by the hardware
  1396. * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without
  1397. * processing it in any regular way.
  1398. * This is useful if drivers offload some frames but still want to report
  1399. * them for sniffing purposes.
  1400. * @RX_FLAG_SKIP_MONITOR: Process and report frame to all interfaces except
  1401. * monitor interfaces.
  1402. * This is useful if drivers offload some frames but still want to report
  1403. * them for sniffing purposes.
  1404. * @RX_FLAG_AMSDU_MORE: Some drivers may prefer to report separate A-MSDU
  1405. * subframes instead of a one huge frame for performance reasons.
  1406. * All, but the last MSDU from an A-MSDU should have this flag set. E.g.
  1407. * if an A-MSDU has 3 frames, the first 2 must have the flag set, while
  1408. * the 3rd (last) one must not have this flag set. The flag is used to
  1409. * deal with retransmission/duplication recovery properly since A-MSDU
  1410. * subframes share the same sequence number. Reported subframes can be
  1411. * either regular MSDU or singly A-MSDUs. Subframes must not be
  1412. * interleaved with other frames.
  1413. * @RX_FLAG_RADIOTAP_TLV_AT_END: This frame contains radiotap TLVs in the
  1414. * skb->data (before the 802.11 header).
  1415. * If used, the SKB's mac_header pointer must be set to point
  1416. * to the 802.11 header after the TLVs, and any padding added after TLV
  1417. * data to align to 4 must be cleared by the driver putting the TLVs
  1418. * in the skb.
  1419. * @RX_FLAG_ALLOW_SAME_PN: Allow the same PN as same packet before.
  1420. * This is used for AMSDU subframes which can have the same PN as
  1421. * the first subframe.
  1422. * @RX_FLAG_ICV_STRIPPED: The ICV is stripped from this frame. CRC checking must
  1423. * be done in the hardware.
  1424. * @RX_FLAG_AMPDU_EOF_BIT: Value of the EOF bit in the A-MPDU delimiter for this
  1425. * frame
  1426. * @RX_FLAG_AMPDU_EOF_BIT_KNOWN: The EOF value is known
  1427. * @RX_FLAG_RADIOTAP_HE: HE radiotap data is present
  1428. * (&struct ieee80211_radiotap_he, mac80211 will fill in
  1429. *
  1430. * - DATA3_DATA_MCS
  1431. * - DATA3_DATA_DCM
  1432. * - DATA3_CODING
  1433. * - DATA5_GI
  1434. * - DATA5_DATA_BW_RU_ALLOC
  1435. * - DATA6_NSTS
  1436. * - DATA3_STBC
  1437. *
  1438. * from the RX info data, so leave those zeroed when building this data)
  1439. * @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present
  1440. * (&struct ieee80211_radiotap_he_mu)
  1441. * @RX_FLAG_RADIOTAP_LSIG: L-SIG radiotap data is present
  1442. * @RX_FLAG_NO_PSDU: use the frame only for radiotap reporting, with
  1443. * the "0-length PSDU" field included there. The value for it is
  1444. * in &struct ieee80211_rx_status. Note that if this value isn't
  1445. * known the frame shouldn't be reported.
  1446. * @RX_FLAG_8023: the frame has an 802.3 header (decap offload performed by
  1447. * hardware or driver)
  1448. * @RX_FLAG_RADIOTAP_VHT: VHT radiotap data is present
  1449. */
  1450. enum mac80211_rx_flags {
  1451. RX_FLAG_MMIC_ERROR = BIT(0),
  1452. RX_FLAG_DECRYPTED = BIT(1),
  1453. RX_FLAG_ONLY_MONITOR = BIT(2),
  1454. RX_FLAG_MMIC_STRIPPED = BIT(3),
  1455. RX_FLAG_IV_STRIPPED = BIT(4),
  1456. RX_FLAG_FAILED_FCS_CRC = BIT(5),
  1457. RX_FLAG_FAILED_PLCP_CRC = BIT(6),
  1458. RX_FLAG_MACTIME_IS_RTAP_TS64 = BIT(7),
  1459. RX_FLAG_NO_SIGNAL_VAL = BIT(8),
  1460. RX_FLAG_AMPDU_DETAILS = BIT(9),
  1461. RX_FLAG_PN_VALIDATED = BIT(10),
  1462. RX_FLAG_DUP_VALIDATED = BIT(11),
  1463. RX_FLAG_AMPDU_LAST_KNOWN = BIT(12),
  1464. RX_FLAG_AMPDU_IS_LAST = BIT(13),
  1465. RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(14),
  1466. /* one free bit at 15 */
  1467. RX_FLAG_MACTIME = BIT(16) | BIT(17),
  1468. RX_FLAG_MACTIME_PLCP_START = 1 << 16,
  1469. RX_FLAG_MACTIME_START = 2 << 16,
  1470. RX_FLAG_MACTIME_END = 3 << 16,
  1471. RX_FLAG_SKIP_MONITOR = BIT(18),
  1472. RX_FLAG_AMSDU_MORE = BIT(19),
  1473. RX_FLAG_RADIOTAP_TLV_AT_END = BIT(20),
  1474. RX_FLAG_MIC_STRIPPED = BIT(21),
  1475. RX_FLAG_ALLOW_SAME_PN = BIT(22),
  1476. RX_FLAG_ICV_STRIPPED = BIT(23),
  1477. RX_FLAG_AMPDU_EOF_BIT = BIT(24),
  1478. RX_FLAG_AMPDU_EOF_BIT_KNOWN = BIT(25),
  1479. RX_FLAG_RADIOTAP_HE = BIT(26),
  1480. RX_FLAG_RADIOTAP_HE_MU = BIT(27),
  1481. RX_FLAG_RADIOTAP_LSIG = BIT(28),
  1482. RX_FLAG_NO_PSDU = BIT(29),
  1483. RX_FLAG_8023 = BIT(30),
  1484. RX_FLAG_RADIOTAP_VHT = BIT(31),
  1485. };
  1486. /**
  1487. * enum mac80211_rx_encoding_flags - MCS & bandwidth flags
  1488. *
  1489. * @RX_ENC_FLAG_SHORTPRE: Short preamble was used for this frame
  1490. * @RX_ENC_FLAG_SHORT_GI: Short guard interval was used
  1491. * @RX_ENC_FLAG_HT_GF: This frame was received in a HT-greenfield transmission,
  1492. * if the driver fills this value it should add
  1493. * %IEEE80211_RADIOTAP_MCS_HAVE_FMT
  1494. * to @hw.radiotap_mcs_details to advertise that fact.
  1495. * @RX_ENC_FLAG_LDPC: LDPC was used
  1496. * @RX_ENC_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
  1497. * @RX_ENC_FLAG_BF: packet was beamformed
  1498. */
  1499. enum mac80211_rx_encoding_flags {
  1500. RX_ENC_FLAG_SHORTPRE = BIT(0),
  1501. RX_ENC_FLAG_SHORT_GI = BIT(2),
  1502. RX_ENC_FLAG_HT_GF = BIT(3),
  1503. RX_ENC_FLAG_STBC_MASK = BIT(4) | BIT(5),
  1504. RX_ENC_FLAG_LDPC = BIT(6),
  1505. RX_ENC_FLAG_BF = BIT(7),
  1506. };
  1507. #define RX_ENC_FLAG_STBC_SHIFT 4
  1508. enum mac80211_rx_encoding {
  1509. RX_ENC_LEGACY = 0,
  1510. RX_ENC_HT,
  1511. RX_ENC_VHT,
  1512. RX_ENC_HE,
  1513. RX_ENC_EHT,
  1514. RX_ENC_UHR,
  1515. };
  1516. /**
  1517. * struct ieee80211_rx_status - receive status
  1518. *
  1519. * The low-level driver should provide this information (the subset
  1520. * supported by hardware) to the 802.11 code with each received
  1521. * frame, in the skb's control buffer (cb).
  1522. *
  1523. * @mactime: value in microseconds of the 64-bit Time Synchronization Function
  1524. * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
  1525. * @boottime_ns: CLOCK_BOOTTIME timestamp the frame was received at, this is
  1526. * needed only for beacons and probe responses that update the scan cache.
  1527. * @ack_tx_hwtstamp: Hardware timestamp for the ack TX in nanoseconds. Only
  1528. * needed for Timing measurement and Fine timing measurement action frames.
  1529. * Only reported by devices that have timestamping enabled.
  1530. * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use
  1531. * it but can store it and pass it back to the driver for synchronisation
  1532. * @band: the active band when this frame was received
  1533. * @freq: frequency the radio was tuned to when receiving this frame, in MHz
  1534. * This field must be set for management frames, but isn't strictly needed
  1535. * for data (other) frames - for those it only affects radiotap reporting.
  1536. * @freq_offset: @freq has a positive offset of 500Khz.
  1537. * @signal: signal strength when receiving this frame, either in dBm, in dB or
  1538. * unspecified depending on the hardware capabilities flags
  1539. * @IEEE80211_HW_SIGNAL_*
  1540. * @chains: bitmask of receive chains for which separate signal strength
  1541. * values were filled.
  1542. * @chain_signal: per-chain signal strength, in dBm (unlike @signal, doesn't
  1543. * support dB or unspecified units)
  1544. * @antenna: antenna used
  1545. * @rate_idx: index of data rate into band's supported rates or MCS index if
  1546. * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
  1547. * @nss: number of streams (VHT, HE, EHT and UHR only)
  1548. * @flag: %RX_FLAG_\*
  1549. * @encoding: &enum mac80211_rx_encoding
  1550. * @bw: &enum rate_info_bw
  1551. * @enc_flags: uses bits from &enum mac80211_rx_encoding_flags
  1552. * @he_ru: HE RU, from &enum nl80211_he_ru_alloc
  1553. * @he_gi: HE GI, from &enum nl80211_he_gi
  1554. * @he_dcm: HE DCM value
  1555. * @eht: EHT specific rate information
  1556. * @eht.ru: EHT RU, from &enum nl80211_eht_ru_alloc
  1557. * @eht.gi: EHT GI, from &enum nl80211_eht_gi
  1558. * @uhr: UHR specific rate information
  1559. * @uhr.ru: UHR RU, from &enum nl80211_eht_ru_alloc
  1560. * @uhr.gi: UHR GI, from &enum nl80211_eht_gi
  1561. * @uhr.elr: UHR ELR MCS was used
  1562. * @uhr.im: UHR interference mitigation was used
  1563. * @rx_flags: internal RX flags for mac80211
  1564. * @ampdu_reference: A-MPDU reference number, must be a different value for
  1565. * each A-MPDU but the same for each subframe within one A-MPDU
  1566. * @zero_length_psdu_type: radiotap type of the 0-length PSDU
  1567. * @link_valid: if the link which is identified by @link_id is valid. This flag
  1568. * is set only when connection is MLO.
  1569. * @link_id: id of the link used to receive the packet. This is used along with
  1570. * @link_valid.
  1571. */
  1572. struct ieee80211_rx_status {
  1573. u64 mactime;
  1574. union {
  1575. u64 boottime_ns;
  1576. ktime_t ack_tx_hwtstamp;
  1577. };
  1578. u32 device_timestamp;
  1579. u32 ampdu_reference;
  1580. u32 flag;
  1581. u16 freq: 13, freq_offset: 1;
  1582. u8 enc_flags;
  1583. u8 encoding:3, bw:4;
  1584. union {
  1585. struct {
  1586. u8 he_ru:3;
  1587. u8 he_gi:2;
  1588. u8 he_dcm:1;
  1589. };
  1590. struct {
  1591. u8 ru:4;
  1592. u8 gi:2;
  1593. } eht;
  1594. struct {
  1595. u8 ru:4;
  1596. u8 gi:2;
  1597. u8 elr:1;
  1598. u8 im:1;
  1599. } uhr;
  1600. };
  1601. u8 rate_idx;
  1602. u8 nss;
  1603. u8 rx_flags;
  1604. u8 band;
  1605. u8 antenna;
  1606. s8 signal;
  1607. u8 chains;
  1608. s8 chain_signal[IEEE80211_MAX_CHAINS];
  1609. u8 zero_length_psdu_type;
  1610. u8 link_valid:1, link_id:4;
  1611. };
  1612. static inline u32
  1613. ieee80211_rx_status_to_khz(struct ieee80211_rx_status *rx_status)
  1614. {
  1615. return MHZ_TO_KHZ(rx_status->freq) +
  1616. (rx_status->freq_offset ? 500 : 0);
  1617. }
  1618. /**
  1619. * enum ieee80211_conf_flags - configuration flags
  1620. *
  1621. * Flags to define PHY configuration options
  1622. *
  1623. * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this
  1624. * to determine for example whether to calculate timestamps for packets
  1625. * or not, do not use instead of filter flags!
  1626. * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only).
  1627. * This is the power save mode defined by IEEE 802.11-2007 section 11.2,
  1628. * meaning that the hardware still wakes up for beacons, is able to
  1629. * transmit frames and receive the possible acknowledgment frames.
  1630. * Not to be confused with hardware specific wakeup/sleep states,
  1631. * driver is responsible for that. See the section "Powersave support"
  1632. * for more.
  1633. * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
  1634. * the driver should be prepared to handle configuration requests but
  1635. * may turn the device off as much as possible. Typically, this flag will
  1636. * be set when an interface is set UP but not associated or scanning, but
  1637. * it can also be unset in that case when monitor interfaces are active.
  1638. * @IEEE80211_CONF_OFFCHANNEL: The device is currently not on its main
  1639. * operating channel.
  1640. */
  1641. enum ieee80211_conf_flags {
  1642. IEEE80211_CONF_MONITOR = (1<<0),
  1643. IEEE80211_CONF_PS = (1<<1),
  1644. IEEE80211_CONF_IDLE = (1<<2),
  1645. IEEE80211_CONF_OFFCHANNEL = (1<<3),
  1646. };
  1647. /**
  1648. * enum ieee80211_conf_changed - denotes which configuration changed
  1649. *
  1650. * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
  1651. * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed
  1652. * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
  1653. * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
  1654. * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
  1655. * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
  1656. * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
  1657. * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
  1658. * Note that this is only valid if channel contexts are not used,
  1659. * otherwise each channel context has the number of chains listed.
  1660. */
  1661. enum ieee80211_conf_changed {
  1662. IEEE80211_CONF_CHANGE_SMPS = BIT(1),
  1663. IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
  1664. IEEE80211_CONF_CHANGE_MONITOR = BIT(3),
  1665. IEEE80211_CONF_CHANGE_PS = BIT(4),
  1666. IEEE80211_CONF_CHANGE_POWER = BIT(5),
  1667. IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
  1668. IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
  1669. IEEE80211_CONF_CHANGE_IDLE = BIT(8),
  1670. };
  1671. /**
  1672. * enum ieee80211_smps_mode - spatial multiplexing power save mode
  1673. *
  1674. * @IEEE80211_SMPS_AUTOMATIC: automatic
  1675. * @IEEE80211_SMPS_OFF: off
  1676. * @IEEE80211_SMPS_STATIC: static
  1677. * @IEEE80211_SMPS_DYNAMIC: dynamic
  1678. * @IEEE80211_SMPS_NUM_MODES: internal, don't use
  1679. */
  1680. enum ieee80211_smps_mode {
  1681. IEEE80211_SMPS_AUTOMATIC,
  1682. IEEE80211_SMPS_OFF,
  1683. IEEE80211_SMPS_STATIC,
  1684. IEEE80211_SMPS_DYNAMIC,
  1685. /* keep last */
  1686. IEEE80211_SMPS_NUM_MODES,
  1687. };
  1688. /**
  1689. * struct ieee80211_conf - configuration of the device
  1690. *
  1691. * This struct indicates how the driver shall configure the hardware.
  1692. *
  1693. * @flags: configuration flags defined above
  1694. *
  1695. * @listen_interval: listen interval in units of beacon interval
  1696. * @ps_dtim_period: The DTIM period of the AP we're connected to, for use
  1697. * in power saving. Power saving will not be enabled until a beacon
  1698. * has been received and the DTIM period is known.
  1699. * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
  1700. * powersave documentation below. This variable is valid only when
  1701. * the CONF_PS flag is set.
  1702. *
  1703. * @power_level: requested transmit power (in dBm), backward compatibility
  1704. * value only that is set to the minimum of all interfaces
  1705. *
  1706. * @chandef: the channel definition to tune to
  1707. * @radar_enabled: whether radar detection is enabled
  1708. *
  1709. * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
  1710. * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
  1711. * but actually means the number of transmissions not the number of retries
  1712. * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
  1713. * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
  1714. * number of transmissions not the number of retries
  1715. *
  1716. * @smps_mode: spatial multiplexing powersave mode; note that
  1717. * %IEEE80211_SMPS_STATIC is used when the device is not
  1718. * configured for an HT channel.
  1719. * Note that this is only valid if channel contexts are not used,
  1720. * otherwise each channel context has the number of chains listed.
  1721. */
  1722. struct ieee80211_conf {
  1723. u32 flags;
  1724. int power_level, dynamic_ps_timeout;
  1725. u16 listen_interval;
  1726. u8 ps_dtim_period;
  1727. u8 long_frame_max_tx_count, short_frame_max_tx_count;
  1728. struct cfg80211_chan_def chandef;
  1729. bool radar_enabled;
  1730. enum ieee80211_smps_mode smps_mode;
  1731. };
  1732. /**
  1733. * struct ieee80211_channel_switch - holds the channel switch data
  1734. *
  1735. * The information provided in this structure is required for channel switch
  1736. * operation.
  1737. *
  1738. * @timestamp: value in microseconds of the 64-bit Time Synchronization
  1739. * Function (TSF) timer when the frame containing the channel switch
  1740. * announcement was received. This is simply the rx.mactime parameter
  1741. * the driver passed into mac80211.
  1742. * @device_timestamp: arbitrary timestamp for the device, this is the
  1743. * rx.device_timestamp parameter the driver passed to mac80211.
  1744. * @block_tx: Indicates whether transmission must be blocked before the
  1745. * scheduled channel switch, as indicated by the AP.
  1746. * @chandef: the new channel to switch to
  1747. * @count: the number of TBTT's until the channel switch event
  1748. * @delay: maximum delay between the time the AP transmitted the last beacon in
  1749. * current channel and the expected time of the first beacon in the new
  1750. * channel, expressed in TU.
  1751. * @link_id: the link ID of the link doing the channel switch, 0 for non-MLO
  1752. */
  1753. struct ieee80211_channel_switch {
  1754. u64 timestamp;
  1755. u32 device_timestamp;
  1756. bool block_tx;
  1757. struct cfg80211_chan_def chandef;
  1758. u8 count;
  1759. u8 link_id;
  1760. u32 delay;
  1761. };
  1762. /**
  1763. * enum ieee80211_vif_flags - virtual interface flags
  1764. *
  1765. * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering
  1766. * on this virtual interface to avoid unnecessary CPU wakeups
  1767. * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality
  1768. * monitoring on this virtual interface -- i.e. it can monitor
  1769. * connection quality related parameters, such as the RSSI level and
  1770. * provide notifications if configured trigger levels are reached.
  1771. * @IEEE80211_VIF_SUPPORTS_UAPSD: The device can do U-APSD for this
  1772. * interface. This flag should be set during interface addition,
  1773. * but may be set/cleared as late as authentication to an AP. It is
  1774. * only valid for managed/station mode interfaces.
  1775. * @IEEE80211_VIF_GET_NOA_UPDATE: request to handle NOA attributes
  1776. * and send P2P_PS notification to the driver if NOA changed, even
  1777. * this is not pure P2P vif.
  1778. * @IEEE80211_VIF_EML_ACTIVE: The driver indicates that EML operation is
  1779. * enabled for the interface.
  1780. * @IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW: Ignore wider bandwidth OFDMA
  1781. * operation on this interface and request a channel context without
  1782. * the AP definition. Use this e.g. because the device is able to
  1783. * handle OFDMA (downlink and trigger for uplink) on a per-AP basis.
  1784. * @IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC: indicates that the AP sta should
  1785. * be removed only after setting the vif as unassociated, and not the
  1786. * opposite. Only relevant for STA vifs.
  1787. */
  1788. enum ieee80211_vif_flags {
  1789. IEEE80211_VIF_BEACON_FILTER = BIT(0),
  1790. IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),
  1791. IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2),
  1792. IEEE80211_VIF_GET_NOA_UPDATE = BIT(3),
  1793. IEEE80211_VIF_EML_ACTIVE = BIT(4),
  1794. IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW = BIT(5),
  1795. IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC = BIT(6),
  1796. };
  1797. /**
  1798. * enum ieee80211_offload_flags - virtual interface offload flags
  1799. *
  1800. * @IEEE80211_OFFLOAD_ENCAP_ENABLED: tx encapsulation offload is enabled
  1801. * The driver supports sending frames passed as 802.3 frames by mac80211.
  1802. * It must also support sending 802.11 packets for the same interface.
  1803. * @IEEE80211_OFFLOAD_ENCAP_4ADDR: support 4-address mode encapsulation offload
  1804. * @IEEE80211_OFFLOAD_DECAP_ENABLED: rx encapsulation offload is enabled
  1805. * The driver supports passing received 802.11 frames as 802.3 frames to
  1806. * mac80211.
  1807. */
  1808. enum ieee80211_offload_flags {
  1809. IEEE80211_OFFLOAD_ENCAP_ENABLED = BIT(0),
  1810. IEEE80211_OFFLOAD_ENCAP_4ADDR = BIT(1),
  1811. IEEE80211_OFFLOAD_DECAP_ENABLED = BIT(2),
  1812. };
  1813. /**
  1814. * struct ieee80211_eml_params - EHT Operating mode notification parameters
  1815. *
  1816. * EML Operating mode notification parameters received in the Operating mode
  1817. * notification frame. This struct is used as a container to pass the info to
  1818. * the underlay driver.
  1819. *
  1820. * @link_id: the link ID where the Operating mode notification frame has been
  1821. * received.
  1822. * @control: EML control field defined in P802.11be section 9.4.1.76.
  1823. * @link_bitmap: eMLSR/eMLMR enabled links defined in P802.11be
  1824. * section 9.4.1.76.
  1825. * @emlmr_mcs_map_count: eMLMR number of valid mcs_map_bw fields according to
  1826. * P802.11be section 9.4.1.76 (valid if eMLMR mode control bit is set).
  1827. * @emlmr_mcs_map_bw: eMLMR supported MCS and NSS set subfileds defined in
  1828. * P802.11be section 9.4.1.76 (valid if eMLMR mode control bit is set).
  1829. */
  1830. struct ieee80211_eml_params {
  1831. u8 link_id;
  1832. u8 control;
  1833. u16 link_bitmap;
  1834. u8 emlmr_mcs_map_count;
  1835. u8 emlmr_mcs_map_bw[9];
  1836. };
  1837. /**
  1838. * struct ieee80211_vif_cfg - interface configuration
  1839. * @assoc: association status
  1840. * @ibss_joined: indicates whether this station is part of an IBSS or not
  1841. * @ibss_creator: indicates if a new IBSS network is being created
  1842. * @ps: power-save mode (STA only). This flag is NOT affected by
  1843. * offchannel/dynamic_ps operations.
  1844. * @aid: association ID number, valid only when @assoc is true
  1845. * @eml_cap: EML capabilities as described in P802.11be_D4.1 Figure 9-1001j.
  1846. * @eml_med_sync_delay: Medium Synchronization delay as described in
  1847. * P802.11be_D4.1 Figure 9-1001i.
  1848. * @mld_capa_op: MLD Capabilities and Operations per P802.11be_D4.1
  1849. * Figure 9-1001k
  1850. * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The
  1851. * may filter ARP queries targeted for other addresses than listed here.
  1852. * The driver must allow ARP queries targeted for all address listed here
  1853. * to pass through. An empty list implies no ARP queries need to pass.
  1854. * @arp_addr_cnt: Number of addresses currently on the list. Note that this
  1855. * may be larger than %IEEE80211_BSS_ARP_ADDR_LIST_LEN (the arp_addr_list
  1856. * array size), it's up to the driver what to do in that case.
  1857. * @ssid: The SSID of the current vif. Valid in AP and IBSS mode.
  1858. * @ssid_len: Length of SSID given in @ssid.
  1859. * @s1g: BSS is S1G BSS (affects Association Request format).
  1860. * @idle: This interface is idle. There's also a global idle flag in the
  1861. * hardware config which may be more appropriate depending on what
  1862. * your driver/device needs to do.
  1863. * @ap_addr: AP MLD address, or BSSID for non-MLO connections
  1864. * (station mode only)
  1865. */
  1866. struct ieee80211_vif_cfg {
  1867. /* association related data */
  1868. bool assoc, ibss_joined;
  1869. bool ibss_creator;
  1870. bool ps;
  1871. u16 aid;
  1872. u16 eml_cap;
  1873. u16 eml_med_sync_delay;
  1874. u16 mld_capa_op;
  1875. __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
  1876. int arp_addr_cnt;
  1877. u8 ssid[IEEE80211_MAX_SSID_LEN];
  1878. size_t ssid_len;
  1879. bool s1g;
  1880. bool idle;
  1881. u8 ap_addr[ETH_ALEN] __aligned(2);
  1882. };
  1883. #define IEEE80211_TTLM_NUM_TIDS 8
  1884. /**
  1885. * struct ieee80211_neg_ttlm - negotiated TID to link map info
  1886. *
  1887. * @downlink: bitmap of active links per TID for downlink, or 0 if mapping for
  1888. * this TID is not included.
  1889. * @uplink: bitmap of active links per TID for uplink, or 0 if mapping for this
  1890. * TID is not included.
  1891. * @valid: info is valid or not.
  1892. */
  1893. struct ieee80211_neg_ttlm {
  1894. u16 downlink[IEEE80211_TTLM_NUM_TIDS];
  1895. u16 uplink[IEEE80211_TTLM_NUM_TIDS];
  1896. bool valid;
  1897. };
  1898. /**
  1899. * enum ieee80211_neg_ttlm_res - return value for negotiated TTLM handling
  1900. * @NEG_TTLM_RES_ACCEPT: accept the request
  1901. * @NEG_TTLM_RES_REJECT: reject the request
  1902. * @NEG_TTLM_RES_SUGGEST_PREFERRED: reject and suggest a new mapping
  1903. */
  1904. enum ieee80211_neg_ttlm_res {
  1905. NEG_TTLM_RES_ACCEPT,
  1906. NEG_TTLM_RES_REJECT,
  1907. NEG_TTLM_RES_SUGGEST_PREFERRED
  1908. };
  1909. /**
  1910. * struct ieee80211_vif - per-interface data
  1911. *
  1912. * Data in this structure is continually present for driver
  1913. * use during the life of a virtual interface.
  1914. *
  1915. * @type: type of this virtual interface
  1916. * @cfg: vif configuration, see &struct ieee80211_vif_cfg
  1917. * @bss_conf: BSS configuration for this interface, either our own
  1918. * or the BSS we're associated to
  1919. * @link_conf: in case of MLD, the per-link BSS configuration,
  1920. * indexed by link ID
  1921. * @valid_links: bitmap of valid links, or 0 for non-MLO.
  1922. * @active_links: The bitmap of active links, or 0 for non-MLO.
  1923. * The driver shouldn't change this directly, but use the
  1924. * API calls meant for that purpose.
  1925. * @dormant_links: subset of the valid links that are disabled/suspended
  1926. * due to advertised or negotiated TTLM respectively.
  1927. * 0 for non-MLO.
  1928. * @suspended_links: subset of dormant_links representing links that are
  1929. * suspended due to negotiated TTLM, and could be activated in the
  1930. * future by tearing down the TTLM negotiation.
  1931. * 0 for non-MLO.
  1932. * @neg_ttlm: negotiated TID to link mapping info.
  1933. * see &struct ieee80211_neg_ttlm.
  1934. * @addr: address of this interface
  1935. * @addr_valid: indicates if the address is actively used. Set to false for
  1936. * passive monitor interfaces, true in all other cases.
  1937. * @p2p: indicates whether this AP or STA interface is a p2p
  1938. * interface, i.e. a GO or p2p-sta respectively
  1939. * @netdev_features: tx netdev features supported by the hardware for this
  1940. * vif. mac80211 initializes this to hw->netdev_features, and the driver
  1941. * can mask out specific tx features. mac80211 will handle software fixup
  1942. * for masked offloads (GSO, CSUM)
  1943. * @driver_flags: flags/capabilities the driver has for this interface,
  1944. * these need to be set (or cleared) when the interface is added
  1945. * or, if supported by the driver, the interface type is changed
  1946. * at runtime, mac80211 will never touch this field
  1947. * @offload_flags: hardware offload capabilities/flags for this interface.
  1948. * These are initialized by mac80211 before calling .add_interface,
  1949. * .change_interface or .update_vif_offload and updated by the driver
  1950. * within these ops, based on supported features or runtime change
  1951. * restrictions.
  1952. * @hw_queue: hardware queue for each AC
  1953. * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
  1954. * @debugfs_dir: debugfs dentry, can be used by drivers to create own per
  1955. * interface debug files. Note that it will be NULL for the virtual
  1956. * monitor interface (if that is requested.)
  1957. * @probe_req_reg: probe requests should be reported to mac80211 for this
  1958. * interface.
  1959. * @rx_mcast_action_reg: multicast Action frames should be reported to mac80211
  1960. * for this interface.
  1961. * @drv_priv: data area for driver use, will always be aligned to
  1962. * sizeof(void \*).
  1963. * @txq: the multicast data TX queue
  1964. * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see
  1965. * &enum ieee80211_offload_flags.
  1966. */
  1967. struct ieee80211_vif {
  1968. enum nl80211_iftype type;
  1969. struct ieee80211_vif_cfg cfg;
  1970. struct ieee80211_bss_conf bss_conf;
  1971. struct ieee80211_bss_conf __rcu *link_conf[IEEE80211_MLD_MAX_NUM_LINKS];
  1972. u16 valid_links, active_links, dormant_links, suspended_links;
  1973. struct ieee80211_neg_ttlm neg_ttlm;
  1974. u8 addr[ETH_ALEN] __aligned(2);
  1975. bool addr_valid;
  1976. bool p2p;
  1977. u8 cab_queue;
  1978. u8 hw_queue[IEEE80211_NUM_ACS];
  1979. struct ieee80211_txq *txq;
  1980. netdev_features_t netdev_features;
  1981. u32 driver_flags;
  1982. u32 offload_flags;
  1983. #ifdef CONFIG_MAC80211_DEBUGFS
  1984. struct dentry *debugfs_dir;
  1985. #endif
  1986. bool probe_req_reg;
  1987. bool rx_mcast_action_reg;
  1988. /* must be last */
  1989. u8 drv_priv[] __aligned(sizeof(void *));
  1990. };
  1991. /**
  1992. * ieee80211_vif_usable_links - Return the usable links for the vif
  1993. * @vif: the vif for which the usable links are requested
  1994. * Return: the usable link bitmap
  1995. */
  1996. static inline u16 ieee80211_vif_usable_links(const struct ieee80211_vif *vif)
  1997. {
  1998. return vif->valid_links & ~vif->dormant_links;
  1999. }
  2000. /**
  2001. * ieee80211_vif_is_mld - Returns true iff the vif is an MLD one
  2002. * @vif: the vif
  2003. * Return: %true if the vif is an MLD, %false otherwise.
  2004. */
  2005. static inline bool ieee80211_vif_is_mld(const struct ieee80211_vif *vif)
  2006. {
  2007. /* valid_links != 0 indicates this vif is an MLD */
  2008. return vif->valid_links != 0;
  2009. }
  2010. /**
  2011. * ieee80211_vif_link_active - check if a given link is active
  2012. * @vif: the vif
  2013. * @link_id: the link ID to check
  2014. * Return: %true if the vif is an MLD and the link is active, or if
  2015. * the vif is not an MLD and the link ID is 0; %false otherwise.
  2016. */
  2017. static inline bool ieee80211_vif_link_active(const struct ieee80211_vif *vif,
  2018. unsigned int link_id)
  2019. {
  2020. if (!ieee80211_vif_is_mld(vif))
  2021. return link_id == 0;
  2022. return vif->active_links & BIT(link_id);
  2023. }
  2024. #define for_each_vif_active_link(vif, link, link_id) \
  2025. for (link_id = 0; link_id < ARRAY_SIZE((vif)->link_conf); link_id++) \
  2026. if ((!(vif)->active_links || \
  2027. (vif)->active_links & BIT(link_id)) && \
  2028. (link = link_conf_dereference_check(vif, link_id)))
  2029. static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
  2030. {
  2031. #ifdef CONFIG_MAC80211_MESH
  2032. return vif->type == NL80211_IFTYPE_MESH_POINT;
  2033. #endif
  2034. return false;
  2035. }
  2036. /**
  2037. * wdev_to_ieee80211_vif - return a vif struct from a wdev
  2038. * @wdev: the wdev to get the vif for
  2039. *
  2040. * This can be used by mac80211 drivers with direct cfg80211 APIs
  2041. * (like the vendor commands) that get a wdev.
  2042. *
  2043. * Return: pointer to the wdev, or %NULL if the given wdev isn't
  2044. * associated with a vif that the driver knows about (e.g. monitor
  2045. * or AP_VLAN interfaces.)
  2046. */
  2047. struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
  2048. /**
  2049. * ieee80211_vif_to_wdev - return a wdev struct from a vif
  2050. * @vif: the vif to get the wdev for
  2051. *
  2052. * This can be used by mac80211 drivers with direct cfg80211 APIs
  2053. * (like the vendor commands) that needs to get the wdev for a vif.
  2054. * This can also be useful to get the netdev associated to a vif.
  2055. *
  2056. * Return: pointer to the wdev
  2057. */
  2058. struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
  2059. static inline bool lockdep_vif_wiphy_mutex_held(struct ieee80211_vif *vif)
  2060. {
  2061. return lockdep_is_held(&ieee80211_vif_to_wdev(vif)->wiphy->mtx);
  2062. }
  2063. #define link_conf_dereference_protected(vif, link_id) \
  2064. rcu_dereference_protected((vif)->link_conf[link_id], \
  2065. lockdep_vif_wiphy_mutex_held(vif))
  2066. #define link_conf_dereference_check(vif, link_id) \
  2067. rcu_dereference_check((vif)->link_conf[link_id], \
  2068. lockdep_vif_wiphy_mutex_held(vif))
  2069. /**
  2070. * enum ieee80211_key_flags - key flags
  2071. *
  2072. * These flags are used for communication about keys between the driver
  2073. * and mac80211, with the @flags parameter of &struct ieee80211_key_conf.
  2074. *
  2075. * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the
  2076. * driver to indicate that it requires IV generation for this
  2077. * particular key. Setting this flag does not necessarily mean that SKBs
  2078. * will have sufficient tailroom for ICV or MIC.
  2079. * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by
  2080. * the driver for a TKIP key if it requires Michael MIC
  2081. * generation in software.
  2082. * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
  2083. * that the key is pairwise rather then a shared key.
  2084. * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
  2085. * CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
  2086. * (MFP) to be done in software.
  2087. * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
  2088. * if space should be prepared for the IV, but the IV
  2089. * itself should not be generated. Do not set together with
  2090. * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. Setting this flag does
  2091. * not necessarily mean that SKBs will have sufficient tailroom for ICV or
  2092. * MIC.
  2093. * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received
  2094. * management frames. The flag can help drivers that have a hardware
  2095. * crypto implementation that doesn't deal with management frames
  2096. * properly by allowing them to not upload the keys to hardware and
  2097. * fall back to software crypto. Note that this flag deals only with
  2098. * RX, if your crypto engine can't deal with TX you can also set the
  2099. * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
  2100. * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
  2101. * driver for a CCMP/GCMP key to indicate that is requires IV generation
  2102. * only for management frames (MFP).
  2103. * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
  2104. * driver for a key to indicate that sufficient tailroom must always
  2105. * be reserved for ICV or MIC, even when HW encryption is enabled.
  2106. * @IEEE80211_KEY_FLAG_PUT_MIC_SPACE: This flag should be set by the driver for
  2107. * a TKIP key if it only requires MIC space. Do not set together with
  2108. * @IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key.
  2109. * @IEEE80211_KEY_FLAG_NO_AUTO_TX: Key needs explicit Tx activation.
  2110. * @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver
  2111. * for a AES_CMAC or a AES_GMAC key to indicate that it requires sequence
  2112. * number generation only
  2113. * @IEEE80211_KEY_FLAG_SPP_AMSDU: SPP A-MSDUs can be used with this key
  2114. * (set by mac80211 from the sta->spp_amsdu flag)
  2115. */
  2116. enum ieee80211_key_flags {
  2117. IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0),
  2118. IEEE80211_KEY_FLAG_GENERATE_IV = BIT(1),
  2119. IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(2),
  2120. IEEE80211_KEY_FLAG_PAIRWISE = BIT(3),
  2121. IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(4),
  2122. IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(5),
  2123. IEEE80211_KEY_FLAG_RX_MGMT = BIT(6),
  2124. IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(7),
  2125. IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(8),
  2126. IEEE80211_KEY_FLAG_NO_AUTO_TX = BIT(9),
  2127. IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(10),
  2128. IEEE80211_KEY_FLAG_SPP_AMSDU = BIT(11),
  2129. };
  2130. /**
  2131. * struct ieee80211_key_conf - key information
  2132. *
  2133. * This key information is given by mac80211 to the driver by
  2134. * the set_key() callback in &struct ieee80211_ops.
  2135. *
  2136. * @hw_key_idx: To be set by the driver, this is the key index the driver
  2137. * wants to be given when a frame is transmitted and needs to be
  2138. * encrypted in hardware.
  2139. * @cipher: The key's cipher suite selector.
  2140. * @tx_pn: PN used for TX keys, may be used by the driver as well if it
  2141. * needs to do software PN assignment by itself (e.g. due to TSO)
  2142. * @flags: key flags, see &enum ieee80211_key_flags.
  2143. * @keyidx: the key index (0-7)
  2144. * @keylen: key material length
  2145. * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte)
  2146. * data block:
  2147. * - Temporal Encryption Key (128 bits)
  2148. * - Temporal Authenticator Tx MIC Key (64 bits)
  2149. * - Temporal Authenticator Rx MIC Key (64 bits)
  2150. * @icv_len: The ICV length for this key type
  2151. * @iv_len: The IV length for this key type
  2152. * @link_id: the link ID, 0 for non-MLO, or -1 for pairwise keys
  2153. */
  2154. struct ieee80211_key_conf {
  2155. atomic64_t tx_pn;
  2156. u32 cipher;
  2157. u8 icv_len;
  2158. u8 iv_len;
  2159. u8 hw_key_idx;
  2160. s8 keyidx;
  2161. u16 flags;
  2162. s8 link_id;
  2163. u8 keylen;
  2164. u8 key[];
  2165. };
  2166. #define IEEE80211_MAX_PN_LEN 16
  2167. #define TKIP_PN_TO_IV16(pn) ((u16)(pn & 0xffff))
  2168. #define TKIP_PN_TO_IV32(pn) ((u32)((pn >> 16) & 0xffffffff))
  2169. /**
  2170. * struct ieee80211_key_seq - key sequence counter
  2171. *
  2172. * @tkip: TKIP data, containing IV32 and IV16 in host byte order
  2173. * @ccmp: PN data, most significant byte first (big endian,
  2174. * reverse order than in packet)
  2175. * @aes_cmac: PN data, most significant byte first (big endian,
  2176. * reverse order than in packet)
  2177. * @aes_gmac: PN data, most significant byte first (big endian,
  2178. * reverse order than in packet)
  2179. * @gcmp: PN data, most significant byte first (big endian,
  2180. * reverse order than in packet)
  2181. * @hw: data for HW-only (e.g. cipher scheme) keys
  2182. */
  2183. struct ieee80211_key_seq {
  2184. union {
  2185. struct {
  2186. u32 iv32;
  2187. u16 iv16;
  2188. } tkip;
  2189. struct {
  2190. u8 pn[6];
  2191. } ccmp;
  2192. struct {
  2193. u8 pn[6];
  2194. } aes_cmac;
  2195. struct {
  2196. u8 pn[6];
  2197. } aes_gmac;
  2198. struct {
  2199. u8 pn[6];
  2200. } gcmp;
  2201. struct {
  2202. u8 seq[IEEE80211_MAX_PN_LEN];
  2203. u8 seq_len;
  2204. } hw;
  2205. };
  2206. };
  2207. /**
  2208. * enum set_key_cmd - key command
  2209. *
  2210. * Used with the set_key() callback in &struct ieee80211_ops, this
  2211. * indicates whether a key is being removed or added.
  2212. *
  2213. * @SET_KEY: a key is set
  2214. * @DISABLE_KEY: a key must be disabled
  2215. */
  2216. enum set_key_cmd {
  2217. SET_KEY, DISABLE_KEY,
  2218. };
  2219. /**
  2220. * enum ieee80211_sta_state - station state
  2221. *
  2222. * @IEEE80211_STA_NOTEXIST: station doesn't exist at all,
  2223. * this is a special state for add/remove transitions
  2224. * @IEEE80211_STA_NONE: station exists without special state
  2225. * @IEEE80211_STA_AUTH: station is authenticated
  2226. * @IEEE80211_STA_ASSOC: station is associated
  2227. * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X)
  2228. */
  2229. enum ieee80211_sta_state {
  2230. /* NOTE: These need to be ordered correctly! */
  2231. IEEE80211_STA_NOTEXIST,
  2232. IEEE80211_STA_NONE,
  2233. IEEE80211_STA_AUTH,
  2234. IEEE80211_STA_ASSOC,
  2235. IEEE80211_STA_AUTHORIZED,
  2236. };
  2237. /**
  2238. * enum ieee80211_sta_rx_bandwidth - station RX bandwidth
  2239. * @IEEE80211_STA_RX_BW_20: station can only receive 20 MHz
  2240. * @IEEE80211_STA_RX_BW_40: station can receive up to 40 MHz
  2241. * @IEEE80211_STA_RX_BW_80: station can receive up to 80 MHz
  2242. * @IEEE80211_STA_RX_BW_160: station can receive up to 160 MHz
  2243. * (including 80+80 MHz)
  2244. * @IEEE80211_STA_RX_BW_320: station can receive up to 320 MHz
  2245. *
  2246. * Implementation note: 20 must be zero to be initialized
  2247. * correctly, the values must be sorted.
  2248. */
  2249. enum ieee80211_sta_rx_bandwidth {
  2250. IEEE80211_STA_RX_BW_20 = 0,
  2251. IEEE80211_STA_RX_BW_40,
  2252. IEEE80211_STA_RX_BW_80,
  2253. IEEE80211_STA_RX_BW_160,
  2254. IEEE80211_STA_RX_BW_320,
  2255. };
  2256. #define IEEE80211_STA_RX_BW_MAX IEEE80211_STA_RX_BW_320
  2257. /**
  2258. * struct ieee80211_sta_rates - station rate selection table
  2259. *
  2260. * @rcu_head: RCU head used for freeing the table on update
  2261. * @rate: transmit rates/flags to be used by default.
  2262. * Overriding entries per-packet is possible by using cb tx control.
  2263. */
  2264. struct ieee80211_sta_rates {
  2265. struct rcu_head rcu_head;
  2266. struct {
  2267. s8 idx;
  2268. u8 count;
  2269. u8 count_cts;
  2270. u8 count_rts;
  2271. u16 flags;
  2272. } rate[IEEE80211_TX_RATE_TABLE_SIZE];
  2273. };
  2274. /**
  2275. * struct ieee80211_sta_txpwr - station txpower configuration
  2276. *
  2277. * Used to configure txpower for station.
  2278. *
  2279. * @power: indicates the tx power, in dBm, to be used when sending data frames
  2280. * to the STA.
  2281. * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
  2282. * will be less than or equal to specified from userspace, whereas if TPC
  2283. * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
  2284. * NL80211_TX_POWER_FIXED is not a valid configuration option for
  2285. * per peer TPC.
  2286. */
  2287. struct ieee80211_sta_txpwr {
  2288. s16 power;
  2289. enum nl80211_tx_power_setting type;
  2290. };
  2291. /**
  2292. * struct ieee80211_sta_aggregates - info that is aggregated from active links
  2293. *
  2294. * Used for any per-link data that needs to be aggregated and updated in the
  2295. * main &struct ieee80211_sta when updated or the active links change.
  2296. *
  2297. * @max_amsdu_len: indicates the maximal length of an A-MSDU in bytes.
  2298. * This field is always valid for packets with a VHT preamble.
  2299. * For packets with a HT preamble, additional limits apply:
  2300. *
  2301. * * If the skb is transmitted as part of a BA agreement, the
  2302. * A-MSDU maximal size is min(max_amsdu_len, 4065) bytes.
  2303. * * If the skb is not part of a BA agreement, the A-MSDU maximal
  2304. * size is min(max_amsdu_len, 7935) bytes.
  2305. *
  2306. * Both additional HT limits must be enforced by the low level
  2307. * driver. This is defined by the spec (IEEE 802.11-2012 section
  2308. * 8.3.2.2 NOTE 2).
  2309. * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  2310. * @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID
  2311. */
  2312. struct ieee80211_sta_aggregates {
  2313. u16 max_amsdu_len;
  2314. u16 max_rc_amsdu_len;
  2315. u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS];
  2316. };
  2317. /**
  2318. * struct ieee80211_link_sta - station Link specific info
  2319. * All link specific info for a STA link for a non MLD STA(single)
  2320. * or a MLD STA(multiple entries) are stored here.
  2321. *
  2322. * @sta: reference to owning STA
  2323. * @addr: MAC address of the Link STA. For non-MLO STA this is same as the addr
  2324. * in ieee80211_sta. For MLO Link STA this addr can be same or different
  2325. * from addr in ieee80211_sta (representing MLD STA addr)
  2326. * @link_id: the link ID for this link STA (0 for deflink)
  2327. * @smps_mode: current SMPS mode (off, static or dynamic)
  2328. * @supp_rates: Bitmap of supported rates
  2329. * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
  2330. * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
  2331. * @he_cap: HE capabilities of this STA
  2332. * @he_6ghz_capa: on 6 GHz, holds the HE 6 GHz band capabilities
  2333. * @eht_cap: EHT capabilities of this STA
  2334. * @uhr_cap: UHR capabilities of this STA
  2335. * @s1g_cap: S1G capabilities of this STA
  2336. * @agg: per-link data for multi-link aggregation
  2337. * @bandwidth: current bandwidth the station can receive with
  2338. * @rx_nss: in HT/VHT, the maximum number of spatial streams the
  2339. * station can receive at the moment, changed by operating mode
  2340. * notifications and capabilities. The value is only valid after
  2341. * the station moves to associated state.
  2342. * @txpwr: the station tx power configuration
  2343. *
  2344. */
  2345. struct ieee80211_link_sta {
  2346. struct ieee80211_sta *sta;
  2347. u8 addr[ETH_ALEN];
  2348. u8 link_id;
  2349. enum ieee80211_smps_mode smps_mode;
  2350. u32 supp_rates[NUM_NL80211_BANDS];
  2351. struct ieee80211_sta_ht_cap ht_cap;
  2352. struct ieee80211_sta_vht_cap vht_cap;
  2353. struct ieee80211_sta_he_cap he_cap;
  2354. struct ieee80211_he_6ghz_capa he_6ghz_capa;
  2355. struct ieee80211_sta_eht_cap eht_cap;
  2356. struct ieee80211_sta_uhr_cap uhr_cap;
  2357. struct ieee80211_sta_s1g_cap s1g_cap;
  2358. struct ieee80211_sta_aggregates agg;
  2359. u8 rx_nss;
  2360. enum ieee80211_sta_rx_bandwidth bandwidth;
  2361. struct ieee80211_sta_txpwr txpwr;
  2362. };
  2363. /**
  2364. * struct ieee80211_sta - station table entry
  2365. *
  2366. * A station table entry represents a station we are possibly
  2367. * communicating with. Since stations are RCU-managed in
  2368. * mac80211, any ieee80211_sta pointer you get access to must
  2369. * either be protected by rcu_read_lock() explicitly or implicitly,
  2370. * or you must take good care to not use such a pointer after a
  2371. * call to your sta_remove callback that removed it.
  2372. * This also represents the MLD STA in case of MLO association
  2373. * and holds pointers to various link STA's
  2374. *
  2375. * @addr: MAC address
  2376. * @aid: AID we assigned to the station if we're an AP
  2377. * @max_rx_aggregation_subframes: maximal amount of frames in a single AMPDU
  2378. * that this station is allowed to transmit to us.
  2379. * Can be modified by driver.
  2380. * @wme: indicates whether the STA supports QoS/WME (if local devices does,
  2381. * otherwise always false)
  2382. * @drv_priv: data area for driver use, will always be aligned to
  2383. * sizeof(void \*), size is determined in hw information.
  2384. * @uapsd_queues: bitmap of queues configured for uapsd. Only valid
  2385. * if wme is supported. The bits order is like in
  2386. * IEEE80211_WMM_IE_STA_QOSINFO_AC_*.
  2387. * @max_sp: max Service Period. Only valid if wme is supported.
  2388. * @rates: rate control selection table
  2389. * @tdls: indicates whether the STA is a TDLS peer
  2390. * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
  2391. * valid if the STA is a TDLS peer in the first place.
  2392. * @mfp: indicates whether the STA uses management frame protection or not.
  2393. * @mlo: indicates whether the STA is MLO station.
  2394. * @max_amsdu_subframes: indicates the maximal number of MSDUs in a single
  2395. * A-MSDU. Taken from the Extended Capabilities element. 0 means
  2396. * unlimited.
  2397. * @eml_cap: EML capabilities of this MLO station
  2398. * @cur: currently valid data as aggregated from the active links
  2399. * For non MLO STA it will point to the deflink data. For MLO STA
  2400. * ieee80211_sta_recalc_aggregates() must be called to update it.
  2401. * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not.
  2402. * @txq: per-TID data TX queues; note that the last entry (%IEEE80211_NUM_TIDS)
  2403. * is used for non-data frames
  2404. * @deflink: This holds the default link STA information, for non MLO STA all link
  2405. * specific STA information is accessed through @deflink or through
  2406. * link[0] which points to address of @deflink. For MLO Link STA
  2407. * the first added link STA will point to deflink.
  2408. * @link: reference to Link Sta entries. For Non MLO STA, except 1st link,
  2409. * i.e link[0] all links would be assigned to NULL by default and
  2410. * would access link information via @deflink or link[0]. For MLO
  2411. * STA, first link STA being added will point its link pointer to
  2412. * @deflink address and remaining would be allocated and the address
  2413. * would be assigned to link[link_id] where link_id is the id assigned
  2414. * by the AP.
  2415. * @valid_links: bitmap of valid links, or 0 for non-MLO
  2416. * @spp_amsdu: indicates whether the STA uses SPP A-MSDU or not.
  2417. * @epp_peer: indicates that the peer is an EPP peer.
  2418. */
  2419. struct ieee80211_sta {
  2420. u8 addr[ETH_ALEN] __aligned(2);
  2421. u16 aid;
  2422. u16 max_rx_aggregation_subframes;
  2423. bool wme;
  2424. u8 uapsd_queues;
  2425. u8 max_sp;
  2426. struct ieee80211_sta_rates __rcu *rates;
  2427. bool tdls;
  2428. bool tdls_initiator;
  2429. bool mfp;
  2430. bool mlo;
  2431. bool spp_amsdu;
  2432. u8 max_amsdu_subframes;
  2433. u16 eml_cap;
  2434. struct ieee80211_sta_aggregates *cur;
  2435. bool support_p2p_ps;
  2436. struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
  2437. u16 valid_links;
  2438. bool epp_peer;
  2439. struct ieee80211_link_sta deflink;
  2440. struct ieee80211_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
  2441. /* must be last */
  2442. u8 drv_priv[] __aligned(sizeof(void *));
  2443. };
  2444. #ifdef CONFIG_LOCKDEP
  2445. bool lockdep_sta_mutex_held(struct ieee80211_sta *pubsta);
  2446. #else
  2447. static inline bool lockdep_sta_mutex_held(struct ieee80211_sta *pubsta)
  2448. {
  2449. return true;
  2450. }
  2451. #endif
  2452. #define link_sta_dereference_protected(sta, link_id) \
  2453. rcu_dereference_protected((sta)->link[link_id], \
  2454. lockdep_sta_mutex_held(sta))
  2455. #define link_sta_dereference_check(sta, link_id) \
  2456. rcu_dereference_check((sta)->link[link_id], \
  2457. lockdep_sta_mutex_held(sta))
  2458. #define for_each_sta_active_link(vif, sta, link_sta, link_id) \
  2459. for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++) \
  2460. if ((!(vif)->active_links || \
  2461. (vif)->active_links & BIT(link_id)) && \
  2462. ((link_sta) = link_sta_dereference_check(sta, link_id)))
  2463. /**
  2464. * enum sta_notify_cmd - sta notify command
  2465. *
  2466. * Used with the sta_notify() callback in &struct ieee80211_ops, this
  2467. * indicates if an associated station made a power state transition.
  2468. *
  2469. * @STA_NOTIFY_SLEEP: a station is now sleeping
  2470. * @STA_NOTIFY_AWAKE: a sleeping station woke up
  2471. */
  2472. enum sta_notify_cmd {
  2473. STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE,
  2474. };
  2475. /**
  2476. * struct ieee80211_tx_control - TX control data
  2477. *
  2478. * @sta: station table entry, this sta pointer may be NULL and
  2479. * it is not allowed to copy the pointer, due to RCU.
  2480. */
  2481. struct ieee80211_tx_control {
  2482. struct ieee80211_sta *sta;
  2483. };
  2484. /**
  2485. * struct ieee80211_txq - Software intermediate tx queue
  2486. *
  2487. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  2488. * @sta: station table entry, %NULL for per-vif queue
  2489. * @tid: the TID for this queue (unused for per-vif queue),
  2490. * %IEEE80211_NUM_TIDS for non-data (if enabled)
  2491. * @ac: the AC for this queue
  2492. * @drv_priv: driver private area, sized by hw->txq_data_size
  2493. *
  2494. * The driver can obtain packets from this queue by calling
  2495. * ieee80211_tx_dequeue().
  2496. */
  2497. struct ieee80211_txq {
  2498. struct ieee80211_vif *vif;
  2499. struct ieee80211_sta *sta;
  2500. u8 tid;
  2501. u8 ac;
  2502. /* must be last */
  2503. u8 drv_priv[] __aligned(sizeof(void *));
  2504. };
  2505. /**
  2506. * enum ieee80211_hw_flags - hardware flags
  2507. *
  2508. * These flags are used to indicate hardware capabilities to
  2509. * the stack. Generally, flags here should have their meaning
  2510. * done in a way that the simplest hardware doesn't need setting
  2511. * any particular flags. There are some exceptions to this rule,
  2512. * however, so you are advised to review these flags carefully.
  2513. *
  2514. * @IEEE80211_HW_HAS_RATE_CONTROL:
  2515. * The hardware or firmware includes rate control, and cannot be
  2516. * controlled by the stack. As such, no rate control algorithm
  2517. * should be instantiated, and the TX rate reported to userspace
  2518. * will be taken from the TX status instead of the rate control
  2519. * algorithm.
  2520. * Note that this requires that the driver implement a number of
  2521. * callbacks so it has the correct information, it needs to have
  2522. * the @set_rts_threshold callback and must look at the BSS config
  2523. * @use_cts_prot for G/N protection, @use_short_slot for slot
  2524. * timing in 2.4 GHz and @use_short_preamble for preambles for
  2525. * CCK frames.
  2526. *
  2527. * @IEEE80211_HW_RX_INCLUDES_FCS:
  2528. * Indicates that received frames passed to the stack include
  2529. * the FCS at the end.
  2530. *
  2531. * @IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING:
  2532. * Some wireless LAN chipsets buffer broadcast/multicast frames
  2533. * for power saving stations in the hardware/firmware and others
  2534. * rely on the host system for such buffering. This option is used
  2535. * to configure the IEEE 802.11 upper layer to buffer broadcast and
  2536. * multicast frames when there are power saving stations so that
  2537. * the driver can fetch them with ieee80211_get_buffered_bc().
  2538. *
  2539. * @IEEE80211_HW_SIGNAL_UNSPEC:
  2540. * Hardware can provide signal values but we don't know its units. We
  2541. * expect values between 0 and @max_signal.
  2542. * If possible please provide dB or dBm instead.
  2543. *
  2544. * @IEEE80211_HW_SIGNAL_DBM:
  2545. * Hardware gives signal values in dBm, decibel difference from
  2546. * one milliwatt. This is the preferred method since it is standardized
  2547. * between different devices. @max_signal does not need to be set.
  2548. *
  2549. * @IEEE80211_HW_SPECTRUM_MGMT:
  2550. * Hardware supports spectrum management defined in 802.11h
  2551. * Measurement, Channel Switch, Quieting, TPC
  2552. *
  2553. * @IEEE80211_HW_AMPDU_AGGREGATION:
  2554. * Hardware supports 11n A-MPDU aggregation.
  2555. *
  2556. * @IEEE80211_HW_SUPPORTS_PS:
  2557. * Hardware has power save support (i.e. can go to sleep).
  2558. *
  2559. * @IEEE80211_HW_PS_NULLFUNC_STACK:
  2560. * Hardware requires nullfunc frame handling in stack, implies
  2561. * stack support for dynamic PS.
  2562. *
  2563. * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
  2564. * Hardware has support for dynamic PS.
  2565. *
  2566. * @IEEE80211_HW_MFP_CAPABLE:
  2567. * Hardware supports management frame protection (MFP, IEEE 802.11w).
  2568. *
  2569. * @IEEE80211_HW_REPORTS_TX_ACK_STATUS:
  2570. * Hardware can provide ack status reports of Tx frames to
  2571. * the stack.
  2572. *
  2573. * @IEEE80211_HW_CONNECTION_MONITOR:
  2574. * The hardware performs its own connection monitoring, including
  2575. * periodic keep-alives to the AP and probing the AP on beacon loss.
  2576. *
  2577. * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC:
  2578. * This device needs to get data from beacon before association (i.e.
  2579. * dtim_period).
  2580. *
  2581. * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports
  2582. * per-station GTKs as used by IBSS RSN or during fast transition. If
  2583. * the device doesn't support per-station GTKs, but can be asked not
  2584. * to decrypt group addressed frames, then IBSS RSN support is still
  2585. * possible but software crypto will be used. Advertise the wiphy flag
  2586. * only in that case.
  2587. *
  2588. * @IEEE80211_HW_AP_LINK_PS: When operating in AP mode the device
  2589. * autonomously manages the PS status of connected stations. When
  2590. * this flag is set mac80211 will not trigger PS mode for connected
  2591. * stations based on the PM bit of incoming frames.
  2592. * Use ieee80211_start_ps()/ieee8021_end_ps() to manually configure
  2593. * the PS mode of connected stations.
  2594. *
  2595. * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session
  2596. * setup strictly in HW. mac80211 should not attempt to do this in
  2597. * software.
  2598. *
  2599. * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of
  2600. * a virtual monitor interface when monitor interfaces are the only
  2601. * active interfaces.
  2602. *
  2603. * @IEEE80211_HW_NO_VIRTUAL_MONITOR: The driver would like to be informed
  2604. * of any monitor interface, as well as their configured channel.
  2605. * This is useful for supporting multiple monitor interfaces on different
  2606. * channels.
  2607. *
  2608. * @IEEE80211_HW_NO_AUTO_VIF: The driver would like for no wlanX to
  2609. * be created. It is expected user-space will create vifs as
  2610. * desired (and thus have them named as desired).
  2611. *
  2612. * @IEEE80211_HW_SW_CRYPTO_CONTROL: The driver wants to control which of the
  2613. * crypto algorithms can be done in software - so don't automatically
  2614. * try to fall back to it if hardware crypto fails, but do so only if
  2615. * the driver returns 1. This also forces the driver to advertise its
  2616. * supported cipher suites.
  2617. *
  2618. * @IEEE80211_HW_SUPPORT_FAST_XMIT: The driver/hardware supports fast-xmit,
  2619. * this currently requires only the ability to calculate the duration
  2620. * for frames.
  2621. *
  2622. * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface
  2623. * queue mapping in order to use different queues (not just one per AC)
  2624. * for different virtual interfaces. See the doc section on HW queue
  2625. * control for more details.
  2626. *
  2627. * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate
  2628. * selection table provided by the rate control algorithm.
  2629. *
  2630. * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
  2631. * P2P Interface. This will be honoured even if more than one interface
  2632. * is supported.
  2633. *
  2634. * @IEEE80211_HW_TIMING_BEACON_ONLY: Use sync timing from beacon frames
  2635. * only, to allow getting TBTT of a DTIM beacon.
  2636. *
  2637. * @IEEE80211_HW_SUPPORTS_HT_CCK_RATES: Hardware supports mixing HT/CCK rates
  2638. * and can cope with CCK rates in an aggregation session (e.g. by not
  2639. * using aggregation for such frames.)
  2640. *
  2641. * @IEEE80211_HW_CHANCTX_STA_CSA: Support 802.11h based channel-switch (CSA)
  2642. * for a single active channel while using channel contexts. When support
  2643. * is not enabled the default action is to disconnect when getting the
  2644. * CSA frame.
  2645. *
  2646. * @IEEE80211_HW_SUPPORTS_CLONED_SKBS: The driver will never modify the payload
  2647. * or tailroom of TX skbs without copying them first.
  2648. *
  2649. * @IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands
  2650. * in one command, mac80211 doesn't have to run separate scans per band.
  2651. *
  2652. * @IEEE80211_HW_TDLS_WIDER_BW: The device/driver supports wider bandwidth
  2653. * than then BSS bandwidth for a TDLS link on the base channel.
  2654. *
  2655. * @IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU: The driver supports receiving A-MSDUs
  2656. * within A-MPDU.
  2657. *
  2658. * @IEEE80211_HW_BEACON_TX_STATUS: The device/driver provides TX status
  2659. * for sent beacons.
  2660. *
  2661. * @IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR: Hardware (or driver) requires that each
  2662. * station has a unique address, i.e. each station entry can be identified
  2663. * by just its MAC address; this prevents, for example, the same station
  2664. * from connecting to two virtual AP interfaces at the same time.
  2665. *
  2666. * @IEEE80211_HW_SUPPORTS_REORDERING_BUFFER: Hardware (or driver) manages the
  2667. * reordering buffer internally, guaranteeing mac80211 receives frames in
  2668. * order and does not need to manage its own reorder buffer or BA session
  2669. * timeout.
  2670. *
  2671. * @IEEE80211_HW_USES_RSS: The device uses RSS and thus requires parallel RX,
  2672. * which implies using per-CPU station statistics.
  2673. *
  2674. * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  2675. * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  2676. * When not using minstrel/minstrel_ht rate control, the driver must
  2677. * limit the maximum A-MSDU size based on the current tx rate by setting
  2678. * max_rc_amsdu_len in struct ieee80211_sta.
  2679. *
  2680. * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  2681. * skbs, needed for zero-copy software A-MSDU.
  2682. *
  2683. * @IEEE80211_HW_REPORTS_LOW_ACK: The driver (or firmware) reports low ack event
  2684. * by ieee80211_report_low_ack() based on its own algorithm. For such
  2685. * drivers, mac80211 packet loss mechanism will not be triggered and driver
  2686. * is completely depending on firmware event for station kickout.
  2687. *
  2688. * @IEEE80211_HW_SUPPORTS_TX_FRAG: Hardware does fragmentation by itself.
  2689. * The stack will not do fragmentation.
  2690. * The callback for @set_frag_threshold should be set as well.
  2691. *
  2692. * @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on
  2693. * TDLS links.
  2694. *
  2695. * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't
  2696. * support QoS NDP for AP probing - that's most likely a driver bug.
  2697. *
  2698. * @IEEE80211_HW_BUFF_MMPDU_TXQ: use the TXQ for bufferable MMPDUs, this of
  2699. * course requires the driver to use TXQs to start with.
  2700. *
  2701. * @IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW: (Hardware) rate control supports VHT
  2702. * extended NSS BW (dot11VHTExtendedNSSBWCapable). This flag will be set if
  2703. * the selected rate control algorithm sets %RATE_CTRL_CAPA_VHT_EXT_NSS_BW
  2704. * but if the rate control is built-in then it must be set by the driver.
  2705. * See also the documentation for that flag.
  2706. *
  2707. * @IEEE80211_HW_STA_MMPDU_TXQ: use the extra non-TID per-station TXQ for all
  2708. * MMPDUs on station interfaces. This of course requires the driver to use
  2709. * TXQs to start with.
  2710. *
  2711. * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU
  2712. * length in tx status information
  2713. *
  2714. * @IEEE80211_HW_SUPPORTS_MULTI_BSSID: Hardware supports multi BSSID
  2715. *
  2716. * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
  2717. * only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
  2718. *
  2719. * @IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT: The card and driver is only
  2720. * aggregating MPDUs with the same keyid, allowing mac80211 to keep Tx
  2721. * A-MPDU sessions active while rekeying with Extended Key ID.
  2722. *
  2723. * @IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD: Hardware supports tx encapsulation
  2724. * offload
  2725. *
  2726. * @IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD: Hardware supports rx decapsulation
  2727. * offload
  2728. *
  2729. * @IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP: Hardware supports concurrent rx
  2730. * decapsulation offload and passing raw 802.11 frames for monitor iface.
  2731. * If this is supported, the driver must pass both 802.3 frames for real
  2732. * usage and 802.11 frames with %RX_FLAG_ONLY_MONITOR set for monitor to
  2733. * the stack.
  2734. *
  2735. * @IEEE80211_HW_DETECTS_COLOR_COLLISION: HW/driver has support for BSS color
  2736. * collision detection and doesn't need it in software.
  2737. *
  2738. * @IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX: Hardware/driver handles transmitting
  2739. * multicast frames on all links, mac80211 should not do that.
  2740. *
  2741. * @IEEE80211_HW_DISALLOW_PUNCTURING: HW requires disabling puncturing in EHT
  2742. * and connecting with a lower bandwidth instead
  2743. *
  2744. * @IEEE80211_HW_HANDLES_QUIET_CSA: HW/driver handles quieting for CSA, so
  2745. * no need to stop queues. This really should be set by a driver that
  2746. * implements MLO, so operation can continue on other links when one
  2747. * link is switching.
  2748. *
  2749. * @IEEE80211_HW_STRICT: strictly enforce certain things mandated by the spec
  2750. * but otherwise ignored/worked around for interoperability. This is a
  2751. * HW flag so drivers can opt in according to their own control, e.g. in
  2752. * testing.
  2753. *
  2754. * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  2755. */
  2756. enum ieee80211_hw_flags {
  2757. IEEE80211_HW_HAS_RATE_CONTROL,
  2758. IEEE80211_HW_RX_INCLUDES_FCS,
  2759. IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING,
  2760. IEEE80211_HW_SIGNAL_UNSPEC,
  2761. IEEE80211_HW_SIGNAL_DBM,
  2762. IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC,
  2763. IEEE80211_HW_SPECTRUM_MGMT,
  2764. IEEE80211_HW_AMPDU_AGGREGATION,
  2765. IEEE80211_HW_SUPPORTS_PS,
  2766. IEEE80211_HW_PS_NULLFUNC_STACK,
  2767. IEEE80211_HW_SUPPORTS_DYNAMIC_PS,
  2768. IEEE80211_HW_MFP_CAPABLE,
  2769. IEEE80211_HW_WANT_MONITOR_VIF,
  2770. IEEE80211_HW_NO_VIRTUAL_MONITOR,
  2771. IEEE80211_HW_NO_AUTO_VIF,
  2772. IEEE80211_HW_SW_CRYPTO_CONTROL,
  2773. IEEE80211_HW_SUPPORT_FAST_XMIT,
  2774. IEEE80211_HW_REPORTS_TX_ACK_STATUS,
  2775. IEEE80211_HW_CONNECTION_MONITOR,
  2776. IEEE80211_HW_QUEUE_CONTROL,
  2777. IEEE80211_HW_SUPPORTS_PER_STA_GTK,
  2778. IEEE80211_HW_AP_LINK_PS,
  2779. IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
  2780. IEEE80211_HW_SUPPORTS_RC_TABLE,
  2781. IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF,
  2782. IEEE80211_HW_TIMING_BEACON_ONLY,
  2783. IEEE80211_HW_SUPPORTS_HT_CCK_RATES,
  2784. IEEE80211_HW_CHANCTX_STA_CSA,
  2785. IEEE80211_HW_SUPPORTS_CLONED_SKBS,
  2786. IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,
  2787. IEEE80211_HW_TDLS_WIDER_BW,
  2788. IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
  2789. IEEE80211_HW_BEACON_TX_STATUS,
  2790. IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  2791. IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  2792. IEEE80211_HW_USES_RSS,
  2793. IEEE80211_HW_TX_AMSDU,
  2794. IEEE80211_HW_TX_FRAG_LIST,
  2795. IEEE80211_HW_REPORTS_LOW_ACK,
  2796. IEEE80211_HW_SUPPORTS_TX_FRAG,
  2797. IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA,
  2798. IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP,
  2799. IEEE80211_HW_BUFF_MMPDU_TXQ,
  2800. IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
  2801. IEEE80211_HW_STA_MMPDU_TXQ,
  2802. IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
  2803. IEEE80211_HW_SUPPORTS_MULTI_BSSID,
  2804. IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
  2805. IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT,
  2806. IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD,
  2807. IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD,
  2808. IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP,
  2809. IEEE80211_HW_DETECTS_COLOR_COLLISION,
  2810. IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX,
  2811. IEEE80211_HW_DISALLOW_PUNCTURING,
  2812. IEEE80211_HW_HANDLES_QUIET_CSA,
  2813. IEEE80211_HW_STRICT,
  2814. /* keep last, obviously */
  2815. NUM_IEEE80211_HW_FLAGS
  2816. };
  2817. /**
  2818. * struct ieee80211_hw - hardware information and state
  2819. *
  2820. * This structure contains the configuration and hardware
  2821. * information for an 802.11 PHY.
  2822. *
  2823. * @wiphy: This points to the &struct wiphy allocated for this
  2824. * 802.11 PHY. You must fill in the @perm_addr and @dev
  2825. * members of this structure using SET_IEEE80211_DEV()
  2826. * and SET_IEEE80211_PERM_ADDR(). Additionally, all supported
  2827. * bands (with channels, bitrates) are registered here.
  2828. *
  2829. * @conf: &struct ieee80211_conf, device configuration, don't use.
  2830. *
  2831. * @priv: pointer to private area that was allocated for driver use
  2832. * along with this structure.
  2833. *
  2834. * @flags: hardware flags, see &enum ieee80211_hw_flags.
  2835. *
  2836. * @extra_tx_headroom: headroom to reserve in each transmit skb
  2837. * for use by the driver (e.g. for transmit headers.)
  2838. *
  2839. * @extra_beacon_tailroom: tailroom to reserve in each beacon tx skb.
  2840. * Can be used by drivers to add extra IEs.
  2841. *
  2842. * @max_signal: Maximum value for signal (rssi) in RX information, used
  2843. * only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB
  2844. *
  2845. * @max_listen_interval: max listen interval in units of beacon interval
  2846. * that HW supports
  2847. *
  2848. * @queues: number of available hardware transmit queues for
  2849. * data packets. WMM/QoS requires at least four, these
  2850. * queues need to have configurable access parameters.
  2851. *
  2852. * @rate_control_algorithm: rate control algorithm for this hardware.
  2853. * If unset (NULL), the default algorithm will be used. Must be
  2854. * set before calling ieee80211_register_hw().
  2855. *
  2856. * @vif_data_size: size (in bytes) of the drv_priv data area
  2857. * within &struct ieee80211_vif.
  2858. * @sta_data_size: size (in bytes) of the drv_priv data area
  2859. * within &struct ieee80211_sta.
  2860. * @chanctx_data_size: size (in bytes) of the drv_priv data area
  2861. * within &struct ieee80211_chanctx_conf.
  2862. * @txq_data_size: size (in bytes) of the drv_priv data area
  2863. * within @struct ieee80211_txq.
  2864. *
  2865. * @max_rates: maximum number of alternate rate retry stages the hw
  2866. * can handle.
  2867. * @max_report_rates: maximum number of alternate rate retry stages
  2868. * the hw can report back.
  2869. * @max_rate_tries: maximum number of tries for each stage
  2870. *
  2871. * @max_rx_aggregation_subframes: maximum buffer size (number of
  2872. * sub-frames) to be used for A-MPDU block ack receiver
  2873. * aggregation.
  2874. * This is only relevant if the device has restrictions on the
  2875. * number of subframes, if it relies on mac80211 to do reordering
  2876. * it shouldn't be set.
  2877. *
  2878. * @max_tx_aggregation_subframes: maximum number of subframes in an
  2879. * aggregate an HT/HE device will transmit. In HT AddBA we'll
  2880. * advertise a constant value of 64 as some older APs crash if
  2881. * the window size is smaller (an example is LinkSys WRT120N
  2882. * with FW v1.0.07 build 002 Jun 18 2012).
  2883. * For AddBA to HE capable peers this value will be used.
  2884. *
  2885. * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  2886. * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  2887. *
  2888. * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  2889. * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  2890. *
  2891. * @radiotap_mcs_details: lists which MCS information can the HW
  2892. * reports, by default it is set to _MCS, _GI and _BW but doesn't
  2893. * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_\* values, only
  2894. * adding _BW is supported today.
  2895. *
  2896. * @radiotap_vht_details: lists which VHT MCS information the HW reports,
  2897. * the default is _GI | _BANDWIDTH.
  2898. * Use the %IEEE80211_RADIOTAP_VHT_KNOWN_\* values.
  2899. *
  2900. * @radiotap_timestamp: Information for the radiotap timestamp field; if the
  2901. * @units_pos member is set to a non-negative value then the timestamp
  2902. * field will be added and populated from the &struct ieee80211_rx_status
  2903. * device_timestamp.
  2904. * @radiotap_timestamp.units_pos: Must be set to a combination of a
  2905. * IEEE80211_RADIOTAP_TIMESTAMP_UNIT_* and a
  2906. * IEEE80211_RADIOTAP_TIMESTAMP_SPOS_* value.
  2907. * @radiotap_timestamp.accuracy: If non-negative, fills the accuracy in the
  2908. * radiotap field and the accuracy known flag will be set.
  2909. *
  2910. * @netdev_features: netdev features to be set in each netdev created
  2911. * from this HW. Note that not all features are usable with mac80211,
  2912. * other features will be rejected during HW registration.
  2913. *
  2914. * @uapsd_queues: This bitmap is included in (re)association frame to indicate
  2915. * for each access category if it is uAPSD trigger-enabled and delivery-
  2916. * enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap.
  2917. * Each bit corresponds to different AC. Value '1' in specific bit means
  2918. * that corresponding AC is both trigger- and delivery-enabled. '0' means
  2919. * neither enabled.
  2920. *
  2921. * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may
  2922. * deliver to a WMM STA during any Service Period triggered by the WMM STA.
  2923. * Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values.
  2924. *
  2925. * @max_nan_de_entries: maximum number of NAN DE functions supported by the
  2926. * device.
  2927. *
  2928. * @tx_sk_pacing_shift: Pacing shift to set on TCP sockets when frames from
  2929. * them are encountered. The default should typically not be changed,
  2930. * unless the driver has good reasons for needing more buffers.
  2931. *
  2932. * @weight_multiplier: Driver specific airtime weight multiplier used while
  2933. * refilling deficit of each TXQ.
  2934. *
  2935. * @max_mtu: the max mtu could be set.
  2936. *
  2937. * @tx_power_levels: a list of power levels supported by the wifi hardware.
  2938. * The power levels can be specified either as integer or fractions.
  2939. * The power level at idx 0 shall be the maximum positive power level.
  2940. *
  2941. * @max_txpwr_levels_idx: the maximum valid idx of 'tx_power_levels' list.
  2942. */
  2943. struct ieee80211_hw {
  2944. struct ieee80211_conf conf;
  2945. struct wiphy *wiphy;
  2946. const char *rate_control_algorithm;
  2947. void *priv;
  2948. unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];
  2949. unsigned int extra_tx_headroom;
  2950. unsigned int extra_beacon_tailroom;
  2951. int vif_data_size;
  2952. int sta_data_size;
  2953. int chanctx_data_size;
  2954. int txq_data_size;
  2955. u16 queues;
  2956. u16 max_listen_interval;
  2957. s8 max_signal;
  2958. u8 max_rates;
  2959. u8 max_report_rates;
  2960. u8 max_rate_tries;
  2961. u16 max_rx_aggregation_subframes;
  2962. u16 max_tx_aggregation_subframes;
  2963. u8 max_tx_fragments;
  2964. u8 offchannel_tx_hw_queue;
  2965. u8 radiotap_mcs_details;
  2966. u16 radiotap_vht_details;
  2967. struct {
  2968. int units_pos;
  2969. s16 accuracy;
  2970. } radiotap_timestamp;
  2971. netdev_features_t netdev_features;
  2972. u8 uapsd_queues;
  2973. u8 uapsd_max_sp_len;
  2974. u8 max_nan_de_entries;
  2975. u8 tx_sk_pacing_shift;
  2976. u8 weight_multiplier;
  2977. u32 max_mtu;
  2978. const s8 *tx_power_levels;
  2979. u8 max_txpwr_levels_idx;
  2980. };
  2981. static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
  2982. enum ieee80211_hw_flags flg)
  2983. {
  2984. return test_bit(flg, hw->flags);
  2985. }
  2986. #define ieee80211_hw_check(hw, flg) _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
  2987. static inline void _ieee80211_hw_set(struct ieee80211_hw *hw,
  2988. enum ieee80211_hw_flags flg)
  2989. {
  2990. return __set_bit(flg, hw->flags);
  2991. }
  2992. #define ieee80211_hw_set(hw, flg) _ieee80211_hw_set(hw, IEEE80211_HW_##flg)
  2993. /**
  2994. * struct ieee80211_scan_request - hw scan request
  2995. *
  2996. * @ies: pointers different parts of IEs (in req.ie)
  2997. * @req: cfg80211 request.
  2998. */
  2999. struct ieee80211_scan_request {
  3000. struct ieee80211_scan_ies ies;
  3001. /* Keep last */
  3002. struct cfg80211_scan_request req;
  3003. };
  3004. /**
  3005. * struct ieee80211_tdls_ch_sw_params - TDLS channel switch parameters
  3006. *
  3007. * @sta: peer this TDLS channel-switch request/response came from
  3008. * @chandef: channel referenced in a TDLS channel-switch request
  3009. * @action_code: see &enum ieee80211_tdls_actioncode
  3010. * @status: channel-switch response status
  3011. * @timestamp: time at which the frame was received
  3012. * @switch_time: switch-timing parameter received in the frame
  3013. * @switch_timeout: switch-timing parameter received in the frame
  3014. * @tmpl_skb: TDLS switch-channel response template
  3015. * @ch_sw_tm_ie: offset of the channel-switch timing IE inside @tmpl_skb
  3016. */
  3017. struct ieee80211_tdls_ch_sw_params {
  3018. struct ieee80211_sta *sta;
  3019. struct cfg80211_chan_def *chandef;
  3020. u8 action_code;
  3021. u32 status;
  3022. u32 timestamp;
  3023. u16 switch_time;
  3024. u16 switch_timeout;
  3025. struct sk_buff *tmpl_skb;
  3026. u32 ch_sw_tm_ie;
  3027. };
  3028. /**
  3029. * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
  3030. *
  3031. * @wiphy: the &struct wiphy which we want to query
  3032. *
  3033. * mac80211 drivers can use this to get to their respective
  3034. * &struct ieee80211_hw. Drivers wishing to get to their own private
  3035. * structure can then access it via hw->priv. Note that mac802111 drivers should
  3036. * not use wiphy_priv() to try to get their private driver structure as this
  3037. * is already used internally by mac80211.
  3038. *
  3039. * Return: The mac80211 driver hw struct of @wiphy.
  3040. */
  3041. struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
  3042. /**
  3043. * SET_IEEE80211_DEV - set device for 802.11 hardware
  3044. *
  3045. * @hw: the &struct ieee80211_hw to set the device for
  3046. * @dev: the &struct device of this 802.11 device
  3047. */
  3048. static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
  3049. {
  3050. set_wiphy_dev(hw->wiphy, dev);
  3051. }
  3052. /**
  3053. * SET_IEEE80211_PERM_ADDR - set the permanent MAC address for 802.11 hardware
  3054. *
  3055. * @hw: the &struct ieee80211_hw to set the MAC address for
  3056. * @addr: the address to set
  3057. */
  3058. static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, const u8 *addr)
  3059. {
  3060. memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
  3061. }
  3062. static inline struct ieee80211_rate *
  3063. ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
  3064. const struct ieee80211_tx_info *c)
  3065. {
  3066. if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
  3067. return NULL;
  3068. if (c->band >= NUM_NL80211_BANDS)
  3069. return NULL;
  3070. return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
  3071. }
  3072. static inline struct ieee80211_rate *
  3073. ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
  3074. const struct ieee80211_tx_info *c)
  3075. {
  3076. if (c->control.rts_cts_rate_idx < 0)
  3077. return NULL;
  3078. return &hw->wiphy->bands[c->band]->bitrates[c->control.rts_cts_rate_idx];
  3079. }
  3080. static inline struct ieee80211_rate *
  3081. ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
  3082. const struct ieee80211_tx_info *c, int idx)
  3083. {
  3084. if (c->control.rates[idx + 1].idx < 0)
  3085. return NULL;
  3086. return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];
  3087. }
  3088. /**
  3089. * ieee80211_free_txskb - free TX skb
  3090. * @hw: the hardware
  3091. * @skb: the skb
  3092. *
  3093. * Free a transmit skb. Use this function when some failure
  3094. * to transmit happened and thus status cannot be reported.
  3095. */
  3096. void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
  3097. /**
  3098. * ieee80211_purge_tx_queue - purge TX skb queue
  3099. * @hw: the hardware
  3100. * @skbs: the skbs
  3101. *
  3102. * Free a set of transmit skbs. Use this function when device is going to stop
  3103. * but some transmit skbs without TX status are still queued.
  3104. * This function does not take the list lock and the caller must hold the
  3105. * relevant locks to use it.
  3106. */
  3107. void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
  3108. struct sk_buff_head *skbs);
  3109. /**
  3110. * DOC: Hardware crypto acceleration
  3111. *
  3112. * mac80211 is capable of taking advantage of many hardware
  3113. * acceleration designs for encryption and decryption operations.
  3114. *
  3115. * The set_key() callback in the &struct ieee80211_ops for a given
  3116. * device is called to enable hardware acceleration of encryption and
  3117. * decryption. The callback takes a @sta parameter that will be NULL
  3118. * for default keys or keys used for transmission only, or point to
  3119. * the station information for the peer for individual keys.
  3120. * Multiple transmission keys with the same key index may be used when
  3121. * VLANs are configured for an access point.
  3122. *
  3123. * When transmitting, the TX control data will use the @hw_key_idx
  3124. * selected by the driver by modifying the &struct ieee80211_key_conf
  3125. * pointed to by the @key parameter to the set_key() function.
  3126. *
  3127. * The set_key() call for the %SET_KEY command should return 0 if
  3128. * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be
  3129. * added; if you return 0 then hw_key_idx must be assigned to the
  3130. * hardware key index. You are free to use the full u8 range.
  3131. *
  3132. * Note that in the case that the @IEEE80211_HW_SW_CRYPTO_CONTROL flag is
  3133. * set, mac80211 will not automatically fall back to software crypto if
  3134. * enabling hardware crypto failed. The set_key() call may also return the
  3135. * value 1 to permit this specific key/algorithm to be done in software.
  3136. *
  3137. * When the cmd is %DISABLE_KEY then it must succeed.
  3138. *
  3139. * Note that it is permissible to not decrypt a frame even if a key
  3140. * for it has been uploaded to hardware. The stack will not make any
  3141. * decision based on whether a key has been uploaded or not but rather
  3142. * based on the receive flags.
  3143. *
  3144. * The &struct ieee80211_key_conf structure pointed to by the @key
  3145. * parameter is guaranteed to be valid until another call to set_key()
  3146. * removes it, but it can only be used as a cookie to differentiate
  3147. * keys.
  3148. *
  3149. * In TKIP some HW need to be provided a phase 1 key, for RX decryption
  3150. * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key
  3151. * handler.
  3152. * The update_tkip_key() call updates the driver with the new phase 1 key.
  3153. * This happens every time the iv16 wraps around (every 65536 packets). The
  3154. * set_key() call will happen only once for each key (unless the AP did
  3155. * rekeying); it will not include a valid phase 1 key. The valid phase 1 key is
  3156. * provided by update_tkip_key only. The trigger that makes mac80211 call this
  3157. * handler is software decryption with wrap around of iv16.
  3158. *
  3159. * The set_default_unicast_key() call updates the default WEP key index
  3160. * configured to the hardware for WEP encryption type. This is required
  3161. * for devices that support offload of data packets (e.g. ARP responses).
  3162. *
  3163. * Mac80211 drivers should set the @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 flag
  3164. * when they are able to replace in-use PTK keys according to the following
  3165. * requirements:
  3166. * 1) They do not hand over frames decrypted with the old key to mac80211
  3167. once the call to set_key() with command %DISABLE_KEY has been completed,
  3168. 2) either drop or continue to use the old key for any outgoing frames queued
  3169. at the time of the key deletion (including re-transmits),
  3170. 3) never send out a frame queued prior to the set_key() %SET_KEY command
  3171. encrypted with the new key when also needing
  3172. @IEEE80211_KEY_FLAG_GENERATE_IV and
  3173. 4) never send out a frame unencrypted when it should be encrypted.
  3174. Mac80211 will not queue any new frames for a deleted key to the driver.
  3175. */
  3176. /**
  3177. * DOC: Powersave support
  3178. *
  3179. * mac80211 has support for various powersave implementations.
  3180. *
  3181. * First, it can support hardware that handles all powersaving by itself;
  3182. * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware
  3183. * flag. In that case, it will be told about the desired powersave mode
  3184. * with the %IEEE80211_CONF_PS flag depending on the association status.
  3185. * The hardware must take care of sending nullfunc frames when necessary,
  3186. * i.e. when entering and leaving powersave mode. The hardware is required
  3187. * to look at the AID in beacons and signal to the AP that it woke up when
  3188. * it finds traffic directed to it.
  3189. *
  3190. * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in
  3191. * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused
  3192. * with hardware wakeup and sleep states. Driver is responsible for waking
  3193. * up the hardware before issuing commands to the hardware and putting it
  3194. * back to sleep at appropriate times.
  3195. *
  3196. * When PS is enabled, hardware needs to wakeup for beacons and receive the
  3197. * buffered multicast/broadcast frames after the beacon. Also it must be
  3198. * possible to send frames and receive the acknowledment frame.
  3199. *
  3200. * Other hardware designs cannot send nullfunc frames by themselves and also
  3201. * need software support for parsing the TIM bitmap. This is also supported
  3202. * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
  3203. * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
  3204. * required to pass up beacons. The hardware is still required to handle
  3205. * waking up for multicast traffic; if it cannot the driver must handle that
  3206. * as best as it can; mac80211 is too slow to do that.
  3207. *
  3208. * Dynamic powersave is an extension to normal powersave in which the
  3209. * hardware stays awake for a user-specified period of time after sending a
  3210. * frame so that reply frames need not be buffered and therefore delayed to
  3211. * the next wakeup. It's a compromise of getting good enough latency when
  3212. * there's data traffic and still saving significantly power in idle
  3213. * periods.
  3214. *
  3215. * Dynamic powersave is simply supported by mac80211 enabling and disabling
  3216. * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS
  3217. * flag and mac80211 will handle everything automatically. Additionally,
  3218. * hardware having support for the dynamic PS feature may set the
  3219. * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support
  3220. * dynamic PS mode itself. The driver needs to look at the
  3221. * @dynamic_ps_timeout hardware configuration value and use it that value
  3222. * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable
  3223. * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
  3224. * enabled whenever user has enabled powersave.
  3225. *
  3226. * Driver informs U-APSD client support by enabling
  3227. * %IEEE80211_VIF_SUPPORTS_UAPSD flag. The mode is configured through the
  3228. * uapsd parameter in conf_tx() operation. Hardware needs to send the QoS
  3229. * Nullfunc frames and stay awake until the service period has ended. To
  3230. * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames
  3231. * from that AC are transmitted with powersave enabled.
  3232. *
  3233. * Note: U-APSD client mode is not yet supported with
  3234. * %IEEE80211_HW_PS_NULLFUNC_STACK.
  3235. */
  3236. /**
  3237. * DOC: Beacon filter support
  3238. *
  3239. * Some hardware have beacon filter support to reduce host cpu wakeups
  3240. * which will reduce system power consumption. It usually works so that
  3241. * the firmware creates a checksum of the beacon but omits all constantly
  3242. * changing elements (TSF, TIM etc). Whenever the checksum changes the
  3243. * beacon is forwarded to the host, otherwise it will be just dropped. That
  3244. * way the host will only receive beacons where some relevant information
  3245. * (for example ERP protection or WMM settings) have changed.
  3246. *
  3247. * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER
  3248. * interface capability. The driver needs to enable beacon filter support
  3249. * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
  3250. * power save is enabled, the stack will not check for beacon loss and the
  3251. * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
  3252. *
  3253. * The time (or number of beacons missed) until the firmware notifies the
  3254. * driver of a beacon loss event (which in turn causes the driver to call
  3255. * ieee80211_beacon_loss()) should be configurable and will be controlled
  3256. * by mac80211 and the roaming algorithm in the future.
  3257. *
  3258. * Since there may be constantly changing information elements that nothing
  3259. * in the software stack cares about, we will, in the future, have mac80211
  3260. * tell the driver which information elements are interesting in the sense
  3261. * that we want to see changes in them. This will include
  3262. *
  3263. * - a list of information element IDs
  3264. * - a list of OUIs for the vendor information element
  3265. *
  3266. * Ideally, the hardware would filter out any beacons without changes in the
  3267. * requested elements, but if it cannot support that it may, at the expense
  3268. * of some efficiency, filter out only a subset. For example, if the device
  3269. * doesn't support checking for OUIs it should pass up all changes in all
  3270. * vendor information elements.
  3271. *
  3272. * Note that change, for the sake of simplification, also includes information
  3273. * elements appearing or disappearing from the beacon.
  3274. *
  3275. * Some hardware supports an "ignore list" instead. Just make sure nothing
  3276. * that was requested is on the ignore list, and include commonly changing
  3277. * information element IDs in the ignore list, for example 11 (BSS load) and
  3278. * the various vendor-assigned IEs with unknown contents (128, 129, 133-136,
  3279. * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility
  3280. * it could also include some currently unused IDs.
  3281. *
  3282. *
  3283. * In addition to these capabilities, hardware should support notifying the
  3284. * host of changes in the beacon RSSI. This is relevant to implement roaming
  3285. * when no traffic is flowing (when traffic is flowing we see the RSSI of
  3286. * the received data packets). This can consist of notifying the host when
  3287. * the RSSI changes significantly or when it drops below or rises above
  3288. * configurable thresholds. In the future these thresholds will also be
  3289. * configured by mac80211 (which gets them from userspace) to implement
  3290. * them as the roaming algorithm requires.
  3291. *
  3292. * If the hardware cannot implement this, the driver should ask it to
  3293. * periodically pass beacon frames to the host so that software can do the
  3294. * signal strength threshold checking.
  3295. */
  3296. /**
  3297. * DOC: Spatial multiplexing power save
  3298. *
  3299. * SMPS (Spatial multiplexing power save) is a mechanism to conserve
  3300. * power in an 802.11n implementation. For details on the mechanism
  3301. * and rationale, please refer to 802.11 (as amended by 802.11n-2009)
  3302. * "11.2.3 SM power save".
  3303. *
  3304. * The mac80211 implementation is capable of sending action frames
  3305. * to update the AP about the station's SMPS mode, and will instruct
  3306. * the driver to enter the specific mode. It will also announce the
  3307. * requested SMPS mode during the association handshake. Hardware
  3308. * support for this feature is required, and can be indicated by
  3309. * hardware flags.
  3310. *
  3311. * The default mode will be "automatic", which nl80211/cfg80211
  3312. * defines to be dynamic SMPS in (regular) powersave, and SMPS
  3313. * turned off otherwise.
  3314. *
  3315. * To support this feature, the driver must set the appropriate
  3316. * hardware support flags, and handle the SMPS flag to the config()
  3317. * operation. It will then with this mechanism be instructed to
  3318. * enter the requested SMPS mode while associated to an HT AP.
  3319. */
  3320. /**
  3321. * DOC: Frame filtering
  3322. *
  3323. * mac80211 requires to see many management frames for proper
  3324. * operation, and users may want to see many more frames when
  3325. * in monitor mode. However, for best CPU usage and power consumption,
  3326. * having as few frames as possible percolate through the stack is
  3327. * desirable. Hence, the hardware should filter as much as possible.
  3328. *
  3329. * To achieve this, mac80211 uses filter flags (see below) to tell
  3330. * the driver's configure_filter() function which frames should be
  3331. * passed to mac80211 and which should be filtered out.
  3332. *
  3333. * Before configure_filter() is invoked, the prepare_multicast()
  3334. * callback is invoked with the parameters @mc_count and @mc_list
  3335. * for the combined multicast address list of all virtual interfaces.
  3336. * It's use is optional, and it returns a u64 that is passed to
  3337. * configure_filter(). Additionally, configure_filter() has the
  3338. * arguments @changed_flags telling which flags were changed and
  3339. * @total_flags with the new flag states.
  3340. *
  3341. * If your device has no multicast address filters your driver will
  3342. * need to check both the %FIF_ALLMULTI flag and the @mc_count
  3343. * parameter to see whether multicast frames should be accepted
  3344. * or dropped.
  3345. *
  3346. * All unsupported flags in @total_flags must be cleared.
  3347. * Hardware does not support a flag if it is incapable of _passing_
  3348. * the frame to the stack. Otherwise the driver must ignore
  3349. * the flag, but not clear it.
  3350. * You must _only_ clear the flag (announce no support for the
  3351. * flag to mac80211) if you are not able to pass the packet type
  3352. * to the stack (so the hardware always filters it).
  3353. * So for example, you should clear @FIF_CONTROL, if your hardware
  3354. * always filters control frames. If your hardware always passes
  3355. * control frames to the kernel and is incapable of filtering them,
  3356. * you do _not_ clear the @FIF_CONTROL flag.
  3357. * This rule applies to all other FIF flags as well.
  3358. */
  3359. /**
  3360. * DOC: AP support for powersaving clients
  3361. *
  3362. * In order to implement AP and P2P GO modes, mac80211 has support for
  3363. * client powersaving, both "legacy" PS (PS-Poll/null data) and uAPSD.
  3364. * There currently is no support for sAPSD.
  3365. *
  3366. * There is one assumption that mac80211 makes, namely that a client
  3367. * will not poll with PS-Poll and trigger with uAPSD at the same time.
  3368. * Both are supported, and both can be used by the same client, but
  3369. * they can't be used concurrently by the same client. This simplifies
  3370. * the driver code.
  3371. *
  3372. * The first thing to keep in mind is that there is a flag for complete
  3373. * driver implementation: %IEEE80211_HW_AP_LINK_PS. If this flag is set,
  3374. * mac80211 expects the driver to handle most of the state machine for
  3375. * powersaving clients and will ignore the PM bit in incoming frames.
  3376. * Drivers then use ieee80211_sta_ps_transition() to inform mac80211 of
  3377. * stations' powersave transitions. In this mode, mac80211 also doesn't
  3378. * handle PS-Poll/uAPSD.
  3379. *
  3380. * In the mode without %IEEE80211_HW_AP_LINK_PS, mac80211 will check the
  3381. * PM bit in incoming frames for client powersave transitions. When a
  3382. * station goes to sleep, we will stop transmitting to it. There is,
  3383. * however, a race condition: a station might go to sleep while there is
  3384. * data buffered on hardware queues. If the device has support for this
  3385. * it will reject frames, and the driver should give the frames back to
  3386. * mac80211 with the %IEEE80211_TX_STAT_TX_FILTERED flag set which will
  3387. * cause mac80211 to retry the frame when the station wakes up. The
  3388. * driver is also notified of powersave transitions by calling its
  3389. * @sta_notify callback.
  3390. *
  3391. * When the station is asleep, it has three choices: it can wake up,
  3392. * it can PS-Poll, or it can possibly start a uAPSD service period.
  3393. * Waking up is implemented by simply transmitting all buffered (and
  3394. * filtered) frames to the station. This is the easiest case. When
  3395. * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
  3396. * will inform the driver of this with the @allow_buffered_frames
  3397. * callback; this callback is optional. mac80211 will then transmit
  3398. * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
  3399. * on each frame. The last frame in the service period (or the only
  3400. * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
  3401. * indicate that it ends the service period; as this frame must have
  3402. * TX status report it also sets %IEEE80211_TX_CTL_REQ_TX_STATUS.
  3403. * When TX status is reported for this frame, the service period is
  3404. * marked has having ended and a new one can be started by the peer.
  3405. *
  3406. * Additionally, non-bufferable MMPDUs can also be transmitted by
  3407. * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
  3408. *
  3409. * Another race condition can happen on some devices like iwlwifi
  3410. * when there are frames queued for the station and it wakes up
  3411. * or polls; the frames that are already queued could end up being
  3412. * transmitted first instead, causing reordering and/or wrong
  3413. * processing of the EOSP. The cause is that allowing frames to be
  3414. * transmitted to a certain station is out-of-band communication to
  3415. * the device. To allow this problem to be solved, the driver can
  3416. * call ieee80211_sta_block_awake() if frames are buffered when it
  3417. * is notified that the station went to sleep. When all these frames
  3418. * have been filtered (see above), it must call the function again
  3419. * to indicate that the station is no longer blocked.
  3420. *
  3421. * If the driver buffers frames in the driver for aggregation in any
  3422. * way, it must use the ieee80211_sta_set_buffered() call when it is
  3423. * notified of the station going to sleep to inform mac80211 of any
  3424. * TIDs that have frames buffered. Note that when a station wakes up
  3425. * this information is reset (hence the requirement to call it when
  3426. * informed of the station going to sleep). Then, when a service
  3427. * period starts for any reason, @release_buffered_frames is called
  3428. * with the number of frames to be released and which TIDs they are
  3429. * to come from. In this case, the driver is responsible for setting
  3430. * the EOSP (for uAPSD) and MORE_DATA bits in the released frames.
  3431. * To help the @more_data parameter is passed to tell the driver if
  3432. * there is more data on other TIDs -- the TIDs to release frames
  3433. * from are ignored since mac80211 doesn't know how many frames the
  3434. * buffers for those TIDs contain.
  3435. *
  3436. * If the driver also implement GO mode, where absence periods may
  3437. * shorten service periods (or abort PS-Poll responses), it must
  3438. * filter those response frames except in the case of frames that
  3439. * are buffered in the driver -- those must remain buffered to avoid
  3440. * reordering. Because it is possible that no frames are released
  3441. * in this case, the driver must call ieee80211_sta_eosp()
  3442. * to indicate to mac80211 that the service period ended anyway.
  3443. *
  3444. * Finally, if frames from multiple TIDs are released from mac80211
  3445. * but the driver might reorder them, it must clear & set the flags
  3446. * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP)
  3447. * and also take care of the EOSP and MORE_DATA bits in the frame.
  3448. * The driver may also use ieee80211_sta_eosp() in this case.
  3449. *
  3450. * Note that if the driver ever buffers frames other than QoS-data
  3451. * frames, it must take care to never send a non-QoS-data frame as
  3452. * the last frame in a service period, adding a QoS-nulldata frame
  3453. * after a non-QoS-data frame if needed.
  3454. */
  3455. /**
  3456. * DOC: HW queue control
  3457. *
  3458. * Before HW queue control was introduced, mac80211 only had a single static
  3459. * assignment of per-interface AC software queues to hardware queues. This
  3460. * was problematic for a few reasons:
  3461. * 1) off-channel transmissions might get stuck behind other frames
  3462. * 2) multiple virtual interfaces couldn't be handled correctly
  3463. * 3) after-DTIM frames could get stuck behind other frames
  3464. *
  3465. * To solve this, hardware typically uses multiple different queues for all
  3466. * the different usages, and this needs to be propagated into mac80211 so it
  3467. * won't have the same problem with the software queues.
  3468. *
  3469. * Therefore, mac80211 now offers the %IEEE80211_HW_QUEUE_CONTROL capability
  3470. * flag that tells it that the driver implements its own queue control. To do
  3471. * so, the driver will set up the various queues in each &struct ieee80211_vif
  3472. * and the offchannel queue in &struct ieee80211_hw. In response, mac80211 will
  3473. * use those queue IDs in the hw_queue field of &struct ieee80211_tx_info and
  3474. * if necessary will queue the frame on the right software queue that mirrors
  3475. * the hardware queue.
  3476. * Additionally, the driver has to then use these HW queue IDs for the queue
  3477. * management functions (ieee80211_stop_queue() et al.)
  3478. *
  3479. * The driver is free to set up the queue mappings as needed; multiple virtual
  3480. * interfaces may map to the same hardware queues if needed. The setup has to
  3481. * happen during add_interface or change_interface callbacks. For example, a
  3482. * driver supporting station+station and station+AP modes might decide to have
  3483. * 10 hardware queues to handle different scenarios:
  3484. *
  3485. * 4 AC HW queues for 1st vif: 0, 1, 2, 3
  3486. * 4 AC HW queues for 2nd vif: 4, 5, 6, 7
  3487. * after-DTIM queue for AP: 8
  3488. * off-channel queue: 9
  3489. *
  3490. * It would then set up the hardware like this:
  3491. * hw.offchannel_tx_hw_queue = 9
  3492. *
  3493. * and the first virtual interface that is added as follows:
  3494. * vif.hw_queue[IEEE80211_AC_VO] = 0
  3495. * vif.hw_queue[IEEE80211_AC_VI] = 1
  3496. * vif.hw_queue[IEEE80211_AC_BE] = 2
  3497. * vif.hw_queue[IEEE80211_AC_BK] = 3
  3498. * vif.cab_queue = 8 // if AP mode, otherwise %IEEE80211_INVAL_HW_QUEUE
  3499. * and the second virtual interface with 4-7.
  3500. *
  3501. * If queue 6 gets full, for example, mac80211 would only stop the second
  3502. * virtual interface's BE queue since virtual interface queues are per AC.
  3503. *
  3504. * Note that the vif.cab_queue value should be set to %IEEE80211_INVAL_HW_QUEUE
  3505. * whenever the queue is not used (i.e. the interface is not in AP mode) if the
  3506. * queue could potentially be shared since mac80211 will look at cab_queue when
  3507. * a queue is stopped/woken even if the interface is not in AP mode.
  3508. */
  3509. /**
  3510. * enum ieee80211_filter_flags - hardware filter flags
  3511. *
  3512. * These flags determine what the filter in hardware should be
  3513. * programmed to let through and what should not be passed to the
  3514. * stack. It is always safe to pass more frames than requested,
  3515. * but this has negative impact on power consumption.
  3516. *
  3517. * @FIF_ALLMULTI: pass all multicast frames, this is used if requested
  3518. * by the user or if the hardware is not capable of filtering by
  3519. * multicast address.
  3520. *
  3521. * @FIF_FCSFAIL: pass frames with failed FCS (but you need to set the
  3522. * %RX_FLAG_FAILED_FCS_CRC for them)
  3523. *
  3524. * @FIF_PLCPFAIL: pass frames with failed PLCP CRC (but you need to set
  3525. * the %RX_FLAG_FAILED_PLCP_CRC for them
  3526. *
  3527. * @FIF_BCN_PRBRESP_PROMISC: This flag is set during scanning to indicate
  3528. * to the hardware that it should not filter beacons or probe responses
  3529. * by BSSID. Filtering them can greatly reduce the amount of processing
  3530. * mac80211 needs to do and the amount of CPU wakeups, so you should
  3531. * honour this flag if possible.
  3532. *
  3533. * @FIF_CONTROL: pass control frames (except for PS Poll) addressed to this
  3534. * station
  3535. *
  3536. * @FIF_OTHER_BSS: pass frames destined to other BSSes
  3537. *
  3538. * @FIF_PSPOLL: pass PS Poll frames
  3539. *
  3540. * @FIF_PROBE_REQ: pass probe request frames
  3541. *
  3542. * @FIF_MCAST_ACTION: pass multicast Action frames
  3543. */
  3544. enum ieee80211_filter_flags {
  3545. FIF_ALLMULTI = 1<<1,
  3546. FIF_FCSFAIL = 1<<2,
  3547. FIF_PLCPFAIL = 1<<3,
  3548. FIF_BCN_PRBRESP_PROMISC = 1<<4,
  3549. FIF_CONTROL = 1<<5,
  3550. FIF_OTHER_BSS = 1<<6,
  3551. FIF_PSPOLL = 1<<7,
  3552. FIF_PROBE_REQ = 1<<8,
  3553. FIF_MCAST_ACTION = 1<<9,
  3554. };
  3555. /**
  3556. * enum ieee80211_ampdu_mlme_action - A-MPDU actions
  3557. *
  3558. * These flags are used with the ampdu_action() callback in
  3559. * &struct ieee80211_ops to indicate which action is needed.
  3560. *
  3561. * Note that drivers MUST be able to deal with a TX aggregation
  3562. * session being stopped even before they OK'ed starting it by
  3563. * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer
  3564. * might receive the addBA frame and send a delBA right away!
  3565. *
  3566. * @IEEE80211_AMPDU_RX_START: start RX aggregation
  3567. * @IEEE80211_AMPDU_RX_STOP: stop RX aggregation
  3568. * @IEEE80211_AMPDU_TX_START: start TX aggregation, the driver must either
  3569. * call ieee80211_start_tx_ba_cb_irqsafe() or
  3570. * call ieee80211_start_tx_ba_cb_irqsafe() with status
  3571. * %IEEE80211_AMPDU_TX_START_DELAY_ADDBA to delay addba after
  3572. * ieee80211_start_tx_ba_cb_irqsafe is called, or just return the special
  3573. * status %IEEE80211_AMPDU_TX_START_IMMEDIATE.
  3574. * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
  3575. * @IEEE80211_AMPDU_TX_STOP_CONT: stop TX aggregation but continue transmitting
  3576. * queued packets, now unaggregated. After all packets are transmitted the
  3577. * driver has to call ieee80211_stop_tx_ba_cb_irqsafe().
  3578. * @IEEE80211_AMPDU_TX_STOP_FLUSH: stop TX aggregation and flush all packets,
  3579. * called when the station is removed. There's no need or reason to call
  3580. * ieee80211_stop_tx_ba_cb_irqsafe() in this case as mac80211 assumes the
  3581. * session is gone and removes the station.
  3582. * @IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: called when TX aggregation is stopped
  3583. * but the driver hasn't called ieee80211_stop_tx_ba_cb_irqsafe() yet and
  3584. * now the connection is dropped and the station will be removed. Drivers
  3585. * should clean up and drop remaining packets when this is called.
  3586. */
  3587. enum ieee80211_ampdu_mlme_action {
  3588. IEEE80211_AMPDU_RX_START,
  3589. IEEE80211_AMPDU_RX_STOP,
  3590. IEEE80211_AMPDU_TX_START,
  3591. IEEE80211_AMPDU_TX_STOP_CONT,
  3592. IEEE80211_AMPDU_TX_STOP_FLUSH,
  3593. IEEE80211_AMPDU_TX_STOP_FLUSH_CONT,
  3594. IEEE80211_AMPDU_TX_OPERATIONAL,
  3595. };
  3596. #define IEEE80211_AMPDU_TX_START_IMMEDIATE 1
  3597. #define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2
  3598. /**
  3599. * struct ieee80211_ampdu_params - AMPDU action parameters
  3600. *
  3601. * @action: the ampdu action, value from %ieee80211_ampdu_mlme_action.
  3602. * @sta: peer of this AMPDU session
  3603. * @tid: tid of the BA session
  3604. * @ssn: start sequence number of the session. TX/RX_STOP can pass 0. When
  3605. * action is set to %IEEE80211_AMPDU_RX_START the driver passes back the
  3606. * actual ssn value used to start the session and writes the value here.
  3607. * @buf_size: reorder buffer size (number of subframes). Valid only when the
  3608. * action is set to %IEEE80211_AMPDU_RX_START or
  3609. * %IEEE80211_AMPDU_TX_OPERATIONAL
  3610. * @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU.
  3611. * valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL
  3612. * @timeout: BA session timeout. Valid only when the action is set to
  3613. * %IEEE80211_AMPDU_RX_START
  3614. */
  3615. struct ieee80211_ampdu_params {
  3616. enum ieee80211_ampdu_mlme_action action;
  3617. struct ieee80211_sta *sta;
  3618. u16 tid;
  3619. u16 ssn;
  3620. u16 buf_size;
  3621. bool amsdu;
  3622. u16 timeout;
  3623. };
  3624. /**
  3625. * enum ieee80211_frame_release_type - frame release reason
  3626. * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
  3627. * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to
  3628. * frame received on trigger-enabled AC
  3629. */
  3630. enum ieee80211_frame_release_type {
  3631. IEEE80211_FRAME_RELEASE_PSPOLL,
  3632. IEEE80211_FRAME_RELEASE_UAPSD,
  3633. };
  3634. /**
  3635. * enum ieee80211_rate_control_changed - flags to indicate what changed
  3636. *
  3637. * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
  3638. * to this station changed. The actual bandwidth is in the station
  3639. * information -- for HT20/40 the IEEE80211_HT_CAP_SUP_WIDTH_20_40
  3640. * flag changes, for HT and VHT the bandwidth field changes.
  3641. * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
  3642. * @IEEE80211_RC_SUPP_RATES_CHANGED: The supported rate set of this peer
  3643. * changed (in IBSS mode) due to discovering more information about
  3644. * the peer.
  3645. * @IEEE80211_RC_NSS_CHANGED: N_SS (number of spatial streams) was changed
  3646. * by the peer
  3647. */
  3648. enum ieee80211_rate_control_changed {
  3649. IEEE80211_RC_BW_CHANGED = BIT(0),
  3650. IEEE80211_RC_SMPS_CHANGED = BIT(1),
  3651. IEEE80211_RC_SUPP_RATES_CHANGED = BIT(2),
  3652. IEEE80211_RC_NSS_CHANGED = BIT(3),
  3653. };
  3654. /**
  3655. * enum ieee80211_roc_type - remain on channel type
  3656. *
  3657. * With the support for multi channel contexts and multi channel operations,
  3658. * remain on channel operations might be limited/deferred/aborted by other
  3659. * flows/operations which have higher priority (and vice versa).
  3660. * Specifying the ROC type can be used by devices to prioritize the ROC
  3661. * operations compared to other operations/flows.
  3662. *
  3663. * @IEEE80211_ROC_TYPE_NORMAL: There are no special requirements for this ROC.
  3664. * @IEEE80211_ROC_TYPE_MGMT_TX: The remain on channel request is required
  3665. * for sending management frames offchannel.
  3666. */
  3667. enum ieee80211_roc_type {
  3668. IEEE80211_ROC_TYPE_NORMAL = 0,
  3669. IEEE80211_ROC_TYPE_MGMT_TX,
  3670. };
  3671. /**
  3672. * enum ieee80211_reconfig_type - reconfig type
  3673. *
  3674. * This enum is used by the reconfig_complete() callback to indicate what
  3675. * reconfiguration type was completed.
  3676. *
  3677. * @IEEE80211_RECONFIG_TYPE_RESTART: hw restart type
  3678. * (also due to resume() callback returning 1)
  3679. * @IEEE80211_RECONFIG_TYPE_SUSPEND: suspend type (regardless
  3680. * of wowlan configuration)
  3681. */
  3682. enum ieee80211_reconfig_type {
  3683. IEEE80211_RECONFIG_TYPE_RESTART,
  3684. IEEE80211_RECONFIG_TYPE_SUSPEND,
  3685. };
  3686. /**
  3687. * struct ieee80211_prep_tx_info - prepare TX information
  3688. * @duration: if non-zero, hint about the required duration,
  3689. * only used with the mgd_prepare_tx() method.
  3690. * @subtype: frame subtype (auth, (re)assoc, deauth, disassoc)
  3691. * @success: whether the frame exchange was successful, only
  3692. * used with the mgd_complete_tx() method, and then only
  3693. * valid for auth and (re)assoc.
  3694. * @was_assoc: set if this call is due to deauth/disassoc
  3695. * while just having been associated
  3696. * @link_id: the link id on which the frame will be TX'ed.
  3697. * 0 for a non-MLO connection.
  3698. */
  3699. struct ieee80211_prep_tx_info {
  3700. u16 duration;
  3701. u16 subtype;
  3702. u8 success:1, was_assoc:1;
  3703. int link_id;
  3704. };
  3705. /**
  3706. * struct ieee80211_ops - callbacks from mac80211 to the driver
  3707. *
  3708. * This structure contains various callbacks that the driver may
  3709. * handle or, in some cases, must handle, for example to configure
  3710. * the hardware to a new channel or to transmit a frame.
  3711. *
  3712. * @tx: Handler that 802.11 module calls for each transmitted frame.
  3713. * skb contains the buffer starting from the IEEE 802.11 header.
  3714. * The low-level driver should send the frame out based on
  3715. * configuration in the TX control data. This handler should,
  3716. * preferably, never fail and stop queues appropriately.
  3717. * Must be atomic.
  3718. *
  3719. * @start: Called before the first netdevice attached to the hardware
  3720. * is enabled. This should turn on the hardware and must turn on
  3721. * frame reception (for possibly enabled monitor interfaces.)
  3722. * Returns negative error codes, these may be seen in userspace,
  3723. * or zero.
  3724. * When the device is started it should not have a MAC address
  3725. * to avoid acknowledging frames before a non-monitor device
  3726. * is added.
  3727. * Must be implemented and can sleep.
  3728. *
  3729. * @stop: Called after last netdevice attached to the hardware
  3730. * is disabled. This should turn off the hardware (at least
  3731. * it must turn off frame reception.)
  3732. * May be called right after add_interface if that rejects
  3733. * an interface. If you added any work onto the mac80211 workqueue
  3734. * you should ensure to cancel it on this callback.
  3735. * Must be implemented and can sleep.
  3736. *
  3737. * @suspend: Suspend the device; mac80211 itself will quiesce before and
  3738. * stop transmitting and doing any other configuration, and then
  3739. * ask the device to suspend. This is only invoked when WoWLAN is
  3740. * configured, otherwise the device is deconfigured completely and
  3741. * reconfigured at resume time.
  3742. * The driver may also impose special conditions under which it
  3743. * wants to use the "normal" suspend (deconfigure), say if it only
  3744. * supports WoWLAN when the device is associated. In this case, it
  3745. * must return 1 from this function.
  3746. *
  3747. * @resume: If WoWLAN was configured, this indicates that mac80211 is
  3748. * now resuming its operation, after this the device must be fully
  3749. * functional again. If this returns an error, the only way out is
  3750. * to also unregister the device. If it returns 1, then mac80211
  3751. * will also go through the regular complete restart on resume.
  3752. *
  3753. * @set_wakeup: Enable or disable wakeup when WoWLAN configuration is
  3754. * modified. The reason is that device_set_wakeup_enable() is
  3755. * supposed to be called when the configuration changes, not only
  3756. * in suspend().
  3757. *
  3758. * @add_interface: Called when a netdevice attached to the hardware is
  3759. * enabled. Because it is not called for monitor mode devices, @start
  3760. * and @stop must be implemented.
  3761. * The driver should perform any initialization it needs before
  3762. * the device can be enabled. The initial configuration for the
  3763. * interface is given in the conf parameter.
  3764. * The callback may refuse to add an interface by returning a
  3765. * negative error code (which will be seen in userspace.)
  3766. * Must be implemented and can sleep.
  3767. *
  3768. * @change_interface: Called when a netdevice changes type. This callback
  3769. * is optional, but only if it is supported can interface types be
  3770. * switched while the interface is UP. The callback may sleep.
  3771. * Note that while an interface is being switched, it will not be
  3772. * found by the interface iteration callbacks.
  3773. *
  3774. * @remove_interface: Notifies a driver that an interface is going down.
  3775. * The @stop callback is called after this if it is the last interface
  3776. * and no monitor interfaces are present.
  3777. * When all interfaces are removed, the MAC address in the hardware
  3778. * must be cleared so the device no longer acknowledges packets,
  3779. * the mac_addr member of the conf structure is, however, set to the
  3780. * MAC address of the device going away.
  3781. * Hence, this callback must be implemented. It can sleep.
  3782. *
  3783. * @config: Handler for configuration requests. IEEE 802.11 code calls this
  3784. * function to change hardware configuration, e.g., channel.
  3785. * This function should never fail but returns a negative error code
  3786. * if it does. The callback can sleep.
  3787. *
  3788. * @bss_info_changed: Handler for configuration requests related to BSS
  3789. * parameters that may vary during BSS's lifespan, and may affect low
  3790. * level driver (e.g. assoc/disassoc status, erp parameters).
  3791. * This function should not be used if no BSS has been set, unless
  3792. * for association indication. The @changed parameter indicates which
  3793. * of the bss parameters has changed when a call is made. The callback
  3794. * can sleep.
  3795. * Note: this callback is called if @vif_cfg_changed or @link_info_changed
  3796. * are not implemented.
  3797. *
  3798. * @vif_cfg_changed: Handler for configuration requests related to interface
  3799. * (MLD) parameters from &struct ieee80211_vif_cfg that vary during the
  3800. * lifetime of the interface (e.g. assoc status, IP addresses, etc.)
  3801. * The @changed parameter indicates which value changed.
  3802. * The callback can sleep.
  3803. *
  3804. * @link_info_changed: Handler for configuration requests related to link
  3805. * parameters from &struct ieee80211_bss_conf that are related to an
  3806. * individual link. e.g. legacy/HT/VHT/... rate information.
  3807. * The @changed parameter indicates which value changed, and the @link_id
  3808. * parameter indicates the link ID. Note that the @link_id will be 0 for
  3809. * non-MLO connections.
  3810. * The callback can sleep.
  3811. *
  3812. * @prepare_multicast: Prepare for multicast filter configuration.
  3813. * This callback is optional, and its return value is passed
  3814. * to configure_filter(). This callback must be atomic.
  3815. *
  3816. * @configure_filter: Configure the device's RX filter.
  3817. * See the section "Frame filtering" for more information.
  3818. * This callback must be implemented and can sleep.
  3819. *
  3820. * @config_iface_filter: Configure the interface's RX filter.
  3821. * This callback is optional and is used to configure which frames
  3822. * should be passed to mac80211. The filter_flags is the combination
  3823. * of FIF_* flags. The changed_flags is a bit mask that indicates
  3824. * which flags are changed.
  3825. * This callback can sleep.
  3826. *
  3827. * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
  3828. * must be set or cleared for a given STA. Must be atomic.
  3829. *
  3830. * @set_key: See the section "Hardware crypto acceleration"
  3831. * This callback is only called between add_interface and
  3832. * remove_interface calls, i.e. while the given virtual interface
  3833. * is enabled.
  3834. * Returns a negative error code if the key can't be added.
  3835. * The callback can sleep.
  3836. *
  3837. * @update_tkip_key: See the section "Hardware crypto acceleration"
  3838. * This callback will be called in the context of Rx. Called for drivers
  3839. * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
  3840. * The callback must be atomic.
  3841. *
  3842. * @set_rekey_data: If the device supports GTK rekeying, for example while the
  3843. * host is suspended, it can assign this callback to retrieve the data
  3844. * necessary to do GTK rekeying, this is the KEK, KCK and replay counter.
  3845. * After rekeying was done it should (for example during resume) notify
  3846. * userspace of the new replay counter using ieee80211_gtk_rekey_notify().
  3847. *
  3848. * @set_default_unicast_key: Set the default (unicast) key index, useful for
  3849. * WEP when the device sends data packets autonomously, e.g. for ARP
  3850. * offloading. The index can be 0-3, or -1 for unsetting it.
  3851. *
  3852. * @hw_scan: Ask the hardware to service the scan request, no need to start
  3853. * the scan state machine in stack. The scan must honour the channel
  3854. * configuration done by the regulatory agent in the wiphy's
  3855. * registered bands. The hardware (or the driver) needs to make sure
  3856. * that power save is disabled.
  3857. * The @req ie/ie_len members are rewritten by mac80211 to contain the
  3858. * entire IEs after the SSID, so that drivers need not look at these
  3859. * at all but just send them after the SSID -- mac80211 includes the
  3860. * (extended) supported rates and HT information (where applicable).
  3861. * When the scan finishes, ieee80211_scan_completed() must be called;
  3862. * note that it also must be called when the scan cannot finish due to
  3863. * any error unless this callback returned a negative error code.
  3864. * This callback is also allowed to return the special return value 1,
  3865. * this indicates that hardware scan isn't desirable right now and a
  3866. * software scan should be done instead. A driver wishing to use this
  3867. * capability must ensure its (hardware) scan capabilities aren't
  3868. * advertised as more capable than mac80211's software scan is.
  3869. * The callback can sleep.
  3870. *
  3871. * @cancel_hw_scan: Ask the low-level tp cancel the active hw scan.
  3872. * The driver should ask the hardware to cancel the scan (if possible),
  3873. * but the scan will be completed only after the driver will call
  3874. * ieee80211_scan_completed().
  3875. * This callback is needed for wowlan, to prevent enqueueing a new
  3876. * scan_work after the low-level driver was already suspended.
  3877. * The callback can sleep.
  3878. *
  3879. * @sched_scan_start: Ask the hardware to start scanning repeatedly at
  3880. * specific intervals. The driver must call the
  3881. * ieee80211_sched_scan_results() function whenever it finds results.
  3882. * This process will continue until sched_scan_stop is called.
  3883. *
  3884. * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan.
  3885. * In this case, ieee80211_sched_scan_stopped() must not be called.
  3886. *
  3887. * @sw_scan_start: Notifier function that is called just before a software scan
  3888. * is started. Can be NULL, if the driver doesn't need this notification.
  3889. * The mac_addr parameter allows supporting NL80211_SCAN_FLAG_RANDOM_ADDR,
  3890. * the driver may set the NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR flag if it
  3891. * can use this parameter. The callback can sleep.
  3892. *
  3893. * @sw_scan_complete: Notifier function that is called just after a
  3894. * software scan finished. Can be NULL, if the driver doesn't need
  3895. * this notification.
  3896. * The callback can sleep.
  3897. *
  3898. * @get_stats: Return low-level statistics.
  3899. * Returns zero if statistics are available.
  3900. * The callback can sleep.
  3901. *
  3902. * @get_key_seq: If your device implements encryption in hardware and does
  3903. * IV/PN assignment then this callback should be provided to read the
  3904. * IV/PN for the given key from hardware.
  3905. * The callback must be atomic.
  3906. *
  3907. * @set_frag_threshold: Configuration of fragmentation threshold. Assign this
  3908. * if the device does fragmentation by itself. Note that to prevent the
  3909. * stack from doing fragmentation IEEE80211_HW_SUPPORTS_TX_FRAG
  3910. * should be set as well.
  3911. * The callback can sleep.
  3912. *
  3913. * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
  3914. * The callback can sleep.
  3915. *
  3916. * @sta_add: Notifies low level driver about addition of an associated station,
  3917. * AP, IBSS/WDS/mesh peer etc. This callback can sleep.
  3918. *
  3919. * @sta_remove: Notifies low level driver about removal of an associated
  3920. * station, AP, IBSS/WDS/mesh peer etc. Note that after the callback
  3921. * returns it isn't safe to use the pointer, not even RCU protected;
  3922. * no RCU grace period is guaranteed between returning here and freeing
  3923. * the station. See @sta_pre_rcu_remove if needed.
  3924. * This callback can sleep.
  3925. *
  3926. * @vif_add_debugfs: Drivers can use this callback to add a debugfs vif
  3927. * directory with its files. This callback should be within a
  3928. * CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep.
  3929. *
  3930. * @link_add_debugfs: Drivers can use this callback to add debugfs files
  3931. * when a link is added to a mac80211 vif. This callback should be within
  3932. * a CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep.
  3933. * For non-MLO the callback will be called once for the default bss_conf
  3934. * with the vif's directory rather than a separate subdirectory.
  3935. *
  3936. * @sta_add_debugfs: Drivers can use this callback to add debugfs files
  3937. * when a station is added to mac80211's station list. This callback
  3938. * should be within a CONFIG_MAC80211_DEBUGFS conditional. This
  3939. * callback can sleep.
  3940. *
  3941. * @link_sta_add_debugfs: Drivers can use this callback to add debugfs files
  3942. * when a link is added to a mac80211 station. This callback
  3943. * should be within a CONFIG_MAC80211_DEBUGFS conditional. This
  3944. * callback can sleep.
  3945. * For non-MLO the callback will be called once for the deflink with the
  3946. * station's directory rather than a separate subdirectory.
  3947. *
  3948. * @sta_notify: Notifies low level driver about power state transition of an
  3949. * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating
  3950. * in AP mode, this callback will not be called when the flag
  3951. * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
  3952. *
  3953. * @sta_set_txpwr: Configure the station tx power. This callback set the tx
  3954. * power for the station.
  3955. * This callback can sleep.
  3956. *
  3957. * @sta_state: Notifies low level driver about state transition of a
  3958. * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
  3959. * This callback is mutually exclusive with @sta_add/@sta_remove.
  3960. * It must not fail for down transitions but may fail for transitions
  3961. * up the list of states. Also note that after the callback returns it
  3962. * isn't safe to use the pointer, not even RCU protected - no RCU grace
  3963. * period is guaranteed between returning here and freeing the station.
  3964. * See @sta_pre_rcu_remove if needed.
  3965. * The callback can sleep.
  3966. *
  3967. * @sta_pre_rcu_remove: Notify driver about station removal before RCU
  3968. * synchronisation. This is useful if a driver needs to have station
  3969. * pointers protected using RCU, it can then use this call to clear
  3970. * the pointers instead of waiting for an RCU grace period to elapse
  3971. * in @sta_state.
  3972. * The callback can sleep.
  3973. *
  3974. * @link_sta_rc_update: Notifies the driver of changes to the bitrates that can
  3975. * be used to transmit to the station. The changes are advertised with bits
  3976. * from &enum ieee80211_rate_control_changed and the values are reflected
  3977. * in the station data. This callback should only be used when the driver
  3978. * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
  3979. * otherwise the rate control algorithm is notified directly.
  3980. * Must be atomic.
  3981. * @sta_rate_tbl_update: Notifies the driver that the rate table changed. This
  3982. * is only used if the configured rate control algorithm actually uses
  3983. * the new rate table API, and is therefore optional. Must be atomic.
  3984. *
  3985. * @sta_statistics: Get statistics for this station. For example with beacon
  3986. * filtering, the statistics kept by mac80211 might not be accurate, so
  3987. * let the driver pre-fill the statistics. The driver can fill most of
  3988. * the values (indicating which by setting the filled bitmap), but not
  3989. * all of them make sense - see the source for which ones are possible.
  3990. * Statistics that the driver doesn't fill will be filled by mac80211.
  3991. * The callback can sleep.
  3992. *
  3993. * @link_sta_statistics: Get link statistics for this station. For example with
  3994. * beacon filtering, the statistics kept by mac80211 might not be
  3995. * accurate, so let the driver pre-fill the statistics. The driver can
  3996. * fill most of the values (indicating which by setting the filled
  3997. * bitmap), but not all of them make sense - see the source for which
  3998. * ones are possible.
  3999. * Statistics that the driver doesn't fill will be filled by mac80211.
  4000. * The callback can sleep.
  4001. *
  4002. * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
  4003. * bursting) for a hardware TX queue.
  4004. * Returns a negative error code on failure.
  4005. * The callback can sleep.
  4006. *
  4007. * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
  4008. * this is only used for IBSS mode BSSID merging and debugging. Is not a
  4009. * required function.
  4010. * The callback can sleep.
  4011. *
  4012. * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
  4013. * Currently, this is only used for IBSS mode debugging. Is not a
  4014. * required function.
  4015. * The callback can sleep.
  4016. *
  4017. * @offset_tsf: Offset the TSF timer by the specified value in the
  4018. * firmware/hardware. Preferred to set_tsf as it avoids delay between
  4019. * calling set_tsf() and hardware getting programmed, which will show up
  4020. * as TSF delay. Is not a required function.
  4021. * The callback can sleep.
  4022. *
  4023. * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
  4024. * with other STAs in the IBSS. This is only used in IBSS mode. This
  4025. * function is optional if the firmware/hardware takes full care of
  4026. * TSF synchronization.
  4027. * The callback can sleep.
  4028. *
  4029. * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
  4030. * This is needed only for IBSS mode and the result of this function is
  4031. * used to determine whether to reply to Probe Requests.
  4032. * Returns non-zero if this device sent the last beacon.
  4033. * The callback can sleep.
  4034. *
  4035. * @get_survey: Return per-channel survey information
  4036. *
  4037. * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
  4038. * need to set wiphy->rfkill_poll to %true before registration,
  4039. * and need to call wiphy_rfkill_set_hw_state() in the callback.
  4040. * The callback can sleep.
  4041. *
  4042. * @set_coverage_class: Set slot time for given coverage class as specified
  4043. * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
  4044. * accordingly; coverage class equals to -1 to enable ACK timeout
  4045. * estimation algorithm (dynack). To disable dynack set valid value for
  4046. * coverage class. This callback is not required and may sleep.
  4047. *
  4048. * @testmode_cmd: Implement a cfg80211 test mode command. The passed @vif may
  4049. * be %NULL. The callback can sleep.
  4050. * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep.
  4051. *
  4052. * @flush: Flush all pending frames from the hardware queue, making sure
  4053. * that the hardware queues are empty. The @queues parameter is a bitmap
  4054. * of queues to flush, which is useful if different virtual interfaces
  4055. * use different hardware queues; it may also indicate all queues.
  4056. * If the parameter @drop is set to %true, pending frames may be dropped.
  4057. * Note that vif can be NULL.
  4058. * The callback can sleep.
  4059. *
  4060. * @flush_sta: Flush or drop all pending frames from the hardware queue(s) for
  4061. * the given station, as it's about to be removed.
  4062. * The callback can sleep.
  4063. *
  4064. * @channel_switch: Drivers that need (or want) to offload the channel
  4065. * switch operation for CSAs received from the AP may implement this
  4066. * callback. They must then call ieee80211_chswitch_done() to indicate
  4067. * completion of the channel switch.
  4068. *
  4069. * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
  4070. * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
  4071. * reject TX/RX mask combinations they cannot support by returning -EINVAL
  4072. * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
  4073. *
  4074. * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
  4075. *
  4076. * @remain_on_channel: Starts an off-channel period on the given channel, must
  4077. * call back to ieee80211_ready_on_channel() when on that channel. Note
  4078. * that normal channel traffic is not stopped as this is intended for hw
  4079. * offload. Frames to transmit on the off-channel channel are transmitted
  4080. * normally except for the %IEEE80211_TX_CTL_TX_OFFCHAN flag. When the
  4081. * duration (which will always be non-zero) expires, the driver must call
  4082. * ieee80211_remain_on_channel_expired().
  4083. * Note that this callback may be called while the device is in IDLE and
  4084. * must be accepted in this case.
  4085. * This callback may sleep.
  4086. * @cancel_remain_on_channel: Requests that an ongoing off-channel period is
  4087. * aborted before it expires. This callback may sleep.
  4088. *
  4089. * @set_ringparam: Set tx and rx ring sizes.
  4090. *
  4091. * @get_ringparam: Get tx and rx ring current and maximum sizes.
  4092. *
  4093. * @tx_frames_pending: Check if there is any pending frame in the hardware
  4094. * queues before entering power save.
  4095. *
  4096. * @set_bitrate_mask: Set a mask of rates to be used for rate control selection
  4097. * when transmitting a frame. Currently only legacy rates are handled.
  4098. * The callback can sleep.
  4099. * @event_callback: Notify driver about any event in mac80211. See
  4100. * &enum ieee80211_event_type for the different types.
  4101. * The callback must be atomic.
  4102. *
  4103. * @release_buffered_frames: Release buffered frames according to the given
  4104. * parameters. In the case where the driver buffers some frames for
  4105. * sleeping stations mac80211 will use this callback to tell the driver
  4106. * to release some frames, either for PS-poll or uAPSD.
  4107. * Note that if the @more_data parameter is %false the driver must check
  4108. * if there are more frames on the given TIDs, and if there are more than
  4109. * the frames being released then it must still set the more-data bit in
  4110. * the frame. If the @more_data parameter is %true, then of course the
  4111. * more-data bit must always be set.
  4112. * The @tids parameter tells the driver which TIDs to release frames
  4113. * from, for PS-poll it will always have only a single bit set.
  4114. * In the case this is used for a PS-poll initiated release, the
  4115. * @num_frames parameter will always be 1 so code can be shared. In
  4116. * this case the driver must also set %IEEE80211_TX_STATUS_EOSP flag
  4117. * on the TX status (and must report TX status) so that the PS-poll
  4118. * period is properly ended. This is used to avoid sending multiple
  4119. * responses for a retried PS-poll frame.
  4120. * In the case this is used for uAPSD, the @num_frames parameter may be
  4121. * bigger than one, but the driver may send fewer frames (it must send
  4122. * at least one, however). In this case it is also responsible for
  4123. * setting the EOSP flag in the QoS header of the frames. Also, when the
  4124. * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP
  4125. * on the last frame in the SP. Alternatively, it may call the function
  4126. * ieee80211_sta_eosp() to inform mac80211 of the end of the SP.
  4127. * This callback must be atomic.
  4128. * @allow_buffered_frames: Prepare device to allow the given number of frames
  4129. * to go out to the given station. The frames will be sent by mac80211
  4130. * via the usual TX path after this call. The TX information for frames
  4131. * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
  4132. * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
  4133. * frames from multiple TIDs are released and the driver might reorder
  4134. * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
  4135. * on the last frame and clear it on all others and also handle the EOSP
  4136. * bit in the QoS header correctly. Alternatively, it can also call the
  4137. * ieee80211_sta_eosp() function.
  4138. * The @tids parameter is a bitmap and tells the driver which TIDs the
  4139. * frames will be on; it will at most have two bits set.
  4140. * This callback must be atomic.
  4141. *
  4142. * @get_et_sset_count: Ethtool API to get string-set count.
  4143. * Note that the wiphy mutex is not held for this callback since it's
  4144. * expected to return a static value.
  4145. *
  4146. * @get_et_stats: Ethtool API to get a set of u64 stats.
  4147. *
  4148. * @get_et_strings: Ethtool API to get a set of strings to describe stats
  4149. * and perhaps other supported types of ethtool data-sets.
  4150. * Note that the wiphy mutex is not held for this callback since it's
  4151. * expected to return a static value.
  4152. *
  4153. * @mgd_prepare_tx: Prepare for transmitting a management frame for association
  4154. * before associated. In multi-channel scenarios, a virtual interface is
  4155. * bound to a channel before it is associated, but as it isn't associated
  4156. * yet it need not necessarily be given airtime, in particular since any
  4157. * transmission to a P2P GO needs to be synchronized against the GO's
  4158. * powersave state. mac80211 will call this function before transmitting a
  4159. * management frame prior to transmitting that frame to allow the driver
  4160. * to give it channel time for the transmission, to get a response and be
  4161. * able to synchronize with the GO.
  4162. * The callback will be called before each transmission and upon return
  4163. * mac80211 will transmit the frame right away.
  4164. * Additional information is passed in the &struct ieee80211_prep_tx_info
  4165. * data. If duration there is greater than zero, mac80211 hints to the
  4166. * driver the duration for which the operation is requested.
  4167. * The callback is optional and can (should!) sleep.
  4168. * @mgd_complete_tx: Notify the driver that the response frame for a previously
  4169. * transmitted frame announced with @mgd_prepare_tx was received, the data
  4170. * is filled similarly to @mgd_prepare_tx though the duration is not used.
  4171. * Note that this isn't always called for each mgd_prepare_tx() call, for
  4172. * example for SAE the 'confirm' messages can be on the air in any order.
  4173. *
  4174. * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
  4175. * a TDLS discovery-request, we expect a reply to arrive on the AP's
  4176. * channel. We must stay on the channel (no PSM, scan, etc.), since a TDLS
  4177. * setup-response is a direct packet not buffered by the AP.
  4178. * mac80211 will call this function just before the transmission of a TDLS
  4179. * discovery-request. The recommended period of protection is at least
  4180. * 2 * (DTIM period).
  4181. * The callback is optional and can sleep.
  4182. *
  4183. * @add_chanctx: Notifies device driver about new channel context creation.
  4184. * This callback may sleep.
  4185. * @remove_chanctx: Notifies device driver about channel context destruction.
  4186. * This callback may sleep.
  4187. * @change_chanctx: Notifies device driver about channel context changes that
  4188. * may happen when combining different virtual interfaces on the same
  4189. * channel context with different settings
  4190. * This callback may sleep.
  4191. * @assign_vif_chanctx: Notifies device driver about channel context being bound
  4192. * to vif. Possible use is for hw queue remapping.
  4193. * This callback may sleep.
  4194. * @unassign_vif_chanctx: Notifies device driver about channel context being
  4195. * unbound from vif.
  4196. * This callback may sleep.
  4197. * @switch_vif_chanctx: switch a number of vifs from one chanctx to
  4198. * another, as specified in the list of
  4199. * @ieee80211_vif_chanctx_switch passed to the driver, according
  4200. * to the mode defined in &ieee80211_chanctx_switch_mode.
  4201. * This callback may sleep.
  4202. *
  4203. * @start_ap: Start operation on the AP interface, this is called after all the
  4204. * information in bss_conf is set and beacon can be retrieved. A channel
  4205. * context is bound before this is called. Note that if the driver uses
  4206. * software scan or ROC, this (and @stop_ap) isn't called when the AP is
  4207. * just "paused" for scanning/ROC, which is indicated by the beacon being
  4208. * disabled/enabled via @bss_info_changed.
  4209. * @stop_ap: Stop operation on the AP interface.
  4210. *
  4211. * @reconfig_complete: Called after a call to ieee80211_restart_hw() and
  4212. * during resume, when the reconfiguration has completed.
  4213. * This can help the driver implement the reconfiguration step (and
  4214. * indicate mac80211 is ready to receive frames).
  4215. * This callback may sleep.
  4216. *
  4217. * @ipv6_addr_change: IPv6 address assignment on the given interface changed.
  4218. * Currently, this is only called for managed or P2P client interfaces.
  4219. * This callback is optional; it must not sleep.
  4220. *
  4221. * @channel_switch_beacon: Starts a channel switch to a new channel.
  4222. * Beacons are modified to include CSA or ECSA IEs before calling this
  4223. * function. The corresponding count fields in these IEs must be
  4224. * decremented, and when they reach 1 the driver must call
  4225. * ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get()
  4226. * get the csa counter decremented by mac80211, but must check if it is
  4227. * 1 using ieee80211_beacon_counter_is_complete() after the beacon has been
  4228. * transmitted and then call ieee80211_csa_finish().
  4229. * If the CSA count starts as zero or 1, this function will not be called,
  4230. * since there won't be any time to beacon before the switch anyway.
  4231. * @pre_channel_switch: This is an optional callback that is called
  4232. * before a channel switch procedure is started (ie. when a STA
  4233. * gets a CSA or a userspace initiated channel-switch), allowing
  4234. * the driver to prepare for the channel switch.
  4235. * @post_channel_switch: This is an optional callback that is called
  4236. * after a channel switch procedure is completed, allowing the
  4237. * driver to go back to a normal configuration.
  4238. * @abort_channel_switch: This is an optional callback that is called
  4239. * when channel switch procedure was aborted, allowing the
  4240. * driver to go back to a normal configuration.
  4241. * @channel_switch_rx_beacon: This is an optional callback that is called
  4242. * when channel switch procedure is in progress and additional beacon with
  4243. * CSA IE was received, allowing driver to track changes in count.
  4244. * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
  4245. * information in bss_conf is set up and the beacon can be retrieved. A
  4246. * channel context is bound before this is called.
  4247. * @leave_ibss: Leave the IBSS again.
  4248. *
  4249. * @get_expected_throughput: extract the expected throughput towards the
  4250. * specified station. The returned value is expressed in Kbps. It returns 0
  4251. * if the RC algorithm does not have proper data to provide.
  4252. *
  4253. * @get_txpower: get current maximum tx power (in dBm) based on configuration
  4254. * and hardware limits.
  4255. *
  4256. * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
  4257. * is responsible for continually initiating channel-switching operations
  4258. * and returning to the base channel for communication with the AP. The
  4259. * driver receives a channel-switch request template and the location of
  4260. * the switch-timing IE within the template as part of the invocation.
  4261. * The template is valid only within the call, and the driver can
  4262. * optionally copy the skb for further re-use.
  4263. * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
  4264. * peers must be on the base channel when the call completes.
  4265. * @tdls_recv_channel_switch: a TDLS channel-switch related frame (request or
  4266. * response) has been received from a remote peer. The driver gets
  4267. * parameters parsed from the incoming frame and may use them to continue
  4268. * an ongoing channel-switch operation. In addition, a channel-switch
  4269. * response template is provided, together with the location of the
  4270. * switch-timing IE within the template. The skb can only be used within
  4271. * the function call.
  4272. *
  4273. * @wake_tx_queue: Called when new packets have been added to the queue.
  4274. * @sync_rx_queues: Process all pending frames in RSS queues. This is a
  4275. * synchronization which is needed in case driver has in its RSS queues
  4276. * pending frames that were received prior to the control path action
  4277. * currently taken (e.g. disassociation) but are not processed yet.
  4278. *
  4279. * @start_nan: join an existing NAN cluster, or create a new one.
  4280. * @stop_nan: leave the NAN cluster.
  4281. * @nan_change_conf: change NAN configuration. The data in cfg80211_nan_conf
  4282. * contains full new configuration and changes specify which parameters
  4283. * are changed with respect to the last NAN config.
  4284. * The driver gets both full configuration and the changed parameters since
  4285. * some devices may need the full configuration while others need only the
  4286. * changed parameters.
  4287. * @add_nan_func: Add a NAN function. Returns 0 on success. The data in
  4288. * cfg80211_nan_func must not be referenced outside the scope of
  4289. * this call.
  4290. * @del_nan_func: Remove a NAN function. The driver must call
  4291. * ieee80211_nan_func_terminated() with
  4292. * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
  4293. * @can_aggregate_in_amsdu: Called in order to determine if HW supports
  4294. * aggregating two specific frames in the same A-MSDU. The relation
  4295. * between the skbs should be symmetric and transitive. Note that while
  4296. * skb is always a real frame, head may or may not be an A-MSDU.
  4297. * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
  4298. * Statistics should be cumulative, currently no way to reset is provided.
  4299. *
  4300. * @start_pmsr: start peer measurement (e.g. FTM) (this call can sleep)
  4301. * @abort_pmsr: abort peer measurement (this call can sleep)
  4302. * @set_tid_config: Apply TID specific configurations. This callback may sleep.
  4303. * @reset_tid_config: Reset TID specific configuration for the peer.
  4304. * This callback may sleep.
  4305. * @update_vif_offload: Update virtual interface offload flags
  4306. * This callback may sleep.
  4307. * @sta_set_4addr: Called to notify the driver when a station starts/stops using
  4308. * 4-address mode
  4309. * @set_sar_specs: Update the SAR (TX power) settings.
  4310. * @sta_set_decap_offload: Called to notify the driver when a station is allowed
  4311. * to use rx decapsulation offload
  4312. * @add_twt_setup: Update hw with TWT agreement parameters received from the peer.
  4313. * This callback allows the hw to check if requested parameters
  4314. * are supported and if there is enough room for a new agreement.
  4315. * The hw is expected to set agreement result in the req_type field of
  4316. * twt structure.
  4317. * @twt_teardown_request: Update the hw with TWT teardown request received
  4318. * from the peer.
  4319. * @set_radar_background: Configure dedicated offchannel chain available for
  4320. * radar/CAC detection on some hw. This chain can't be used to transmit
  4321. * or receive frames and it is bounded to a running wdev.
  4322. * Background radar/CAC detection allows to avoid the CAC downtime
  4323. * switching to a different channel during CAC detection on the selected
  4324. * radar channel.
  4325. * The caller is expected to set chandef pointer to NULL in order to
  4326. * disable background CAC/radar detection.
  4327. * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to
  4328. * resolve a path for hardware flow offloading
  4329. * @can_activate_links: Checks if a specific active_links bitmap is
  4330. * supported by the driver.
  4331. * @change_vif_links: Change the valid links on an interface, note that while
  4332. * removing the old link information is still valid (link_conf pointer),
  4333. * but may immediately disappear after the function returns. The old or
  4334. * new links bitmaps may be 0 if going from/to a non-MLO situation.
  4335. * The @old array contains pointers to the old bss_conf structures
  4336. * that were already removed, in case they're needed.
  4337. * Note that removal of link should always succeed, so the return value
  4338. * will be ignored in a removal only case.
  4339. * This callback can sleep.
  4340. * @change_sta_links: Change the valid links of a station, similar to
  4341. * @change_vif_links. This callback can sleep.
  4342. * Note that a sta can also be inserted or removed with valid links,
  4343. * i.e. passed to @sta_add/@sta_state with sta->valid_links not zero.
  4344. * In fact, cannot change from having valid_links and not having them.
  4345. * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. This is
  4346. * not restored at HW reset by mac80211 so drivers need to take care of
  4347. * that.
  4348. * @net_setup_tc: Called from .ndo_setup_tc in order to prepare hardware
  4349. * flow offloading for flows originating from the vif.
  4350. * Note that the driver must not assume that the vif driver_data is valid
  4351. * at this point, since the callback can be called during netdev teardown.
  4352. * @can_neg_ttlm: for managed interface, requests the driver to determine
  4353. * if the requested TID-To-Link mapping can be accepted or not.
  4354. * If it's not accepted the driver may suggest a preferred mapping and
  4355. * modify @ttlm parameter with the suggested TID-to-Link mapping.
  4356. * @prep_add_interface: prepare for interface addition. This can be used by
  4357. * drivers to prepare for the addition of a new interface, e.g., allocate
  4358. * the needed resources etc. This callback doesn't guarantee that an
  4359. * interface with the specified type would be added, and thus drivers that
  4360. * implement this callback need to handle such cases. The type is the full
  4361. * &enum nl80211_iftype.
  4362. * @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay
  4363. * driver according to the parameter received in the EML Operating mode
  4364. * notification frame.
  4365. */
  4366. struct ieee80211_ops {
  4367. void (*tx)(struct ieee80211_hw *hw,
  4368. struct ieee80211_tx_control *control,
  4369. struct sk_buff *skb);
  4370. int (*start)(struct ieee80211_hw *hw);
  4371. void (*stop)(struct ieee80211_hw *hw, bool suspend);
  4372. #ifdef CONFIG_PM
  4373. int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
  4374. int (*resume)(struct ieee80211_hw *hw);
  4375. void (*set_wakeup)(struct ieee80211_hw *hw, bool enabled);
  4376. #endif
  4377. int (*add_interface)(struct ieee80211_hw *hw,
  4378. struct ieee80211_vif *vif);
  4379. int (*change_interface)(struct ieee80211_hw *hw,
  4380. struct ieee80211_vif *vif,
  4381. enum nl80211_iftype new_type, bool p2p);
  4382. void (*remove_interface)(struct ieee80211_hw *hw,
  4383. struct ieee80211_vif *vif);
  4384. int (*config)(struct ieee80211_hw *hw, int radio_idx, u32 changed);
  4385. void (*bss_info_changed)(struct ieee80211_hw *hw,
  4386. struct ieee80211_vif *vif,
  4387. struct ieee80211_bss_conf *info,
  4388. u64 changed);
  4389. void (*vif_cfg_changed)(struct ieee80211_hw *hw,
  4390. struct ieee80211_vif *vif,
  4391. u64 changed);
  4392. void (*link_info_changed)(struct ieee80211_hw *hw,
  4393. struct ieee80211_vif *vif,
  4394. struct ieee80211_bss_conf *info,
  4395. u64 changed);
  4396. int (*start_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4397. struct ieee80211_bss_conf *link_conf);
  4398. void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4399. struct ieee80211_bss_conf *link_conf);
  4400. u64 (*prepare_multicast)(struct ieee80211_hw *hw,
  4401. struct netdev_hw_addr_list *mc_list);
  4402. void (*configure_filter)(struct ieee80211_hw *hw,
  4403. unsigned int changed_flags,
  4404. unsigned int *total_flags,
  4405. u64 multicast);
  4406. void (*config_iface_filter)(struct ieee80211_hw *hw,
  4407. struct ieee80211_vif *vif,
  4408. unsigned int filter_flags,
  4409. unsigned int changed_flags);
  4410. int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
  4411. bool set);
  4412. int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
  4413. struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  4414. struct ieee80211_key_conf *key);
  4415. void (*update_tkip_key)(struct ieee80211_hw *hw,
  4416. struct ieee80211_vif *vif,
  4417. struct ieee80211_key_conf *conf,
  4418. struct ieee80211_sta *sta,
  4419. u32 iv32, u16 *phase1key);
  4420. void (*set_rekey_data)(struct ieee80211_hw *hw,
  4421. struct ieee80211_vif *vif,
  4422. struct cfg80211_gtk_rekey_data *data);
  4423. void (*set_default_unicast_key)(struct ieee80211_hw *hw,
  4424. struct ieee80211_vif *vif, int idx);
  4425. int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4426. struct ieee80211_scan_request *req);
  4427. void (*cancel_hw_scan)(struct ieee80211_hw *hw,
  4428. struct ieee80211_vif *vif);
  4429. int (*sched_scan_start)(struct ieee80211_hw *hw,
  4430. struct ieee80211_vif *vif,
  4431. struct cfg80211_sched_scan_request *req,
  4432. struct ieee80211_scan_ies *ies);
  4433. int (*sched_scan_stop)(struct ieee80211_hw *hw,
  4434. struct ieee80211_vif *vif);
  4435. void (*sw_scan_start)(struct ieee80211_hw *hw,
  4436. struct ieee80211_vif *vif,
  4437. const u8 *mac_addr);
  4438. void (*sw_scan_complete)(struct ieee80211_hw *hw,
  4439. struct ieee80211_vif *vif);
  4440. int (*get_stats)(struct ieee80211_hw *hw,
  4441. struct ieee80211_low_level_stats *stats);
  4442. void (*get_key_seq)(struct ieee80211_hw *hw,
  4443. struct ieee80211_key_conf *key,
  4444. struct ieee80211_key_seq *seq);
  4445. int (*set_frag_threshold)(struct ieee80211_hw *hw, int radio_idx,
  4446. u32 value);
  4447. int (*set_rts_threshold)(struct ieee80211_hw *hw, int radio_idx,
  4448. u32 value);
  4449. int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4450. struct ieee80211_sta *sta);
  4451. int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4452. struct ieee80211_sta *sta);
  4453. #ifdef CONFIG_MAC80211_DEBUGFS
  4454. void (*vif_add_debugfs)(struct ieee80211_hw *hw,
  4455. struct ieee80211_vif *vif);
  4456. void (*link_add_debugfs)(struct ieee80211_hw *hw,
  4457. struct ieee80211_vif *vif,
  4458. struct ieee80211_bss_conf *link_conf,
  4459. struct dentry *dir);
  4460. void (*sta_add_debugfs)(struct ieee80211_hw *hw,
  4461. struct ieee80211_vif *vif,
  4462. struct ieee80211_sta *sta,
  4463. struct dentry *dir);
  4464. void (*link_sta_add_debugfs)(struct ieee80211_hw *hw,
  4465. struct ieee80211_vif *vif,
  4466. struct ieee80211_link_sta *link_sta,
  4467. struct dentry *dir);
  4468. #endif
  4469. void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4470. enum sta_notify_cmd, struct ieee80211_sta *sta);
  4471. int (*sta_set_txpwr)(struct ieee80211_hw *hw,
  4472. struct ieee80211_vif *vif,
  4473. struct ieee80211_sta *sta);
  4474. int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4475. struct ieee80211_sta *sta,
  4476. enum ieee80211_sta_state old_state,
  4477. enum ieee80211_sta_state new_state);
  4478. void (*sta_pre_rcu_remove)(struct ieee80211_hw *hw,
  4479. struct ieee80211_vif *vif,
  4480. struct ieee80211_sta *sta);
  4481. void (*link_sta_rc_update)(struct ieee80211_hw *hw,
  4482. struct ieee80211_vif *vif,
  4483. struct ieee80211_link_sta *link_sta,
  4484. u32 changed);
  4485. void (*sta_rate_tbl_update)(struct ieee80211_hw *hw,
  4486. struct ieee80211_vif *vif,
  4487. struct ieee80211_sta *sta);
  4488. void (*sta_statistics)(struct ieee80211_hw *hw,
  4489. struct ieee80211_vif *vif,
  4490. struct ieee80211_sta *sta,
  4491. struct station_info *sinfo);
  4492. int (*conf_tx)(struct ieee80211_hw *hw,
  4493. struct ieee80211_vif *vif,
  4494. unsigned int link_id, u16 ac,
  4495. const struct ieee80211_tx_queue_params *params);
  4496. u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
  4497. void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4498. u64 tsf);
  4499. void (*offset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4500. s64 offset);
  4501. void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
  4502. int (*tx_last_beacon)(struct ieee80211_hw *hw);
  4503. void (*link_sta_statistics)(struct ieee80211_hw *hw,
  4504. struct ieee80211_vif *vif,
  4505. struct ieee80211_link_sta *link_sta,
  4506. struct link_station_info *link_sinfo);
  4507. /**
  4508. * @ampdu_action:
  4509. * Perform a certain A-MPDU action.
  4510. * The RA/TID combination determines the destination and TID we want
  4511. * the ampdu action to be performed for. The action is defined through
  4512. * ieee80211_ampdu_mlme_action.
  4513. * When the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL the driver
  4514. * may neither send aggregates containing more subframes than @buf_size
  4515. * nor send aggregates in a way that lost frames would exceed the
  4516. * buffer size. If just limiting the aggregate size, this would be
  4517. * possible with a buf_size of 8:
  4518. *
  4519. * - ``TX: 1.....7``
  4520. * - ``RX: 2....7`` (lost frame #1)
  4521. * - ``TX: 8..1...``
  4522. *
  4523. * which is invalid since #1 was now re-transmitted well past the
  4524. * buffer size of 8. Correct ways to retransmit #1 would be:
  4525. *
  4526. * - ``TX: 1 or``
  4527. * - ``TX: 18 or``
  4528. * - ``TX: 81``
  4529. *
  4530. * Even ``189`` would be wrong since 1 could be lost again.
  4531. *
  4532. * Returns a negative error code on failure. The driver may return
  4533. * %IEEE80211_AMPDU_TX_START_IMMEDIATE for %IEEE80211_AMPDU_TX_START
  4534. * if the session can start immediately.
  4535. *
  4536. * The callback can sleep.
  4537. */
  4538. int (*ampdu_action)(struct ieee80211_hw *hw,
  4539. struct ieee80211_vif *vif,
  4540. struct ieee80211_ampdu_params *params);
  4541. int (*get_survey)(struct ieee80211_hw *hw, int idx,
  4542. struct survey_info *survey);
  4543. void (*rfkill_poll)(struct ieee80211_hw *hw);
  4544. void (*set_coverage_class)(struct ieee80211_hw *hw, int radio_idx,
  4545. s16 coverage_class);
  4546. #ifdef CONFIG_NL80211_TESTMODE
  4547. int (*testmode_cmd)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4548. void *data, int len);
  4549. int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb,
  4550. struct netlink_callback *cb,
  4551. void *data, int len);
  4552. #endif
  4553. void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4554. u32 queues, bool drop);
  4555. void (*flush_sta)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4556. struct ieee80211_sta *sta);
  4557. void (*channel_switch)(struct ieee80211_hw *hw,
  4558. struct ieee80211_vif *vif,
  4559. struct ieee80211_channel_switch *ch_switch);
  4560. int (*set_antenna)(struct ieee80211_hw *hw, int radio_idx,
  4561. u32 tx_ant, u32 rx_ant);
  4562. int (*get_antenna)(struct ieee80211_hw *hw, int radio_idx,
  4563. u32 *tx_ant, u32 *rx_ant);
  4564. int (*remain_on_channel)(struct ieee80211_hw *hw,
  4565. struct ieee80211_vif *vif,
  4566. struct ieee80211_channel *chan,
  4567. int duration,
  4568. enum ieee80211_roc_type type);
  4569. int (*cancel_remain_on_channel)(struct ieee80211_hw *hw,
  4570. struct ieee80211_vif *vif);
  4571. int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
  4572. void (*get_ringparam)(struct ieee80211_hw *hw,
  4573. u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
  4574. bool (*tx_frames_pending)(struct ieee80211_hw *hw);
  4575. int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4576. const struct cfg80211_bitrate_mask *mask);
  4577. void (*event_callback)(struct ieee80211_hw *hw,
  4578. struct ieee80211_vif *vif,
  4579. const struct ieee80211_event *event);
  4580. void (*allow_buffered_frames)(struct ieee80211_hw *hw,
  4581. struct ieee80211_sta *sta,
  4582. u16 tids, int num_frames,
  4583. enum ieee80211_frame_release_type reason,
  4584. bool more_data);
  4585. void (*release_buffered_frames)(struct ieee80211_hw *hw,
  4586. struct ieee80211_sta *sta,
  4587. u16 tids, int num_frames,
  4588. enum ieee80211_frame_release_type reason,
  4589. bool more_data);
  4590. int (*get_et_sset_count)(struct ieee80211_hw *hw,
  4591. struct ieee80211_vif *vif, int sset);
  4592. void (*get_et_stats)(struct ieee80211_hw *hw,
  4593. struct ieee80211_vif *vif,
  4594. struct ethtool_stats *stats, u64 *data);
  4595. void (*get_et_strings)(struct ieee80211_hw *hw,
  4596. struct ieee80211_vif *vif,
  4597. u32 sset, u8 *data);
  4598. void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
  4599. struct ieee80211_vif *vif,
  4600. struct ieee80211_prep_tx_info *info);
  4601. void (*mgd_complete_tx)(struct ieee80211_hw *hw,
  4602. struct ieee80211_vif *vif,
  4603. struct ieee80211_prep_tx_info *info);
  4604. void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
  4605. struct ieee80211_vif *vif,
  4606. unsigned int link_id);
  4607. int (*add_chanctx)(struct ieee80211_hw *hw,
  4608. struct ieee80211_chanctx_conf *ctx);
  4609. void (*remove_chanctx)(struct ieee80211_hw *hw,
  4610. struct ieee80211_chanctx_conf *ctx);
  4611. void (*change_chanctx)(struct ieee80211_hw *hw,
  4612. struct ieee80211_chanctx_conf *ctx,
  4613. u32 changed);
  4614. int (*assign_vif_chanctx)(struct ieee80211_hw *hw,
  4615. struct ieee80211_vif *vif,
  4616. struct ieee80211_bss_conf *link_conf,
  4617. struct ieee80211_chanctx_conf *ctx);
  4618. void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
  4619. struct ieee80211_vif *vif,
  4620. struct ieee80211_bss_conf *link_conf,
  4621. struct ieee80211_chanctx_conf *ctx);
  4622. int (*switch_vif_chanctx)(struct ieee80211_hw *hw,
  4623. struct ieee80211_vif_chanctx_switch *vifs,
  4624. int n_vifs,
  4625. enum ieee80211_chanctx_switch_mode mode);
  4626. void (*reconfig_complete)(struct ieee80211_hw *hw,
  4627. enum ieee80211_reconfig_type reconfig_type);
  4628. #if IS_ENABLED(CONFIG_IPV6)
  4629. void (*ipv6_addr_change)(struct ieee80211_hw *hw,
  4630. struct ieee80211_vif *vif,
  4631. struct inet6_dev *idev);
  4632. #endif
  4633. void (*channel_switch_beacon)(struct ieee80211_hw *hw,
  4634. struct ieee80211_vif *vif,
  4635. struct cfg80211_chan_def *chandef);
  4636. int (*pre_channel_switch)(struct ieee80211_hw *hw,
  4637. struct ieee80211_vif *vif,
  4638. struct ieee80211_channel_switch *ch_switch);
  4639. int (*post_channel_switch)(struct ieee80211_hw *hw,
  4640. struct ieee80211_vif *vif,
  4641. struct ieee80211_bss_conf *link_conf);
  4642. void (*abort_channel_switch)(struct ieee80211_hw *hw,
  4643. struct ieee80211_vif *vif,
  4644. struct ieee80211_bss_conf *link_conf);
  4645. void (*channel_switch_rx_beacon)(struct ieee80211_hw *hw,
  4646. struct ieee80211_vif *vif,
  4647. struct ieee80211_channel_switch *ch_switch);
  4648. int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
  4649. void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
  4650. u32 (*get_expected_throughput)(struct ieee80211_hw *hw,
  4651. struct ieee80211_sta *sta);
  4652. int (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4653. unsigned int link_id, int *dbm);
  4654. int (*tdls_channel_switch)(struct ieee80211_hw *hw,
  4655. struct ieee80211_vif *vif,
  4656. struct ieee80211_sta *sta, u8 oper_class,
  4657. struct cfg80211_chan_def *chandef,
  4658. struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie);
  4659. void (*tdls_cancel_channel_switch)(struct ieee80211_hw *hw,
  4660. struct ieee80211_vif *vif,
  4661. struct ieee80211_sta *sta);
  4662. void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
  4663. struct ieee80211_vif *vif,
  4664. struct ieee80211_tdls_ch_sw_params *params);
  4665. void (*wake_tx_queue)(struct ieee80211_hw *hw,
  4666. struct ieee80211_txq *txq);
  4667. void (*sync_rx_queues)(struct ieee80211_hw *hw);
  4668. int (*start_nan)(struct ieee80211_hw *hw,
  4669. struct ieee80211_vif *vif,
  4670. struct cfg80211_nan_conf *conf);
  4671. int (*stop_nan)(struct ieee80211_hw *hw,
  4672. struct ieee80211_vif *vif);
  4673. int (*nan_change_conf)(struct ieee80211_hw *hw,
  4674. struct ieee80211_vif *vif,
  4675. struct cfg80211_nan_conf *conf, u32 changes);
  4676. int (*add_nan_func)(struct ieee80211_hw *hw,
  4677. struct ieee80211_vif *vif,
  4678. const struct cfg80211_nan_func *nan_func);
  4679. void (*del_nan_func)(struct ieee80211_hw *hw,
  4680. struct ieee80211_vif *vif,
  4681. u8 instance_id);
  4682. bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw,
  4683. struct sk_buff *head,
  4684. struct sk_buff *skb);
  4685. int (*get_ftm_responder_stats)(struct ieee80211_hw *hw,
  4686. struct ieee80211_vif *vif,
  4687. struct cfg80211_ftm_responder_stats *ftm_stats);
  4688. int (*start_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4689. struct cfg80211_pmsr_request *request);
  4690. void (*abort_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4691. struct cfg80211_pmsr_request *request);
  4692. int (*set_tid_config)(struct ieee80211_hw *hw,
  4693. struct ieee80211_vif *vif,
  4694. struct ieee80211_sta *sta,
  4695. struct cfg80211_tid_config *tid_conf);
  4696. int (*reset_tid_config)(struct ieee80211_hw *hw,
  4697. struct ieee80211_vif *vif,
  4698. struct ieee80211_sta *sta, u8 tids);
  4699. void (*update_vif_offload)(struct ieee80211_hw *hw,
  4700. struct ieee80211_vif *vif);
  4701. void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4702. struct ieee80211_sta *sta, bool enabled);
  4703. int (*set_sar_specs)(struct ieee80211_hw *hw,
  4704. const struct cfg80211_sar_specs *sar);
  4705. void (*sta_set_decap_offload)(struct ieee80211_hw *hw,
  4706. struct ieee80211_vif *vif,
  4707. struct ieee80211_sta *sta, bool enabled);
  4708. void (*add_twt_setup)(struct ieee80211_hw *hw,
  4709. struct ieee80211_sta *sta,
  4710. struct ieee80211_twt_setup *twt);
  4711. void (*twt_teardown_request)(struct ieee80211_hw *hw,
  4712. struct ieee80211_sta *sta, u8 flowid);
  4713. int (*set_radar_background)(struct ieee80211_hw *hw,
  4714. struct cfg80211_chan_def *chandef);
  4715. int (*net_fill_forward_path)(struct ieee80211_hw *hw,
  4716. struct ieee80211_vif *vif,
  4717. struct ieee80211_sta *sta,
  4718. struct net_device_path_ctx *ctx,
  4719. struct net_device_path *path);
  4720. bool (*can_activate_links)(struct ieee80211_hw *hw,
  4721. struct ieee80211_vif *vif,
  4722. u16 active_links);
  4723. int (*change_vif_links)(struct ieee80211_hw *hw,
  4724. struct ieee80211_vif *vif,
  4725. u16 old_links, u16 new_links,
  4726. struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]);
  4727. int (*change_sta_links)(struct ieee80211_hw *hw,
  4728. struct ieee80211_vif *vif,
  4729. struct ieee80211_sta *sta,
  4730. u16 old_links, u16 new_links);
  4731. int (*set_hw_timestamp)(struct ieee80211_hw *hw,
  4732. struct ieee80211_vif *vif,
  4733. struct cfg80211_set_hw_timestamp *hwts);
  4734. int (*net_setup_tc)(struct ieee80211_hw *hw,
  4735. struct ieee80211_vif *vif,
  4736. struct net_device *dev,
  4737. enum tc_setup_type type,
  4738. void *type_data);
  4739. enum ieee80211_neg_ttlm_res
  4740. (*can_neg_ttlm)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  4741. struct ieee80211_neg_ttlm *ttlm);
  4742. void (*prep_add_interface)(struct ieee80211_hw *hw,
  4743. enum nl80211_iftype type);
  4744. int (*set_eml_op_mode)(struct ieee80211_hw *hw,
  4745. struct ieee80211_vif *vif,
  4746. struct ieee80211_sta *sta,
  4747. struct ieee80211_eml_params *eml_params);
  4748. };
  4749. /**
  4750. * ieee80211_alloc_hw_nm - Allocate a new hardware device
  4751. *
  4752. * This must be called once for each hardware device. The returned pointer
  4753. * must be used to refer to this device when calling other functions.
  4754. * mac80211 allocates a private data area for the driver pointed to by
  4755. * @priv in &struct ieee80211_hw, the size of this area is given as
  4756. * @priv_data_len.
  4757. *
  4758. * @priv_data_len: length of private data
  4759. * @ops: callbacks for this device
  4760. * @requested_name: Requested name for this device.
  4761. * NULL is valid value, and means use the default naming (phy%d)
  4762. *
  4763. * Return: A pointer to the new hardware device, or %NULL on error.
  4764. */
  4765. struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
  4766. const struct ieee80211_ops *ops,
  4767. const char *requested_name);
  4768. /**
  4769. * ieee80211_alloc_hw - Allocate a new hardware device
  4770. *
  4771. * This must be called once for each hardware device. The returned pointer
  4772. * must be used to refer to this device when calling other functions.
  4773. * mac80211 allocates a private data area for the driver pointed to by
  4774. * @priv in &struct ieee80211_hw, the size of this area is given as
  4775. * @priv_data_len.
  4776. *
  4777. * @priv_data_len: length of private data
  4778. * @ops: callbacks for this device
  4779. *
  4780. * Return: A pointer to the new hardware device, or %NULL on error.
  4781. */
  4782. static inline
  4783. struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
  4784. const struct ieee80211_ops *ops)
  4785. {
  4786. return ieee80211_alloc_hw_nm(priv_data_len, ops, NULL);
  4787. }
  4788. /**
  4789. * ieee80211_register_hw - Register hardware device
  4790. *
  4791. * You must call this function before any other functions in
  4792. * mac80211. Note that before a hardware can be registered, you
  4793. * need to fill the contained wiphy's information.
  4794. *
  4795. * @hw: the device to register as returned by ieee80211_alloc_hw()
  4796. *
  4797. * Return: 0 on success. An error code otherwise.
  4798. */
  4799. int ieee80211_register_hw(struct ieee80211_hw *hw);
  4800. /**
  4801. * struct ieee80211_tpt_blink - throughput blink description
  4802. * @throughput: throughput in Kbit/sec
  4803. * @blink_time: blink time in milliseconds
  4804. * (full cycle, ie. one off + one on period)
  4805. */
  4806. struct ieee80211_tpt_blink {
  4807. int throughput;
  4808. int blink_time;
  4809. };
  4810. /**
  4811. * enum ieee80211_tpt_led_trigger_flags - throughput trigger flags
  4812. * @IEEE80211_TPT_LEDTRIG_FL_RADIO: enable blinking with radio
  4813. * @IEEE80211_TPT_LEDTRIG_FL_WORK: enable blinking when working
  4814. * @IEEE80211_TPT_LEDTRIG_FL_CONNECTED: enable blinking when at least one
  4815. * interface is connected in some way, including being an AP
  4816. */
  4817. enum ieee80211_tpt_led_trigger_flags {
  4818. IEEE80211_TPT_LEDTRIG_FL_RADIO = BIT(0),
  4819. IEEE80211_TPT_LEDTRIG_FL_WORK = BIT(1),
  4820. IEEE80211_TPT_LEDTRIG_FL_CONNECTED = BIT(2),
  4821. };
  4822. #ifdef CONFIG_MAC80211_LEDS
  4823. const char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
  4824. const char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
  4825. const char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
  4826. const char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
  4827. const char *
  4828. __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
  4829. unsigned int flags,
  4830. const struct ieee80211_tpt_blink *blink_table,
  4831. unsigned int blink_table_len);
  4832. #endif
  4833. /**
  4834. * ieee80211_get_tx_led_name - get name of TX LED
  4835. *
  4836. * mac80211 creates a transmit LED trigger for each wireless hardware
  4837. * that can be used to drive LEDs if your driver registers a LED device.
  4838. * This function returns the name (or %NULL if not configured for LEDs)
  4839. * of the trigger so you can automatically link the LED device.
  4840. *
  4841. * @hw: the hardware to get the LED trigger name for
  4842. *
  4843. * Return: The name of the LED trigger. %NULL if not configured for LEDs.
  4844. */
  4845. static inline const char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
  4846. {
  4847. #ifdef CONFIG_MAC80211_LEDS
  4848. return __ieee80211_get_tx_led_name(hw);
  4849. #else
  4850. return NULL;
  4851. #endif
  4852. }
  4853. /**
  4854. * ieee80211_get_rx_led_name - get name of RX LED
  4855. *
  4856. * mac80211 creates a receive LED trigger for each wireless hardware
  4857. * that can be used to drive LEDs if your driver registers a LED device.
  4858. * This function returns the name (or %NULL if not configured for LEDs)
  4859. * of the trigger so you can automatically link the LED device.
  4860. *
  4861. * @hw: the hardware to get the LED trigger name for
  4862. *
  4863. * Return: The name of the LED trigger. %NULL if not configured for LEDs.
  4864. */
  4865. static inline const char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
  4866. {
  4867. #ifdef CONFIG_MAC80211_LEDS
  4868. return __ieee80211_get_rx_led_name(hw);
  4869. #else
  4870. return NULL;
  4871. #endif
  4872. }
  4873. /**
  4874. * ieee80211_get_assoc_led_name - get name of association LED
  4875. *
  4876. * mac80211 creates a association LED trigger for each wireless hardware
  4877. * that can be used to drive LEDs if your driver registers a LED device.
  4878. * This function returns the name (or %NULL if not configured for LEDs)
  4879. * of the trigger so you can automatically link the LED device.
  4880. *
  4881. * @hw: the hardware to get the LED trigger name for
  4882. *
  4883. * Return: The name of the LED trigger. %NULL if not configured for LEDs.
  4884. */
  4885. static inline const char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
  4886. {
  4887. #ifdef CONFIG_MAC80211_LEDS
  4888. return __ieee80211_get_assoc_led_name(hw);
  4889. #else
  4890. return NULL;
  4891. #endif
  4892. }
  4893. /**
  4894. * ieee80211_get_radio_led_name - get name of radio LED
  4895. *
  4896. * mac80211 creates a radio change LED trigger for each wireless hardware
  4897. * that can be used to drive LEDs if your driver registers a LED device.
  4898. * This function returns the name (or %NULL if not configured for LEDs)
  4899. * of the trigger so you can automatically link the LED device.
  4900. *
  4901. * @hw: the hardware to get the LED trigger name for
  4902. *
  4903. * Return: The name of the LED trigger. %NULL if not configured for LEDs.
  4904. */
  4905. static inline const char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
  4906. {
  4907. #ifdef CONFIG_MAC80211_LEDS
  4908. return __ieee80211_get_radio_led_name(hw);
  4909. #else
  4910. return NULL;
  4911. #endif
  4912. }
  4913. /**
  4914. * ieee80211_create_tpt_led_trigger - create throughput LED trigger
  4915. * @hw: the hardware to create the trigger for
  4916. * @flags: trigger flags, see &enum ieee80211_tpt_led_trigger_flags
  4917. * @blink_table: the blink table -- needs to be ordered by throughput
  4918. * @blink_table_len: size of the blink table
  4919. *
  4920. * Return: %NULL (in case of error, or if no LED triggers are
  4921. * configured) or the name of the new trigger.
  4922. *
  4923. * Note: This function must be called before ieee80211_register_hw().
  4924. */
  4925. static inline const char *
  4926. ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags,
  4927. const struct ieee80211_tpt_blink *blink_table,
  4928. unsigned int blink_table_len)
  4929. {
  4930. #ifdef CONFIG_MAC80211_LEDS
  4931. return __ieee80211_create_tpt_led_trigger(hw, flags, blink_table,
  4932. blink_table_len);
  4933. #else
  4934. return NULL;
  4935. #endif
  4936. }
  4937. /**
  4938. * ieee80211_unregister_hw - Unregister a hardware device
  4939. *
  4940. * This function instructs mac80211 to free allocated resources
  4941. * and unregister netdevices from the networking subsystem.
  4942. *
  4943. * @hw: the hardware to unregister
  4944. */
  4945. void ieee80211_unregister_hw(struct ieee80211_hw *hw);
  4946. /**
  4947. * ieee80211_free_hw - free hardware descriptor
  4948. *
  4949. * This function frees everything that was allocated, including the
  4950. * private data for the driver. You must call ieee80211_unregister_hw()
  4951. * before calling this function.
  4952. *
  4953. * @hw: the hardware to free
  4954. */
  4955. void ieee80211_free_hw(struct ieee80211_hw *hw);
  4956. /**
  4957. * ieee80211_restart_hw - restart hardware completely
  4958. *
  4959. * Call this function when the hardware was restarted for some reason
  4960. * (hardware error, ...) and the driver is unable to restore its state
  4961. * by itself. mac80211 assumes that at this point the driver/hardware
  4962. * is completely uninitialised and stopped, it starts the process by
  4963. * calling the ->start() operation. The driver will need to reset all
  4964. * internal state that it has prior to calling this function.
  4965. *
  4966. * @hw: the hardware to restart
  4967. */
  4968. void ieee80211_restart_hw(struct ieee80211_hw *hw);
  4969. /**
  4970. * ieee80211_rx_list - receive frame and store processed skbs in a list
  4971. *
  4972. * Use this function to hand received frames to mac80211. The receive
  4973. * buffer in @skb must start with an IEEE 802.11 header. In case of a
  4974. * paged @skb is used, the driver is recommended to put the ieee80211
  4975. * header of the frame on the linear part of the @skb to avoid memory
  4976. * allocation and/or memcpy by the stack.
  4977. *
  4978. * This function may not be called in IRQ context. Calls to this function
  4979. * for a single hardware must be synchronized against each other. Calls to
  4980. * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
  4981. * mixed for a single hardware. Must not run concurrently with
  4982. * ieee80211_tx_status_skb() or ieee80211_tx_status_ni().
  4983. *
  4984. * This function must be called with BHs disabled and RCU read lock
  4985. *
  4986. * @hw: the hardware this frame came in on
  4987. * @sta: the station the frame was received from, or %NULL
  4988. * @skb: the buffer to receive, owned by mac80211 after this call
  4989. * @list: the destination list
  4990. */
  4991. void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
  4992. struct sk_buff *skb, struct list_head *list);
  4993. /**
  4994. * ieee80211_rx_napi - receive frame from NAPI context
  4995. *
  4996. * Use this function to hand received frames to mac80211. The receive
  4997. * buffer in @skb must start with an IEEE 802.11 header. In case of a
  4998. * paged @skb is used, the driver is recommended to put the ieee80211
  4999. * header of the frame on the linear part of the @skb to avoid memory
  5000. * allocation and/or memcpy by the stack.
  5001. *
  5002. * This function may not be called in IRQ context. Calls to this function
  5003. * for a single hardware must be synchronized against each other. Calls to
  5004. * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
  5005. * mixed for a single hardware. Must not run concurrently with
  5006. * ieee80211_tx_status_skb() or ieee80211_tx_status_ni().
  5007. *
  5008. * This function must be called with BHs disabled.
  5009. *
  5010. * @hw: the hardware this frame came in on
  5011. * @sta: the station the frame was received from, or %NULL
  5012. * @skb: the buffer to receive, owned by mac80211 after this call
  5013. * @napi: the NAPI context
  5014. */
  5015. void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
  5016. struct sk_buff *skb, struct napi_struct *napi);
  5017. /**
  5018. * ieee80211_rx - receive frame
  5019. *
  5020. * Use this function to hand received frames to mac80211. The receive
  5021. * buffer in @skb must start with an IEEE 802.11 header. In case of a
  5022. * paged @skb is used, the driver is recommended to put the ieee80211
  5023. * header of the frame on the linear part of the @skb to avoid memory
  5024. * allocation and/or memcpy by the stack.
  5025. *
  5026. * This function may not be called in IRQ context. Calls to this function
  5027. * for a single hardware must be synchronized against each other. Calls to
  5028. * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
  5029. * mixed for a single hardware. Must not run concurrently with
  5030. * ieee80211_tx_status_skb() or ieee80211_tx_status_ni().
  5031. *
  5032. * In process context use instead ieee80211_rx_ni().
  5033. *
  5034. * @hw: the hardware this frame came in on
  5035. * @skb: the buffer to receive, owned by mac80211 after this call
  5036. */
  5037. static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
  5038. {
  5039. ieee80211_rx_napi(hw, NULL, skb, NULL);
  5040. }
  5041. /**
  5042. * ieee80211_rx_irqsafe - receive frame
  5043. *
  5044. * Like ieee80211_rx() but can be called in IRQ context
  5045. * (internally defers to a tasklet.)
  5046. *
  5047. * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not
  5048. * be mixed for a single hardware.Must not run concurrently with
  5049. * ieee80211_tx_status_skb() or ieee80211_tx_status_ni().
  5050. *
  5051. * @hw: the hardware this frame came in on
  5052. * @skb: the buffer to receive, owned by mac80211 after this call
  5053. */
  5054. void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
  5055. /**
  5056. * ieee80211_rx_ni - receive frame (in process context)
  5057. *
  5058. * Like ieee80211_rx() but can be called in process context
  5059. * (internally disables bottom halves).
  5060. *
  5061. * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may
  5062. * not be mixed for a single hardware. Must not run concurrently with
  5063. * ieee80211_tx_status_skb() or ieee80211_tx_status_ni().
  5064. *
  5065. * @hw: the hardware this frame came in on
  5066. * @skb: the buffer to receive, owned by mac80211 after this call
  5067. */
  5068. static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
  5069. struct sk_buff *skb)
  5070. {
  5071. local_bh_disable();
  5072. ieee80211_rx(hw, skb);
  5073. local_bh_enable();
  5074. }
  5075. /**
  5076. * ieee80211_sta_ps_transition - PS transition for connected sta
  5077. *
  5078. * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS
  5079. * flag set, use this function to inform mac80211 about a connected station
  5080. * entering/leaving PS mode.
  5081. *
  5082. * This function may not be called in IRQ context or with softirqs enabled.
  5083. *
  5084. * Calls to this function for a single hardware must be synchronized against
  5085. * each other.
  5086. *
  5087. * @sta: currently connected sta
  5088. * @start: start or stop PS
  5089. *
  5090. * Return: 0 on success. -EINVAL when the requested PS mode is already set.
  5091. */
  5092. int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start);
  5093. /**
  5094. * ieee80211_sta_ps_transition_ni - PS transition for connected sta
  5095. * (in process context)
  5096. *
  5097. * Like ieee80211_sta_ps_transition() but can be called in process context
  5098. * (internally disables bottom halves). Concurrent call restriction still
  5099. * applies.
  5100. *
  5101. * @sta: currently connected sta
  5102. * @start: start or stop PS
  5103. *
  5104. * Return: Like ieee80211_sta_ps_transition().
  5105. */
  5106. static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta,
  5107. bool start)
  5108. {
  5109. int ret;
  5110. local_bh_disable();
  5111. ret = ieee80211_sta_ps_transition(sta, start);
  5112. local_bh_enable();
  5113. return ret;
  5114. }
  5115. /**
  5116. * ieee80211_sta_pspoll - PS-Poll frame received
  5117. * @sta: currently connected station
  5118. *
  5119. * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS flag set,
  5120. * use this function to inform mac80211 that a PS-Poll frame from a
  5121. * connected station was received.
  5122. * This must be used in conjunction with ieee80211_sta_ps_transition()
  5123. * and possibly ieee80211_sta_uapsd_trigger(); calls to all three must
  5124. * be serialized.
  5125. */
  5126. void ieee80211_sta_pspoll(struct ieee80211_sta *sta);
  5127. /**
  5128. * ieee80211_sta_uapsd_trigger - (potential) U-APSD trigger frame received
  5129. * @sta: currently connected station
  5130. * @tid: TID of the received (potential) trigger frame
  5131. *
  5132. * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS flag set,
  5133. * use this function to inform mac80211 that a (potential) trigger frame
  5134. * from a connected station was received.
  5135. * This must be used in conjunction with ieee80211_sta_ps_transition()
  5136. * and possibly ieee80211_sta_pspoll(); calls to all three must be
  5137. * serialized.
  5138. * %IEEE80211_NUM_TIDS can be passed as the tid if the tid is unknown.
  5139. * In this case, mac80211 will not check that this tid maps to an AC
  5140. * that is trigger enabled and assume that the caller did the proper
  5141. * checks.
  5142. */
  5143. void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, u8 tid);
  5144. /*
  5145. * The TX headroom reserved by mac80211 for its own tx_status functions.
  5146. * This is enough for the radiotap header.
  5147. */
  5148. #define IEEE80211_TX_STATUS_HEADROOM ALIGN(14, 4)
  5149. /**
  5150. * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames
  5151. * @sta: &struct ieee80211_sta pointer for the sleeping station
  5152. * @tid: the TID that has buffered frames
  5153. * @buffered: indicates whether or not frames are buffered for this TID
  5154. *
  5155. * If a driver buffers frames for a powersave station instead of passing
  5156. * them back to mac80211 for retransmission, the station may still need
  5157. * to be told that there are buffered frames via the TIM bit.
  5158. *
  5159. * This function informs mac80211 whether or not there are frames that are
  5160. * buffered in the driver for a given TID; mac80211 can then use this data
  5161. * to set the TIM bit (NOTE: This may call back into the driver's set_tim
  5162. * call! Beware of the locking!)
  5163. *
  5164. * If all frames are released to the station (due to PS-poll or uAPSD)
  5165. * then the driver needs to inform mac80211 that there no longer are
  5166. * frames buffered. However, when the station wakes up mac80211 assumes
  5167. * that all buffered frames will be transmitted and clears this data,
  5168. * drivers need to make sure they inform mac80211 about all buffered
  5169. * frames on the sleep transition (sta_notify() with %STA_NOTIFY_SLEEP).
  5170. *
  5171. * Note that technically mac80211 only needs to know this per AC, not per
  5172. * TID, but since driver buffering will inevitably happen per TID (since
  5173. * it is related to aggregation) it is easier to make mac80211 map the
  5174. * TID to the AC as required instead of keeping track in all drivers that
  5175. * use this API.
  5176. */
  5177. void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
  5178. u8 tid, bool buffered);
  5179. /**
  5180. * ieee80211_get_tx_rates - get the selected transmit rates for a packet
  5181. *
  5182. * Call this function in a driver with per-packet rate selection support
  5183. * to combine the rate info in the packet tx info with the most recent
  5184. * rate selection table for the station entry.
  5185. *
  5186. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5187. * @sta: the receiver station to which this packet is sent.
  5188. * @skb: the frame to be transmitted.
  5189. * @dest: buffer for extracted rate/retry information
  5190. * @max_rates: maximum number of rates to fetch
  5191. */
  5192. void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
  5193. struct ieee80211_sta *sta,
  5194. struct sk_buff *skb,
  5195. struct ieee80211_tx_rate *dest,
  5196. int max_rates);
  5197. /**
  5198. * ieee80211_tx_rate_update - transmit rate update callback
  5199. *
  5200. * Drivers should call this functions with a non-NULL pub sta
  5201. * This function can be used in drivers that does not have provision
  5202. * in updating the tx rate in data path.
  5203. *
  5204. * @hw: the hardware the frame was transmitted by
  5205. * @pubsta: the station to update the tx rate for.
  5206. * @info: tx status information
  5207. */
  5208. void ieee80211_tx_rate_update(struct ieee80211_hw *hw,
  5209. struct ieee80211_sta *pubsta,
  5210. struct ieee80211_tx_info *info);
  5211. /**
  5212. * ieee80211_tx_status_skb - transmit status callback
  5213. *
  5214. * Call this function for all transmitted frames after they have been
  5215. * transmitted. It is permissible to not call this function for
  5216. * multicast frames but this can affect statistics.
  5217. *
  5218. * This function may not be called in IRQ context. Calls to this function
  5219. * for a single hardware must be synchronized against each other. Calls
  5220. * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe()
  5221. * may not be mixed for a single hardware. Must not run concurrently with
  5222. * ieee80211_rx() or ieee80211_rx_ni().
  5223. *
  5224. * @hw: the hardware the frame was transmitted by
  5225. * @skb: the frame that was transmitted, owned by mac80211 after this call
  5226. */
  5227. void ieee80211_tx_status_skb(struct ieee80211_hw *hw,
  5228. struct sk_buff *skb);
  5229. /**
  5230. * ieee80211_tx_status_ext - extended transmit status callback
  5231. *
  5232. * This function can be used as a replacement for ieee80211_tx_status_skb()
  5233. * in drivers that may want to provide extra information that does not
  5234. * fit into &struct ieee80211_tx_info.
  5235. *
  5236. * Calls to this function for a single hardware must be synchronized
  5237. * against each other. Calls to this function, ieee80211_tx_status_ni()
  5238. * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware.
  5239. *
  5240. * @hw: the hardware the frame was transmitted by
  5241. * @status: tx status information
  5242. */
  5243. void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
  5244. struct ieee80211_tx_status *status);
  5245. /**
  5246. * ieee80211_tx_status_noskb - transmit status callback without skb
  5247. *
  5248. * This function can be used as a replacement for ieee80211_tx_status_skb()
  5249. * in drivers that cannot reliably map tx status information back to
  5250. * specific skbs.
  5251. *
  5252. * Calls to this function for a single hardware must be synchronized
  5253. * against each other. Calls to this function, ieee80211_tx_status_ni()
  5254. * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware.
  5255. *
  5256. * @hw: the hardware the frame was transmitted by
  5257. * @sta: the receiver station to which this packet is sent
  5258. * (NULL for multicast packets)
  5259. * @info: tx status information
  5260. */
  5261. static inline void ieee80211_tx_status_noskb(struct ieee80211_hw *hw,
  5262. struct ieee80211_sta *sta,
  5263. struct ieee80211_tx_info *info)
  5264. {
  5265. struct ieee80211_tx_status status = {
  5266. .sta = sta,
  5267. .info = info,
  5268. };
  5269. ieee80211_tx_status_ext(hw, &status);
  5270. }
  5271. /**
  5272. * ieee80211_tx_status_ni - transmit status callback (in process context)
  5273. *
  5274. * Like ieee80211_tx_status_skb() but can be called in process context.
  5275. *
  5276. * Calls to this function, ieee80211_tx_status_skb() and
  5277. * ieee80211_tx_status_irqsafe() may not be mixed
  5278. * for a single hardware.
  5279. *
  5280. * @hw: the hardware the frame was transmitted by
  5281. * @skb: the frame that was transmitted, owned by mac80211 after this call
  5282. */
  5283. static inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw,
  5284. struct sk_buff *skb)
  5285. {
  5286. local_bh_disable();
  5287. ieee80211_tx_status_skb(hw, skb);
  5288. local_bh_enable();
  5289. }
  5290. /**
  5291. * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback
  5292. *
  5293. * Like ieee80211_tx_status_skb() but can be called in IRQ context
  5294. * (internally defers to a tasklet.)
  5295. *
  5296. * Calls to this function, ieee80211_tx_status_skb() and
  5297. * ieee80211_tx_status_ni() may not be mixed for a single hardware.
  5298. *
  5299. * @hw: the hardware the frame was transmitted by
  5300. * @skb: the frame that was transmitted, owned by mac80211 after this call
  5301. */
  5302. void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
  5303. struct sk_buff *skb);
  5304. /**
  5305. * ieee80211_report_low_ack - report non-responding station
  5306. *
  5307. * When operating in AP-mode, call this function to report a non-responding
  5308. * connected STA.
  5309. *
  5310. * @sta: the non-responding connected sta
  5311. * @num_packets: number of packets sent to @sta without a response
  5312. */
  5313. void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
  5314. #define IEEE80211_MAX_CNTDWN_COUNTERS_NUM 2
  5315. /**
  5316. * struct ieee80211_mutable_offsets - mutable beacon offsets
  5317. * @tim_offset: position of TIM element
  5318. * @tim_length: size of TIM element
  5319. * @cntdwn_counter_offs: array of IEEE80211_MAX_CNTDWN_COUNTERS_NUM offsets
  5320. * to countdown counters. This array can contain zero values which
  5321. * should be ignored.
  5322. * @mbssid_off: position of the multiple bssid element
  5323. */
  5324. struct ieee80211_mutable_offsets {
  5325. u16 tim_offset;
  5326. u16 tim_length;
  5327. u16 cntdwn_counter_offs[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
  5328. u16 mbssid_off;
  5329. };
  5330. /**
  5331. * ieee80211_beacon_get_template - beacon template generation function
  5332. * @hw: pointer obtained from ieee80211_alloc_hw().
  5333. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5334. * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
  5335. * receive the offsets that may be updated by the driver.
  5336. * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
  5337. * that is not associated with AP MLD).
  5338. *
  5339. * If the driver implements beaconing modes, it must use this function to
  5340. * obtain the beacon template.
  5341. *
  5342. * This function should be used if the beacon frames are generated by the
  5343. * device, and then the driver must use the returned beacon as the template
  5344. * The driver or the device are responsible to update the DTIM and, when
  5345. * applicable, the CSA count.
  5346. *
  5347. * The driver is responsible for freeing the returned skb.
  5348. *
  5349. * Return: The beacon template. %NULL on error.
  5350. */
  5351. struct sk_buff *
  5352. ieee80211_beacon_get_template(struct ieee80211_hw *hw,
  5353. struct ieee80211_vif *vif,
  5354. struct ieee80211_mutable_offsets *offs,
  5355. unsigned int link_id);
  5356. /**
  5357. * ieee80211_beacon_get_template_ema_index - EMA beacon template generation
  5358. * @hw: pointer obtained from ieee80211_alloc_hw().
  5359. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5360. * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
  5361. * receive the offsets that may be updated by the driver.
  5362. * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP).
  5363. * @ema_index: index of the beacon in the EMA set.
  5364. *
  5365. * This function follows the same rules as ieee80211_beacon_get_template()
  5366. * but returns a beacon template which includes multiple BSSID element at the
  5367. * requested index.
  5368. *
  5369. * Return: The beacon template. %NULL indicates the end of EMA templates.
  5370. */
  5371. struct sk_buff *
  5372. ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw,
  5373. struct ieee80211_vif *vif,
  5374. struct ieee80211_mutable_offsets *offs,
  5375. unsigned int link_id, u8 ema_index);
  5376. /**
  5377. * struct ieee80211_ema_beacons - List of EMA beacons
  5378. * @cnt: count of EMA beacons.
  5379. *
  5380. * @bcn: array of EMA beacons.
  5381. * @bcn.skb: the skb containing this specific beacon
  5382. * @bcn.offs: &struct ieee80211_mutable_offsets pointer to struct that will
  5383. * receive the offsets that may be updated by the driver.
  5384. */
  5385. struct ieee80211_ema_beacons {
  5386. u8 cnt;
  5387. struct {
  5388. struct sk_buff *skb;
  5389. struct ieee80211_mutable_offsets offs;
  5390. } bcn[];
  5391. };
  5392. /**
  5393. * ieee80211_beacon_get_template_ema_list - EMA beacon template generation
  5394. * @hw: pointer obtained from ieee80211_alloc_hw().
  5395. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5396. * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP)
  5397. *
  5398. * This function follows the same rules as ieee80211_beacon_get_template()
  5399. * but allocates and returns a pointer to list of all beacon templates required
  5400. * to cover all profiles in the multiple BSSID set. Each template includes only
  5401. * one multiple BSSID element.
  5402. *
  5403. * Driver must call ieee80211_beacon_free_ema_list() to free the memory.
  5404. *
  5405. * Return: EMA beacon templates of type struct ieee80211_ema_beacons *.
  5406. * %NULL on error.
  5407. */
  5408. struct ieee80211_ema_beacons *
  5409. ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,
  5410. struct ieee80211_vif *vif,
  5411. unsigned int link_id);
  5412. /**
  5413. * ieee80211_beacon_free_ema_list - free an EMA beacon template list
  5414. * @ema_beacons: list of EMA beacons of type &struct ieee80211_ema_beacons pointers.
  5415. *
  5416. * This function will free a list previously acquired by calling
  5417. * ieee80211_beacon_get_template_ema_list()
  5418. */
  5419. void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons);
  5420. /**
  5421. * ieee80211_beacon_get_tim - beacon generation function
  5422. * @hw: pointer obtained from ieee80211_alloc_hw().
  5423. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5424. * @tim_offset: pointer to variable that will receive the TIM IE offset.
  5425. * Set to 0 if invalid (in non-AP modes).
  5426. * @tim_length: pointer to variable that will receive the TIM IE length,
  5427. * (including the ID and length bytes!).
  5428. * Set to 0 if invalid (in non-AP modes).
  5429. * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
  5430. * that is not associated with AP MLD).
  5431. *
  5432. * If the driver implements beaconing modes, it must use this function to
  5433. * obtain the beacon frame.
  5434. *
  5435. * If the beacon frames are generated by the host system (i.e., not in
  5436. * hardware/firmware), the driver uses this function to get each beacon
  5437. * frame from mac80211 -- it is responsible for calling this function exactly
  5438. * once before the beacon is needed (e.g. based on hardware interrupt).
  5439. *
  5440. * The driver is responsible for freeing the returned skb.
  5441. *
  5442. * Return: The beacon template. %NULL on error.
  5443. */
  5444. struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
  5445. struct ieee80211_vif *vif,
  5446. u16 *tim_offset, u16 *tim_length,
  5447. unsigned int link_id);
  5448. /**
  5449. * ieee80211_beacon_get - beacon generation function
  5450. * @hw: pointer obtained from ieee80211_alloc_hw().
  5451. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5452. * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
  5453. * that is not associated with AP MLD).
  5454. *
  5455. * See ieee80211_beacon_get_tim().
  5456. *
  5457. * Return: See ieee80211_beacon_get_tim().
  5458. */
  5459. static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
  5460. struct ieee80211_vif *vif,
  5461. unsigned int link_id)
  5462. {
  5463. return ieee80211_beacon_get_tim(hw, vif, NULL, NULL, link_id);
  5464. }
  5465. /**
  5466. * ieee80211_beacon_update_cntdwn - request mac80211 to decrement the beacon countdown
  5467. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5468. * @link_id: valid link_id during MLO or 0 for non-MLO
  5469. *
  5470. * The beacon counter should be updated after each beacon transmission.
  5471. * This function is called implicitly when
  5472. * ieee80211_beacon_get/ieee80211_beacon_get_tim are called, however if the
  5473. * beacon frames are generated by the device, the driver should call this
  5474. * function after each beacon transmission to sync mac80211's beacon countdown.
  5475. *
  5476. * Return: new countdown value
  5477. */
  5478. u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif,
  5479. unsigned int link_id);
  5480. /**
  5481. * ieee80211_beacon_set_cntdwn - request mac80211 to set beacon countdown
  5482. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5483. * @counter: the new value for the counter
  5484. *
  5485. * The beacon countdown can be changed by the device, this API should be
  5486. * used by the device driver to update csa counter in mac80211.
  5487. *
  5488. * It should never be used together with ieee80211_beacon_update_cntdwn(),
  5489. * as it will cause a race condition around the counter value.
  5490. */
  5491. void ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter);
  5492. /**
  5493. * ieee80211_csa_finish - notify mac80211 about channel switch
  5494. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5495. * @link_id: valid link_id during MLO or 0 for non-MLO
  5496. *
  5497. * After a channel switch announcement was scheduled and the counter in this
  5498. * announcement hits 1, this function must be called by the driver to
  5499. * notify mac80211 that the channel can be changed.
  5500. */
  5501. void ieee80211_csa_finish(struct ieee80211_vif *vif, unsigned int link_id);
  5502. /**
  5503. * ieee80211_beacon_cntdwn_is_complete - find out if countdown reached 1
  5504. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5505. * @link_id: valid link_id during MLO or 0 for non-MLO
  5506. *
  5507. * Return: %true if the countdown reached 1, %false otherwise
  5508. */
  5509. bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif,
  5510. unsigned int link_id);
  5511. /**
  5512. * ieee80211_color_change_finish - notify mac80211 about color change
  5513. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5514. * @link_id: valid link_id during MLO or 0 for non-MLO
  5515. *
  5516. * After a color change announcement was scheduled and the counter in this
  5517. * announcement hits 1, this function must be called by the driver to
  5518. * notify mac80211 that the color can be changed
  5519. */
  5520. void ieee80211_color_change_finish(struct ieee80211_vif *vif, u8 link_id);
  5521. /**
  5522. * ieee80211_proberesp_get - retrieve a Probe Response template
  5523. * @hw: pointer obtained from ieee80211_alloc_hw().
  5524. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5525. *
  5526. * Creates a Probe Response template which can, for example, be uploaded to
  5527. * hardware. The destination address should be set by the caller.
  5528. *
  5529. * Can only be called in AP mode.
  5530. *
  5531. * Return: The Probe Response template. %NULL on error.
  5532. */
  5533. struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
  5534. struct ieee80211_vif *vif);
  5535. /**
  5536. * ieee80211_pspoll_get - retrieve a PS Poll template
  5537. * @hw: pointer obtained from ieee80211_alloc_hw().
  5538. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5539. *
  5540. * Creates a PS Poll a template which can, for example, uploaded to
  5541. * hardware. The template must be updated after association so that correct
  5542. * AID, BSSID and MAC address is used.
  5543. *
  5544. * Note: Caller (or hardware) is responsible for setting the
  5545. * &IEEE80211_FCTL_PM bit.
  5546. *
  5547. * Return: The PS Poll template. %NULL on error.
  5548. */
  5549. struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
  5550. struct ieee80211_vif *vif);
  5551. /**
  5552. * ieee80211_nullfunc_get - retrieve a nullfunc template
  5553. * @hw: pointer obtained from ieee80211_alloc_hw().
  5554. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5555. * @link_id: If the vif is an MLD, get a frame with the link addresses
  5556. * for the given link ID. For a link_id < 0 you get a frame with
  5557. * MLD addresses, however useful that might be.
  5558. * @qos_ok: QoS NDP is acceptable to the caller, this should be set
  5559. * if at all possible
  5560. *
  5561. * Creates a Nullfunc template which can, for example, uploaded to
  5562. * hardware. The template must be updated after association so that correct
  5563. * BSSID and address is used.
  5564. *
  5565. * If @qos_ndp is set and the association is to an AP with QoS/WMM, the
  5566. * returned packet will be QoS NDP.
  5567. *
  5568. * Note: Caller (or hardware) is responsible for setting the
  5569. * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields.
  5570. *
  5571. * Return: The nullfunc template. %NULL on error.
  5572. */
  5573. struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
  5574. struct ieee80211_vif *vif,
  5575. int link_id, bool qos_ok);
  5576. /**
  5577. * ieee80211_probereq_get - retrieve a Probe Request template
  5578. * @hw: pointer obtained from ieee80211_alloc_hw().
  5579. * @src_addr: source MAC address
  5580. * @ssid: SSID buffer
  5581. * @ssid_len: length of SSID
  5582. * @tailroom: tailroom to reserve at end of SKB for IEs
  5583. *
  5584. * Creates a Probe Request template which can, for example, be uploaded to
  5585. * hardware.
  5586. *
  5587. * Return: The Probe Request template. %NULL on error.
  5588. */
  5589. struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
  5590. const u8 *src_addr,
  5591. const u8 *ssid, size_t ssid_len,
  5592. size_t tailroom);
  5593. /**
  5594. * ieee80211_rts_get - RTS frame generation function
  5595. * @hw: pointer obtained from ieee80211_alloc_hw().
  5596. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5597. * @frame: pointer to the frame that is going to be protected by the RTS.
  5598. * @frame_len: the frame length (in octets).
  5599. * @frame_txctl: &struct ieee80211_tx_info of the frame.
  5600. * @rts: The buffer where to store the RTS frame.
  5601. *
  5602. * If the RTS frames are generated by the host system (i.e., not in
  5603. * hardware/firmware), the low-level driver uses this function to receive
  5604. * the next RTS frame from the 802.11 code. The low-level is responsible
  5605. * for calling this function before and RTS frame is needed.
  5606. */
  5607. void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  5608. const void *frame, size_t frame_len,
  5609. const struct ieee80211_tx_info *frame_txctl,
  5610. struct ieee80211_rts *rts);
  5611. /**
  5612. * ieee80211_rts_duration - Get the duration field for an RTS frame
  5613. * @hw: pointer obtained from ieee80211_alloc_hw().
  5614. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5615. * @frame_len: the length of the frame that is going to be protected by the RTS.
  5616. * @frame_txctl: &struct ieee80211_tx_info of the frame.
  5617. *
  5618. * If the RTS is generated in firmware, but the host system must provide
  5619. * the duration field, the low-level driver uses this function to receive
  5620. * the duration field value in little-endian byteorder.
  5621. *
  5622. * Return: The duration.
  5623. */
  5624. __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
  5625. struct ieee80211_vif *vif, size_t frame_len,
  5626. const struct ieee80211_tx_info *frame_txctl);
  5627. /**
  5628. * ieee80211_ctstoself_get - CTS-to-self frame generation function
  5629. * @hw: pointer obtained from ieee80211_alloc_hw().
  5630. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5631. * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
  5632. * @frame_len: the frame length (in octets).
  5633. * @frame_txctl: &struct ieee80211_tx_info of the frame.
  5634. * @cts: The buffer where to store the CTS-to-self frame.
  5635. *
  5636. * If the CTS-to-self frames are generated by the host system (i.e., not in
  5637. * hardware/firmware), the low-level driver uses this function to receive
  5638. * the next CTS-to-self frame from the 802.11 code. The low-level is responsible
  5639. * for calling this function before and CTS-to-self frame is needed.
  5640. */
  5641. void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
  5642. struct ieee80211_vif *vif,
  5643. const void *frame, size_t frame_len,
  5644. const struct ieee80211_tx_info *frame_txctl,
  5645. struct ieee80211_cts *cts);
  5646. /**
  5647. * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame
  5648. * @hw: pointer obtained from ieee80211_alloc_hw().
  5649. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5650. * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
  5651. * @frame_txctl: &struct ieee80211_tx_info of the frame.
  5652. *
  5653. * If the CTS-to-self is generated in firmware, but the host system must provide
  5654. * the duration field, the low-level driver uses this function to receive
  5655. * the duration field value in little-endian byteorder.
  5656. *
  5657. * Return: The duration.
  5658. */
  5659. __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
  5660. struct ieee80211_vif *vif,
  5661. size_t frame_len,
  5662. const struct ieee80211_tx_info *frame_txctl);
  5663. /**
  5664. * ieee80211_generic_frame_duration - Calculate the duration field for a frame
  5665. * @hw: pointer obtained from ieee80211_alloc_hw().
  5666. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5667. * @band: the band to calculate the frame duration on
  5668. * @frame_len: the length of the frame.
  5669. * @rate: the rate at which the frame is going to be transmitted.
  5670. *
  5671. * Calculate the duration field of some generic frame, given its
  5672. * length and transmission rate (in 100kbps).
  5673. *
  5674. * Return: The duration.
  5675. */
  5676. __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
  5677. struct ieee80211_vif *vif,
  5678. enum nl80211_band band,
  5679. size_t frame_len,
  5680. struct ieee80211_rate *rate);
  5681. /**
  5682. * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
  5683. * @hw: pointer as obtained from ieee80211_alloc_hw().
  5684. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  5685. *
  5686. * Function for accessing buffered broadcast and multicast frames. If
  5687. * hardware/firmware does not implement buffering of broadcast/multicast
  5688. * frames when power saving is used, 802.11 code buffers them in the host
  5689. * memory. The low-level driver uses this function to fetch next buffered
  5690. * frame. In most cases, this is used when generating beacon frame.
  5691. *
  5692. * Return: A pointer to the next buffered skb or NULL if no more buffered
  5693. * frames are available.
  5694. *
  5695. * Note: buffered frames are returned only after DTIM beacon frame was
  5696. * generated with ieee80211_beacon_get() and the low-level driver must thus
  5697. * call ieee80211_beacon_get() first. ieee80211_get_buffered_bc() returns
  5698. * NULL if the previous generated beacon was not DTIM, so the low-level driver
  5699. * does not need to check for DTIM beacons separately and should be able to
  5700. * use common code for all beacons.
  5701. */
  5702. struct sk_buff *
  5703. ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
  5704. /**
  5705. * ieee80211_get_tkip_p1k_iv - get a TKIP phase 1 key for IV32
  5706. *
  5707. * This function returns the TKIP phase 1 key for the given IV32.
  5708. *
  5709. * @keyconf: the parameter passed with the set key
  5710. * @iv32: IV32 to get the P1K for
  5711. * @p1k: a buffer to which the key will be written, as 5 u16 values
  5712. */
  5713. void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf,
  5714. u32 iv32, u16 *p1k);
  5715. /**
  5716. * ieee80211_get_tkip_p1k - get a TKIP phase 1 key
  5717. *
  5718. * This function returns the TKIP phase 1 key for the IV32 taken
  5719. * from the given packet.
  5720. *
  5721. * @keyconf: the parameter passed with the set key
  5722. * @skb: the packet to take the IV32 value from that will be encrypted
  5723. * with this P1K
  5724. * @p1k: a buffer to which the key will be written, as 5 u16 values
  5725. */
  5726. static inline void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf,
  5727. struct sk_buff *skb, u16 *p1k)
  5728. {
  5729. struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5730. const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
  5731. u32 iv32 = get_unaligned_le32(&data[4]);
  5732. ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k);
  5733. }
  5734. /**
  5735. * ieee80211_get_tkip_rx_p1k - get a TKIP phase 1 key for RX
  5736. *
  5737. * This function returns the TKIP phase 1 key for the given IV32
  5738. * and transmitter address.
  5739. *
  5740. * @keyconf: the parameter passed with the set key
  5741. * @ta: TA that will be used with the key
  5742. * @iv32: IV32 to get the P1K for
  5743. * @p1k: a buffer to which the key will be written, as 5 u16 values
  5744. */
  5745. void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
  5746. const u8 *ta, u32 iv32, u16 *p1k);
  5747. /**
  5748. * ieee80211_get_tkip_p2k - get a TKIP phase 2 key
  5749. *
  5750. * This function computes the TKIP RC4 key for the IV values
  5751. * in the packet.
  5752. *
  5753. * @keyconf: the parameter passed with the set key
  5754. * @skb: the packet to take the IV32/IV16 values from that will be
  5755. * encrypted with this key
  5756. * @p2k: a buffer to which the key will be written, 16 bytes
  5757. */
  5758. void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
  5759. struct sk_buff *skb, u8 *p2k);
  5760. /**
  5761. * ieee80211_tkip_add_iv - write TKIP IV and Ext. IV to pos
  5762. *
  5763. * @pos: start of crypto header
  5764. * @keyconf: the parameter passed with the set key
  5765. * @pn: PN to add
  5766. *
  5767. * Returns: pointer to the octet following IVs (i.e. beginning of
  5768. * the packet payload)
  5769. *
  5770. * This function writes the tkip IV value to pos (which should
  5771. * point to the crypto header)
  5772. */
  5773. u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key_conf *keyconf, u64 pn);
  5774. /**
  5775. * ieee80211_get_key_rx_seq - get key RX sequence counter
  5776. *
  5777. * @keyconf: the parameter passed with the set key
  5778. * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  5779. * the value on TID 0 is also used for non-QoS frames. For
  5780. * CMAC, only TID 0 is valid.
  5781. * @seq: buffer to receive the sequence data
  5782. *
  5783. * This function allows a driver to retrieve the current RX IV/PNs
  5784. * for the given key. It must not be called if IV checking is done
  5785. * by the device and not by mac80211.
  5786. *
  5787. * Note that this function may only be called when no RX processing
  5788. * can be done concurrently.
  5789. */
  5790. void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
  5791. int tid, struct ieee80211_key_seq *seq);
  5792. /**
  5793. * ieee80211_set_key_rx_seq - set key RX sequence counter
  5794. *
  5795. * @keyconf: the parameter passed with the set key
  5796. * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  5797. * the value on TID 0 is also used for non-QoS frames. For
  5798. * CMAC, only TID 0 is valid.
  5799. * @seq: new sequence data
  5800. *
  5801. * This function allows a driver to set the current RX IV/PNs for the
  5802. * given key. This is useful when resuming from WoWLAN sleep and GTK
  5803. * rekey may have been done while suspended. It should not be called
  5804. * if IV checking is done by the device and not by mac80211.
  5805. *
  5806. * Note that this function may only be called when no RX processing
  5807. * can be done concurrently.
  5808. */
  5809. void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf,
  5810. int tid, struct ieee80211_key_seq *seq);
  5811. /**
  5812. * ieee80211_gtk_rekey_add - add a GTK key from rekeying during WoWLAN
  5813. * @vif: the virtual interface to add the key on
  5814. * @idx: the keyidx of the key
  5815. * @key_data: the key data
  5816. * @key_len: the key data. Might be bigger than the actual key length,
  5817. * but not smaller (for the driver convinence)
  5818. * @link_id: the link id of the key or -1 for non-MLO
  5819. *
  5820. * When GTK rekeying was done while the system was suspended, (a) new
  5821. * key(s) will be available. These will be needed by mac80211 for proper
  5822. * RX processing, so this function allows setting them.
  5823. *
  5824. * Return: the newly allocated key structure, which will have
  5825. * similar contents to the passed key configuration but point to
  5826. * mac80211-owned memory. In case of errors, the function returns an
  5827. * ERR_PTR(), use IS_ERR() etc.
  5828. *
  5829. * Note that this function assumes the key isn't added to hardware
  5830. * acceleration, so no TX will be done with the key. Since it's a GTK
  5831. * on managed (station) networks, this is true anyway. If the driver
  5832. * calls this function from the resume callback and subsequently uses
  5833. * the return code 1 to reconfigure the device, this key will be part
  5834. * of the reconfiguration.
  5835. *
  5836. * Note that the driver should also call ieee80211_set_key_rx_seq()
  5837. * for the new key for each TID to set up sequence counters properly.
  5838. *
  5839. * IMPORTANT: If this replaces a key that is present in the hardware,
  5840. * then it will attempt to remove it during this call.
  5841. */
  5842. struct ieee80211_key_conf *
  5843. ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
  5844. u8 idx, u8 *key_data, u8 key_len,
  5845. int link_id);
  5846. /**
  5847. * ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying
  5848. * @vif: virtual interface the rekeying was done on
  5849. * @bssid: The BSSID of the AP, for checking association
  5850. * @replay_ctr: the new replay counter after GTK rekeying
  5851. * @gfp: allocation flags
  5852. */
  5853. void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid,
  5854. const u8 *replay_ctr, gfp_t gfp);
  5855. /**
  5856. * ieee80211_key_mic_failure - increment MIC failure counter for the key
  5857. *
  5858. * Note: this is really only safe if no other RX function is called
  5859. * at the same time.
  5860. *
  5861. * @keyconf: the key in question
  5862. */
  5863. void ieee80211_key_mic_failure(struct ieee80211_key_conf *keyconf);
  5864. /**
  5865. * ieee80211_key_replay - increment replay counter for the key
  5866. *
  5867. * Note: this is really only safe if no other RX function is called
  5868. * at the same time.
  5869. *
  5870. * @keyconf: the key in question
  5871. */
  5872. void ieee80211_key_replay(struct ieee80211_key_conf *keyconf);
  5873. /**
  5874. * ieee80211_wake_queue - wake specific queue
  5875. * @hw: pointer as obtained from ieee80211_alloc_hw().
  5876. * @queue: queue number (counted from zero).
  5877. *
  5878. * Drivers must use this function instead of netif_wake_queue.
  5879. */
  5880. void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
  5881. /**
  5882. * ieee80211_stop_queue - stop specific queue
  5883. * @hw: pointer as obtained from ieee80211_alloc_hw().
  5884. * @queue: queue number (counted from zero).
  5885. *
  5886. * Drivers must use this function instead of netif_stop_queue.
  5887. */
  5888. void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
  5889. /**
  5890. * ieee80211_queue_stopped - test status of the queue
  5891. * @hw: pointer as obtained from ieee80211_alloc_hw().
  5892. * @queue: queue number (counted from zero).
  5893. *
  5894. * Drivers must use this function instead of netif_queue_stopped.
  5895. *
  5896. * Return: %true if the queue is stopped. %false otherwise.
  5897. */
  5898. int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue);
  5899. /**
  5900. * ieee80211_stop_queues - stop all queues
  5901. * @hw: pointer as obtained from ieee80211_alloc_hw().
  5902. *
  5903. * Drivers must use this function instead of netif_tx_stop_all_queues.
  5904. */
  5905. void ieee80211_stop_queues(struct ieee80211_hw *hw);
  5906. /**
  5907. * ieee80211_wake_queues - wake all queues
  5908. * @hw: pointer as obtained from ieee80211_alloc_hw().
  5909. *
  5910. * Drivers must use this function instead of netif_tx_wake_all_queues.
  5911. */
  5912. void ieee80211_wake_queues(struct ieee80211_hw *hw);
  5913. /**
  5914. * ieee80211_scan_completed - completed hardware scan
  5915. *
  5916. * When hardware scan offload is used (i.e. the hw_scan() callback is
  5917. * assigned) this function needs to be called by the driver to notify
  5918. * mac80211 that the scan finished. This function can be called from
  5919. * any context, including hardirq context.
  5920. *
  5921. * @hw: the hardware that finished the scan
  5922. * @info: information about the completed scan
  5923. */
  5924. void ieee80211_scan_completed(struct ieee80211_hw *hw,
  5925. struct cfg80211_scan_info *info);
  5926. /**
  5927. * ieee80211_sched_scan_results - got results from scheduled scan
  5928. *
  5929. * When a scheduled scan is running, this function needs to be called by the
  5930. * driver whenever there are new scan results available.
  5931. *
  5932. * @hw: the hardware that is performing scheduled scans
  5933. */
  5934. void ieee80211_sched_scan_results(struct ieee80211_hw *hw);
  5935. /**
  5936. * ieee80211_sched_scan_stopped - inform that the scheduled scan has stopped
  5937. *
  5938. * When a scheduled scan is running, this function can be called by
  5939. * the driver if it needs to stop the scan to perform another task.
  5940. * Usual scenarios are drivers that cannot continue the scheduled scan
  5941. * while associating, for instance.
  5942. *
  5943. * @hw: the hardware that is performing scheduled scans
  5944. */
  5945. void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
  5946. /**
  5947. * enum ieee80211_interface_iteration_flags - interface iteration flags
  5948. * @IEEE80211_IFACE_ITER_NORMAL: Iterate over all interfaces that have
  5949. * been added to the driver; However, note that during hardware
  5950. * reconfiguration (after restart_hw) it will iterate over a new
  5951. * interface and over all the existing interfaces even if they
  5952. * haven't been re-added to the driver yet.
  5953. * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all
  5954. * interfaces, even if they haven't been re-added to the driver yet.
  5955. * @IEEE80211_IFACE_ITER_ACTIVE: Iterate only active interfaces (netdev is up).
  5956. * @IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER: Skip any interfaces where SDATA
  5957. * is not in the driver. This may fix crashes during firmware recovery
  5958. * for instance.
  5959. */
  5960. enum ieee80211_interface_iteration_flags {
  5961. IEEE80211_IFACE_ITER_NORMAL = 0,
  5962. IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0),
  5963. IEEE80211_IFACE_ITER_ACTIVE = BIT(1),
  5964. IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2),
  5965. };
  5966. /**
  5967. * ieee80211_iterate_interfaces - iterate interfaces
  5968. *
  5969. * This function iterates over the interfaces associated with a given
  5970. * hardware and calls the callback for them. This includes active as well as
  5971. * inactive interfaces. This function allows the iterator function to sleep.
  5972. * Will iterate over a new interface during add_interface().
  5973. *
  5974. * @hw: the hardware struct of which the interfaces should be iterated over
  5975. * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
  5976. * @iterator: the iterator function to call
  5977. * @data: first argument of the iterator function
  5978. */
  5979. void ieee80211_iterate_interfaces(struct ieee80211_hw *hw, u32 iter_flags,
  5980. void (*iterator)(void *data, u8 *mac,
  5981. struct ieee80211_vif *vif),
  5982. void *data);
  5983. /**
  5984. * ieee80211_iterate_active_interfaces - iterate active interfaces
  5985. *
  5986. * This function iterates over the interfaces associated with a given
  5987. * hardware that are currently active and calls the callback for them.
  5988. * This function allows the iterator function to sleep, when the iterator
  5989. * function is atomic @ieee80211_iterate_active_interfaces_atomic can
  5990. * be used.
  5991. * Does not iterate over a new interface during add_interface().
  5992. *
  5993. * @hw: the hardware struct of which the interfaces should be iterated over
  5994. * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
  5995. * @iterator: the iterator function to call
  5996. * @data: first argument of the iterator function
  5997. */
  5998. static inline void
  5999. ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, u32 iter_flags,
  6000. void (*iterator)(void *data, u8 *mac,
  6001. struct ieee80211_vif *vif),
  6002. void *data)
  6003. {
  6004. ieee80211_iterate_interfaces(hw,
  6005. iter_flags | IEEE80211_IFACE_ITER_ACTIVE,
  6006. iterator, data);
  6007. }
  6008. /**
  6009. * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces
  6010. *
  6011. * This function iterates over the interfaces associated with a given
  6012. * hardware that are currently active and calls the callback for them.
  6013. * This function requires the iterator callback function to be atomic,
  6014. * if that is not desired, use @ieee80211_iterate_active_interfaces instead.
  6015. * Does not iterate over a new interface during add_interface().
  6016. *
  6017. * @hw: the hardware struct of which the interfaces should be iterated over
  6018. * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
  6019. * @iterator: the iterator function to call, cannot sleep
  6020. * @data: first argument of the iterator function
  6021. */
  6022. void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
  6023. u32 iter_flags,
  6024. void (*iterator)(void *data,
  6025. u8 *mac,
  6026. struct ieee80211_vif *vif),
  6027. void *data);
  6028. struct ieee80211_vif *
  6029. __ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
  6030. struct ieee80211_vif *prev,
  6031. u32 iter_flags);
  6032. /**
  6033. * for_each_interface - iterate interfaces under wiphy mutex
  6034. * @vif: the iterator variable
  6035. * @hw: the HW to iterate for
  6036. * @flags: the iteration flags, see &enum ieee80211_interface_iteration_flags
  6037. */
  6038. #define for_each_interface(vif, hw, flags) \
  6039. for (vif = __ieee80211_iterate_interfaces(hw, NULL, flags); \
  6040. vif; \
  6041. vif = __ieee80211_iterate_interfaces(hw, vif, flags))
  6042. /**
  6043. * for_each_active_interface - iterate active interfaces under wiphy mutex
  6044. * @vif: the iterator variable
  6045. * @hw: the HW to iterate for
  6046. */
  6047. #define for_each_active_interface(vif, hw) \
  6048. for_each_interface(vif, hw, IEEE80211_IFACE_ITER_ACTIVE)
  6049. /**
  6050. * ieee80211_iterate_active_interfaces_mtx - iterate active interfaces
  6051. *
  6052. * This function iterates over the interfaces associated with a given
  6053. * hardware that are currently active and calls the callback for them.
  6054. * This version can only be used while holding the wiphy mutex.
  6055. *
  6056. * @hw: the hardware struct of which the interfaces should be iterated over
  6057. * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
  6058. * @iterator: the iterator function to call, cannot sleep
  6059. * @data: first argument of the iterator function
  6060. */
  6061. static inline void
  6062. ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,
  6063. u32 iter_flags,
  6064. void (*iterator)(void *data, u8 *mac,
  6065. struct ieee80211_vif *vif),
  6066. void *data)
  6067. {
  6068. struct ieee80211_vif *vif;
  6069. for_each_interface(vif, hw, iter_flags | IEEE80211_IFACE_ITER_ACTIVE)
  6070. iterator(data, vif->addr, vif);
  6071. }
  6072. /**
  6073. * ieee80211_iterate_stations_atomic - iterate stations
  6074. *
  6075. * This function iterates over all stations associated with a given
  6076. * hardware that are currently uploaded to the driver and calls the callback
  6077. * function for them.
  6078. * This function requires the iterator callback function to be atomic,
  6079. *
  6080. * @hw: the hardware struct of which the interfaces should be iterated over
  6081. * @iterator: the iterator function to call, cannot sleep
  6082. * @data: first argument of the iterator function
  6083. */
  6084. void ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
  6085. void (*iterator)(void *data,
  6086. struct ieee80211_sta *sta),
  6087. void *data);
  6088. struct ieee80211_sta *
  6089. __ieee80211_iterate_stations(struct ieee80211_hw *hw,
  6090. struct ieee80211_sta *prev);
  6091. /**
  6092. * for_each_station - iterate stations under wiphy mutex
  6093. * @sta: the iterator variable
  6094. * @hw: the HW to iterate for
  6095. */
  6096. #define for_each_station(sta, hw) \
  6097. for (sta = __ieee80211_iterate_stations(hw, NULL); \
  6098. sta; \
  6099. sta = __ieee80211_iterate_stations(hw, sta))
  6100. /**
  6101. * ieee80211_iterate_stations_mtx - iterate stations
  6102. *
  6103. * This function iterates over all stations associated with a given
  6104. * hardware that are currently uploaded to the driver and calls the callback
  6105. * function for them. This version can only be used while holding the wiphy
  6106. * mutex.
  6107. *
  6108. * @hw: the hardware struct of which the interfaces should be iterated over
  6109. * @iterator: the iterator function to call
  6110. * @data: first argument of the iterator function
  6111. */
  6112. static inline void
  6113. ieee80211_iterate_stations_mtx(struct ieee80211_hw *hw,
  6114. void (*iterator)(void *data,
  6115. struct ieee80211_sta *sta),
  6116. void *data)
  6117. {
  6118. struct ieee80211_sta *sta;
  6119. for_each_station(sta, hw)
  6120. iterator(data, sta);
  6121. }
  6122. /**
  6123. * ieee80211_queue_work - add work onto the mac80211 workqueue
  6124. *
  6125. * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
  6126. * This helper ensures drivers are not queueing work when they should not be.
  6127. *
  6128. * @hw: the hardware struct for the interface we are adding work for
  6129. * @work: the work we want to add onto the mac80211 workqueue
  6130. */
  6131. void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
  6132. /**
  6133. * ieee80211_queue_delayed_work - add work onto the mac80211 workqueue
  6134. *
  6135. * Drivers and mac80211 use this to queue delayed work onto the mac80211
  6136. * workqueue.
  6137. *
  6138. * @hw: the hardware struct for the interface we are adding work for
  6139. * @dwork: delayable work to queue onto the mac80211 workqueue
  6140. * @delay: number of jiffies to wait before queueing
  6141. */
  6142. void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
  6143. struct delayed_work *dwork,
  6144. unsigned long delay);
  6145. /**
  6146. * ieee80211_refresh_tx_agg_session_timer - Refresh a tx agg session timer.
  6147. * @sta: the station for which to start a BA session
  6148. * @tid: the TID to BA on.
  6149. *
  6150. * This function allows low level driver to refresh tx agg session timer
  6151. * to maintain BA session, the session level will still be managed by the
  6152. * mac80211.
  6153. *
  6154. * Note: must be called in an RCU critical section.
  6155. */
  6156. void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,
  6157. u16 tid);
  6158. /**
  6159. * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
  6160. * @sta: the station for which to start a BA session
  6161. * @tid: the TID to BA on.
  6162. * @timeout: session timeout value (in TUs)
  6163. *
  6164. * Return: success if addBA request was sent, failure otherwise
  6165. *
  6166. * Although mac80211/low level driver/user space application can estimate
  6167. * the need to start aggregation on a certain RA/TID, the session level
  6168. * will be managed by the mac80211.
  6169. */
  6170. int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
  6171. u16 timeout);
  6172. /**
  6173. * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
  6174. * @vif: &struct ieee80211_vif pointer from the add_interface callback
  6175. * @ra: receiver address of the BA session recipient.
  6176. * @tid: the TID to BA on.
  6177. *
  6178. * This function must be called by low level driver once it has
  6179. * finished with preparations for the BA session. It can be called
  6180. * from any context.
  6181. */
  6182. void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
  6183. u16 tid);
  6184. /**
  6185. * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
  6186. * @sta: the station whose BA session to stop
  6187. * @tid: the TID to stop BA.
  6188. *
  6189. * Return: negative error if the TID is invalid, or no aggregation active
  6190. *
  6191. * Although mac80211/low level driver/user space application can estimate
  6192. * the need to stop aggregation on a certain RA/TID, the session level
  6193. * will be managed by the mac80211.
  6194. */
  6195. int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
  6196. /**
  6197. * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
  6198. * @vif: &struct ieee80211_vif pointer from the add_interface callback
  6199. * @ra: receiver address of the BA session recipient.
  6200. * @tid: the desired TID to BA on.
  6201. *
  6202. * This function must be called by low level driver once it has
  6203. * finished with preparations for the BA session tear down. It
  6204. * can be called from any context.
  6205. */
  6206. void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
  6207. u16 tid);
  6208. /**
  6209. * ieee80211_find_sta - find a station
  6210. *
  6211. * @vif: virtual interface to look for station on
  6212. * @addr: station's address
  6213. *
  6214. * Return: The station, if found. %NULL otherwise.
  6215. *
  6216. * Note: This function must be called under RCU lock and the
  6217. * resulting pointer is only valid under RCU lock as well.
  6218. */
  6219. struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
  6220. const u8 *addr);
  6221. /**
  6222. * ieee80211_find_sta_by_ifaddr - find a station on hardware
  6223. *
  6224. * @hw: pointer as obtained from ieee80211_alloc_hw()
  6225. * @addr: remote station's address
  6226. * @localaddr: local address (vif->sdata->vif.addr). Use NULL for 'any'.
  6227. *
  6228. * Return: The station, if found. %NULL otherwise.
  6229. *
  6230. * Note: This function must be called under RCU lock and the
  6231. * resulting pointer is only valid under RCU lock as well.
  6232. *
  6233. * NOTE: You may pass NULL for localaddr, but then you will just get
  6234. * the first STA that matches the remote address 'addr'.
  6235. * We can have multiple STA associated with multiple
  6236. * logical stations (e.g. consider a station connecting to another
  6237. * BSSID on the same AP hardware without disconnecting first).
  6238. * In this case, the result of this method with localaddr NULL
  6239. * is not reliable.
  6240. *
  6241. * DO NOT USE THIS FUNCTION with localaddr NULL if at all possible.
  6242. */
  6243. struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw,
  6244. const u8 *addr,
  6245. const u8 *localaddr);
  6246. /**
  6247. * ieee80211_find_sta_by_link_addrs - find STA by link addresses
  6248. * @hw: pointer as obtained from ieee80211_alloc_hw()
  6249. * @addr: remote station's link address
  6250. * @localaddr: local link address, use %NULL for any (but avoid that)
  6251. * @link_id: pointer to obtain the link ID if the STA is found,
  6252. * may be %NULL if the link ID is not needed
  6253. *
  6254. * Obtain the STA by link address, must use RCU protection.
  6255. *
  6256. * Return: pointer to STA if found, otherwise %NULL.
  6257. */
  6258. struct ieee80211_sta *
  6259. ieee80211_find_sta_by_link_addrs(struct ieee80211_hw *hw,
  6260. const u8 *addr,
  6261. const u8 *localaddr,
  6262. unsigned int *link_id);
  6263. /**
  6264. * ieee80211_sta_block_awake - block station from waking up
  6265. * @hw: the hardware
  6266. * @pubsta: the station
  6267. * @block: whether to block or unblock
  6268. *
  6269. * Some devices require that all frames that are on the queues
  6270. * for a specific station that went to sleep are flushed before
  6271. * a poll response or frames after the station woke up can be
  6272. * delivered to that it. Note that such frames must be rejected
  6273. * by the driver as filtered, with the appropriate status flag.
  6274. *
  6275. * This function allows implementing this mode in a race-free
  6276. * manner.
  6277. *
  6278. * To do this, a driver must keep track of the number of frames
  6279. * still enqueued for a specific station. If this number is not
  6280. * zero when the station goes to sleep, the driver must call
  6281. * this function to force mac80211 to consider the station to
  6282. * be asleep regardless of the station's actual state. Once the
  6283. * number of outstanding frames reaches zero, the driver must
  6284. * call this function again to unblock the station. That will
  6285. * cause mac80211 to be able to send ps-poll responses, and if
  6286. * the station queried in the meantime then frames will also
  6287. * be sent out as a result of this. Additionally, the driver
  6288. * will be notified that the station woke up some time after
  6289. * it is unblocked, regardless of whether the station actually
  6290. * woke up while blocked or not.
  6291. */
  6292. void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
  6293. struct ieee80211_sta *pubsta, bool block);
  6294. /**
  6295. * ieee80211_sta_eosp - notify mac80211 about end of SP
  6296. * @pubsta: the station
  6297. *
  6298. * When a device transmits frames in a way that it can't tell
  6299. * mac80211 in the TX status about the EOSP, it must clear the
  6300. * %IEEE80211_TX_STATUS_EOSP bit and call this function instead.
  6301. * This applies for PS-Poll as well as uAPSD.
  6302. *
  6303. * Note that just like with _tx_status() and _rx() drivers must
  6304. * not mix calls to irqsafe/non-irqsafe versions, this function
  6305. * must not be mixed with those either. Use the all irqsafe, or
  6306. * all non-irqsafe, don't mix!
  6307. *
  6308. * NB: the _irqsafe version of this function doesn't exist, no
  6309. * driver needs it right now. Don't call this function if
  6310. * you'd need the _irqsafe version, look at the git history
  6311. * and restore the _irqsafe version!
  6312. */
  6313. void ieee80211_sta_eosp(struct ieee80211_sta *pubsta);
  6314. /**
  6315. * ieee80211_send_eosp_nullfunc - ask mac80211 to send NDP with EOSP
  6316. * @pubsta: the station
  6317. * @tid: the tid of the NDP
  6318. *
  6319. * Sometimes the device understands that it needs to close
  6320. * the Service Period unexpectedly. This can happen when
  6321. * sending frames that are filling holes in the BA window.
  6322. * In this case, the device can ask mac80211 to send a
  6323. * Nullfunc frame with EOSP set. When that happens, the
  6324. * driver must have called ieee80211_sta_set_buffered() to
  6325. * let mac80211 know that there are no buffered frames any
  6326. * more, otherwise mac80211 will get the more_data bit wrong.
  6327. * The low level driver must have made sure that the frame
  6328. * will be sent despite the station being in power-save.
  6329. * Mac80211 won't call allow_buffered_frames().
  6330. * Note that calling this function, doesn't exempt the driver
  6331. * from closing the EOSP properly, it will still have to call
  6332. * ieee80211_sta_eosp when the NDP is sent.
  6333. */
  6334. void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);
  6335. /**
  6336. * ieee80211_sta_recalc_aggregates - recalculate aggregate data after a change
  6337. * @pubsta: the station
  6338. *
  6339. * Call this function after changing a per-link aggregate data as referenced in
  6340. * &struct ieee80211_sta_aggregates by accessing the agg field of
  6341. * &struct ieee80211_link_sta.
  6342. *
  6343. * With non MLO the data in deflink will be referenced directly. In that case
  6344. * there is no need to call this function.
  6345. */
  6346. void ieee80211_sta_recalc_aggregates(struct ieee80211_sta *pubsta);
  6347. /**
  6348. * ieee80211_sta_register_airtime - register airtime usage for a sta/tid
  6349. *
  6350. * Register airtime usage for a given sta on a given tid. The driver must call
  6351. * this function to notify mac80211 that a station used a certain amount of
  6352. * airtime. This information will be used by the TXQ scheduler to schedule
  6353. * stations in a way that ensures airtime fairness.
  6354. *
  6355. * The reported airtime should as a minimum include all time that is spent
  6356. * transmitting to the remote station, including overhead and padding, but not
  6357. * including time spent waiting for a TXOP. If the time is not reported by the
  6358. * hardware it can in some cases be calculated from the rate and known frame
  6359. * composition. When possible, the time should include any failed transmission
  6360. * attempts.
  6361. *
  6362. * The driver can either call this function synchronously for every packet or
  6363. * aggregate, or asynchronously as airtime usage information becomes available.
  6364. * TX and RX airtime can be reported together, or separately by setting one of
  6365. * them to 0.
  6366. *
  6367. * @pubsta: the station
  6368. * @tid: the TID to register airtime for
  6369. * @tx_airtime: airtime used during TX (in usec)
  6370. * @rx_airtime: airtime used during RX (in usec)
  6371. */
  6372. void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
  6373. u32 tx_airtime, u32 rx_airtime);
  6374. /**
  6375. * ieee80211_txq_airtime_check - check if a txq can send frame to device
  6376. *
  6377. * @hw: pointer obtained from ieee80211_alloc_hw()
  6378. * @txq: pointer obtained from station or virtual interface
  6379. *
  6380. * Return: %true if the AQL's airtime limit has not been reached and the txq can
  6381. * continue to send more packets to the device. Otherwise return %false.
  6382. */
  6383. bool
  6384. ieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
  6385. /**
  6386. * ieee80211_iter_keys - iterate keys programmed into the device
  6387. * @hw: pointer obtained from ieee80211_alloc_hw()
  6388. * @vif: virtual interface to iterate, may be %NULL for all
  6389. * @iter: iterator function that will be called for each key
  6390. * @iter_data: custom data to pass to the iterator function
  6391. *
  6392. * Context: Must be called with wiphy mutex held; can sleep.
  6393. *
  6394. * This function can be used to iterate all the keys known to
  6395. * mac80211, even those that weren't previously programmed into
  6396. * the device. This is intended for use in WoWLAN if the device
  6397. * needs reprogramming of the keys during suspend.
  6398. *
  6399. * The order in which the keys are iterated matches the order
  6400. * in which they were originally installed and handed to the
  6401. * set_key callback.
  6402. */
  6403. void ieee80211_iter_keys(struct ieee80211_hw *hw,
  6404. struct ieee80211_vif *vif,
  6405. void (*iter)(struct ieee80211_hw *hw,
  6406. struct ieee80211_vif *vif,
  6407. struct ieee80211_sta *sta,
  6408. struct ieee80211_key_conf *key,
  6409. void *data),
  6410. void *iter_data);
  6411. /**
  6412. * ieee80211_iter_keys_rcu - iterate keys programmed into the device
  6413. * @hw: pointer obtained from ieee80211_alloc_hw()
  6414. * @vif: virtual interface to iterate, may be %NULL for all
  6415. * @iter: iterator function that will be called for each key
  6416. * @iter_data: custom data to pass to the iterator function
  6417. *
  6418. * This function can be used to iterate all the keys known to
  6419. * mac80211, even those that weren't previously programmed into
  6420. * the device. Note that due to locking reasons, keys of station
  6421. * in removal process will be skipped.
  6422. *
  6423. * This function requires being called in an RCU critical section,
  6424. * and thus iter must be atomic.
  6425. */
  6426. void ieee80211_iter_keys_rcu(struct ieee80211_hw *hw,
  6427. struct ieee80211_vif *vif,
  6428. void (*iter)(struct ieee80211_hw *hw,
  6429. struct ieee80211_vif *vif,
  6430. struct ieee80211_sta *sta,
  6431. struct ieee80211_key_conf *key,
  6432. void *data),
  6433. void *iter_data);
  6434. /**
  6435. * ieee80211_iter_chan_contexts_atomic - iterate channel contexts
  6436. * @hw: pointer obtained from ieee80211_alloc_hw().
  6437. * @iter: iterator function
  6438. * @iter_data: data passed to iterator function
  6439. *
  6440. * Iterate all active channel contexts. This function is atomic and
  6441. * doesn't acquire any locks internally that might be held in other
  6442. * places while calling into the driver.
  6443. *
  6444. * The iterator will not find a context that's being added (during
  6445. * the driver callback to add it) but will find it while it's being
  6446. * removed.
  6447. *
  6448. * Note that during hardware restart, all contexts that existed
  6449. * before the restart are considered already present so will be
  6450. * found while iterating, whether they've been re-added already
  6451. * or not.
  6452. */
  6453. void ieee80211_iter_chan_contexts_atomic(
  6454. struct ieee80211_hw *hw,
  6455. void (*iter)(struct ieee80211_hw *hw,
  6456. struct ieee80211_chanctx_conf *chanctx_conf,
  6457. void *data),
  6458. void *iter_data);
  6459. /**
  6460. * ieee80211_iter_chan_contexts_mtx - iterate channel contexts
  6461. * @hw: pointer obtained from ieee80211_alloc_hw().
  6462. * @iter: iterator function
  6463. * @iter_data: data passed to iterator function
  6464. *
  6465. * Iterate all active channel contexts. This function can only be used while
  6466. * holding the wiphy mutex.
  6467. *
  6468. * The iterator will not find a context that's being added (during
  6469. * the driver callback to add it) but will find it while it's being
  6470. * removed.
  6471. *
  6472. * Note that during hardware restart, all contexts that existed
  6473. * before the restart are considered already present so will be
  6474. * found while iterating, whether they've been re-added already
  6475. * or not.
  6476. */
  6477. void ieee80211_iter_chan_contexts_mtx(
  6478. struct ieee80211_hw *hw,
  6479. void (*iter)(struct ieee80211_hw *hw,
  6480. struct ieee80211_chanctx_conf *chanctx_conf,
  6481. void *data),
  6482. void *iter_data);
  6483. /**
  6484. * ieee80211_ap_probereq_get - retrieve a Probe Request template
  6485. * @hw: pointer obtained from ieee80211_alloc_hw().
  6486. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6487. *
  6488. * Creates a Probe Request template which can, for example, be uploaded to
  6489. * hardware. The template is filled with bssid, ssid and supported rate
  6490. * information. This function must only be called from within the
  6491. * .bss_info_changed callback function and only in managed mode. The function
  6492. * is only useful when the interface is associated, otherwise it will return
  6493. * %NULL.
  6494. *
  6495. * Return: The Probe Request template. %NULL on error.
  6496. */
  6497. struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
  6498. struct ieee80211_vif *vif);
  6499. /**
  6500. * ieee80211_beacon_loss - inform hardware does not receive beacons
  6501. *
  6502. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6503. *
  6504. * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and
  6505. * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
  6506. * hardware is not receiving beacons with this function.
  6507. */
  6508. void ieee80211_beacon_loss(struct ieee80211_vif *vif);
  6509. /**
  6510. * ieee80211_connection_loss - inform hardware has lost connection to the AP
  6511. *
  6512. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6513. *
  6514. * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and
  6515. * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
  6516. * needs to inform if the connection to the AP has been lost.
  6517. * The function may also be called if the connection needs to be terminated
  6518. * for some other reason, even if %IEEE80211_HW_CONNECTION_MONITOR isn't set.
  6519. *
  6520. * This function will cause immediate change to disassociated state,
  6521. * without connection recovery attempts.
  6522. */
  6523. void ieee80211_connection_loss(struct ieee80211_vif *vif);
  6524. /**
  6525. * ieee80211_disconnect - request disconnection
  6526. *
  6527. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6528. * @reconnect: immediate reconnect is desired
  6529. *
  6530. * Request disconnection from the current network and, if enabled, send a
  6531. * hint to the higher layers that immediate reconnect is desired.
  6532. */
  6533. void ieee80211_disconnect(struct ieee80211_vif *vif, bool reconnect);
  6534. /**
  6535. * ieee80211_resume_disconnect - disconnect from AP after resume
  6536. *
  6537. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6538. *
  6539. * Instructs mac80211 to disconnect from the AP after resume.
  6540. * Drivers can use this after WoWLAN if they know that the
  6541. * connection cannot be kept up, for example because keys were
  6542. * used while the device was asleep but the replay counters or
  6543. * similar cannot be retrieved from the device during resume.
  6544. *
  6545. * Note that due to implementation issues, if the driver uses
  6546. * the reconfiguration functionality during resume the interface
  6547. * will still be added as associated first during resume and then
  6548. * disconnect normally later.
  6549. *
  6550. * This function can only be called from the resume callback and
  6551. * the driver must not be holding any of its own locks while it
  6552. * calls this function, or at least not any locks it needs in the
  6553. * key configuration paths (if it supports HW crypto).
  6554. */
  6555. void ieee80211_resume_disconnect(struct ieee80211_vif *vif);
  6556. /**
  6557. * ieee80211_hw_restart_disconnect - disconnect from AP after
  6558. * hardware restart
  6559. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6560. *
  6561. * Instructs mac80211 to disconnect from the AP after
  6562. * hardware restart.
  6563. */
  6564. void ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif);
  6565. /**
  6566. * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
  6567. * rssi threshold triggered
  6568. *
  6569. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6570. * @rssi_event: the RSSI trigger event type
  6571. * @rssi_level: new RSSI level value or 0 if not available
  6572. * @gfp: context flags
  6573. *
  6574. * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality
  6575. * monitoring is configured with an rssi threshold, the driver will inform
  6576. * whenever the rssi level reaches the threshold.
  6577. */
  6578. void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
  6579. enum nl80211_cqm_rssi_threshold_event rssi_event,
  6580. s32 rssi_level,
  6581. gfp_t gfp);
  6582. /**
  6583. * ieee80211_cqm_beacon_loss_notify - inform CQM of beacon loss
  6584. *
  6585. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6586. * @gfp: context flags
  6587. */
  6588. void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp);
  6589. /**
  6590. * ieee80211_radar_detected - inform that a radar was detected
  6591. *
  6592. * @hw: pointer as obtained from ieee80211_alloc_hw()
  6593. * @chanctx_conf: Channel context on which radar is detected. Mandatory to
  6594. * pass a valid pointer during MLO. For non-MLO %NULL can be passed
  6595. */
  6596. void ieee80211_radar_detected(struct ieee80211_hw *hw,
  6597. struct ieee80211_chanctx_conf *chanctx_conf);
  6598. /**
  6599. * ieee80211_chswitch_done - Complete channel switch process
  6600. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6601. * @success: make the channel switch successful or not
  6602. * @link_id: the link_id on which the switch was done. Ignored if success is
  6603. * false.
  6604. *
  6605. * Complete the channel switch post-process: set the new operational channel
  6606. * and wake up the suspended queues.
  6607. */
  6608. void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success,
  6609. unsigned int link_id);
  6610. /**
  6611. * ieee80211_channel_switch_disconnect - disconnect due to channel switch error
  6612. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6613. *
  6614. * Instruct mac80211 to disconnect due to a channel switch error. The channel
  6615. * switch can request to block the tx and so, we need to make sure we do not send
  6616. * a deauth frame in this case.
  6617. */
  6618. void ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif);
  6619. /**
  6620. * ieee80211_request_smps - request SM PS transition
  6621. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6622. * @link_id: link ID for MLO, or 0
  6623. * @smps_mode: new SM PS mode
  6624. *
  6625. * This allows the driver to request an SM PS transition in managed
  6626. * mode. This is useful when the driver has more information than
  6627. * the stack about possible interference, for example by bluetooth.
  6628. */
  6629. void ieee80211_request_smps(struct ieee80211_vif *vif, unsigned int link_id,
  6630. enum ieee80211_smps_mode smps_mode);
  6631. /**
  6632. * ieee80211_ready_on_channel - notification of remain-on-channel start
  6633. * @hw: pointer as obtained from ieee80211_alloc_hw()
  6634. */
  6635. void ieee80211_ready_on_channel(struct ieee80211_hw *hw);
  6636. /**
  6637. * ieee80211_remain_on_channel_expired - remain_on_channel duration expired
  6638. * @hw: pointer as obtained from ieee80211_alloc_hw()
  6639. */
  6640. void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw);
  6641. /**
  6642. * ieee80211_stop_rx_ba_session - callback to stop existing BA sessions
  6643. *
  6644. * in order not to harm the system performance and user experience, the device
  6645. * may request not to allow any rx ba session and tear down existing rx ba
  6646. * sessions based on system constraints such as periodic BT activity that needs
  6647. * to limit wlan activity (eg.sco or a2dp)."
  6648. * in such cases, the intention is to limit the duration of the rx ppdu and
  6649. * therefore prevent the peer device to use a-mpdu aggregation.
  6650. *
  6651. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6652. * @ba_rx_bitmap: Bit map of open rx ba per tid
  6653. * @addr: & to bssid mac address
  6654. */
  6655. void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
  6656. const u8 *addr);
  6657. /**
  6658. * ieee80211_mark_rx_ba_filtered_frames - move RX BA window and mark filtered
  6659. * @pubsta: station struct
  6660. * @tid: the session's TID
  6661. * @ssn: starting sequence number of the bitmap, all frames before this are
  6662. * assumed to be out of the window after the call
  6663. * @filtered: bitmap of filtered frames, BIT(0) is the @ssn entry etc.
  6664. * @received_mpdus: number of received mpdus in firmware
  6665. *
  6666. * This function moves the BA window and releases all frames before @ssn, and
  6667. * marks frames marked in the bitmap as having been filtered. Afterwards, it
  6668. * checks if any frames in the window starting from @ssn can now be released
  6669. * (in case they were only waiting for frames that were filtered.)
  6670. * (Only work correctly if @max_rx_aggregation_subframes <= 64 frames)
  6671. */
  6672. void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,
  6673. u16 ssn, u64 filtered,
  6674. u16 received_mpdus);
  6675. /**
  6676. * ieee80211_send_bar - send a BlockAckReq frame
  6677. *
  6678. * can be used to flush pending frames from the peer's aggregation reorder
  6679. * buffer.
  6680. *
  6681. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6682. * @ra: the peer's destination address
  6683. * @tid: the TID of the aggregation session
  6684. * @ssn: the new starting sequence number for the receiver
  6685. */
  6686. void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
  6687. /**
  6688. * ieee80211_manage_rx_ba_offl - helper to queue an RX BA work
  6689. * @vif: &struct ieee80211_vif pointer from the add_interface callback
  6690. * @addr: station mac address
  6691. * @tid: the rx tid
  6692. */
  6693. void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif, const u8 *addr,
  6694. unsigned int tid);
  6695. /**
  6696. * ieee80211_start_rx_ba_session_offl - start a Rx BA session
  6697. *
  6698. * Some device drivers may offload part of the Rx aggregation flow including
  6699. * AddBa/DelBa negotiation but may otherwise be incapable of full Rx
  6700. * reordering.
  6701. *
  6702. * Create structures responsible for reordering so device drivers may call here
  6703. * when they complete AddBa negotiation.
  6704. *
  6705. * @vif: &struct ieee80211_vif pointer from the add_interface callback
  6706. * @addr: station mac address
  6707. * @tid: the rx tid
  6708. */
  6709. static inline void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif,
  6710. const u8 *addr, u16 tid)
  6711. {
  6712. if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
  6713. return;
  6714. ieee80211_manage_rx_ba_offl(vif, addr, tid);
  6715. }
  6716. /**
  6717. * ieee80211_stop_rx_ba_session_offl - stop a Rx BA session
  6718. *
  6719. * Some device drivers may offload part of the Rx aggregation flow including
  6720. * AddBa/DelBa negotiation but may otherwise be incapable of full Rx
  6721. * reordering.
  6722. *
  6723. * Destroy structures responsible for reordering so device drivers may call here
  6724. * when they complete DelBa negotiation.
  6725. *
  6726. * @vif: &struct ieee80211_vif pointer from the add_interface callback
  6727. * @addr: station mac address
  6728. * @tid: the rx tid
  6729. */
  6730. static inline void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif,
  6731. const u8 *addr, u16 tid)
  6732. {
  6733. if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
  6734. return;
  6735. ieee80211_manage_rx_ba_offl(vif, addr, tid + IEEE80211_NUM_TIDS);
  6736. }
  6737. /**
  6738. * ieee80211_rx_ba_timer_expired - stop a Rx BA session due to timeout
  6739. *
  6740. * Some device drivers do not offload AddBa/DelBa negotiation, but handle rx
  6741. * buffer reording internally, and therefore also handle the session timer.
  6742. *
  6743. * Trigger the timeout flow, which sends a DelBa.
  6744. *
  6745. * @vif: &struct ieee80211_vif pointer from the add_interface callback
  6746. * @addr: station mac address
  6747. * @tid: the rx tid
  6748. */
  6749. void ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif,
  6750. const u8 *addr, unsigned int tid);
  6751. /* Rate control API */
  6752. /**
  6753. * struct ieee80211_tx_rate_control - rate control information for/from RC algo
  6754. *
  6755. * @hw: The hardware the algorithm is invoked for.
  6756. * @sband: The band this frame is being transmitted on.
  6757. * @bss_conf: the current BSS configuration
  6758. * @skb: the skb that will be transmitted, the control information in it needs
  6759. * to be filled in
  6760. * @reported_rate: The rate control algorithm can fill this in to indicate
  6761. * which rate should be reported to userspace as the current rate and
  6762. * used for rate calculations in the mesh network.
  6763. * @rts: whether RTS will be used for this frame because it is longer than the
  6764. * RTS threshold
  6765. * @short_preamble: whether mac80211 will request short-preamble transmission
  6766. * if the selected rate supports it
  6767. * @rate_idx_mask: user-requested (legacy) rate mask
  6768. * @rate_idx_mcs_mask: user-requested MCS rate mask (NULL if not in use)
  6769. * @bss: whether this frame is sent out in AP or IBSS mode
  6770. */
  6771. struct ieee80211_tx_rate_control {
  6772. struct ieee80211_hw *hw;
  6773. struct ieee80211_supported_band *sband;
  6774. struct ieee80211_bss_conf *bss_conf;
  6775. struct sk_buff *skb;
  6776. struct ieee80211_tx_rate reported_rate;
  6777. bool rts, short_preamble;
  6778. u32 rate_idx_mask;
  6779. u8 *rate_idx_mcs_mask;
  6780. bool bss;
  6781. };
  6782. /**
  6783. * enum rate_control_capabilities - rate control capabilities
  6784. */
  6785. enum rate_control_capabilities {
  6786. /**
  6787. * @RATE_CTRL_CAPA_VHT_EXT_NSS_BW:
  6788. * Support for extended NSS BW support (dot11VHTExtendedNSSCapable)
  6789. * Note that this is only looked at if the minimum number of chains
  6790. * that the AP uses is < the number of TX chains the hardware has,
  6791. * otherwise the NSS difference doesn't bother us.
  6792. */
  6793. RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0),
  6794. /**
  6795. * @RATE_CTRL_CAPA_AMPDU_TRIGGER:
  6796. * mac80211 should start A-MPDU sessions on tx
  6797. */
  6798. RATE_CTRL_CAPA_AMPDU_TRIGGER = BIT(1),
  6799. };
  6800. struct rate_control_ops {
  6801. unsigned long capa;
  6802. const char *name;
  6803. void *(*alloc)(struct ieee80211_hw *hw);
  6804. void (*add_debugfs)(struct ieee80211_hw *hw, void *priv,
  6805. struct dentry *debugfsdir);
  6806. void (*free)(void *priv);
  6807. void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
  6808. void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
  6809. struct cfg80211_chan_def *chandef,
  6810. struct ieee80211_sta *sta, void *priv_sta);
  6811. void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
  6812. struct cfg80211_chan_def *chandef,
  6813. struct ieee80211_sta *sta, void *priv_sta,
  6814. u32 changed);
  6815. void (*free_sta)(void *priv, struct ieee80211_sta *sta,
  6816. void *priv_sta);
  6817. void (*tx_status_ext)(void *priv,
  6818. struct ieee80211_supported_band *sband,
  6819. void *priv_sta, struct ieee80211_tx_status *st);
  6820. void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
  6821. struct ieee80211_sta *sta, void *priv_sta,
  6822. struct sk_buff *skb);
  6823. void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta,
  6824. struct ieee80211_tx_rate_control *txrc);
  6825. void (*add_sta_debugfs)(void *priv, void *priv_sta,
  6826. struct dentry *dir);
  6827. u32 (*get_expected_throughput)(void *priv_sta);
  6828. };
  6829. static inline int rate_supported(struct ieee80211_sta *sta,
  6830. enum nl80211_band band,
  6831. int index)
  6832. {
  6833. return (sta == NULL || sta->deflink.supp_rates[band] & BIT(index));
  6834. }
  6835. static inline s8
  6836. rate_lowest_index(struct ieee80211_supported_band *sband,
  6837. struct ieee80211_sta *sta)
  6838. {
  6839. int i;
  6840. for (i = 0; i < sband->n_bitrates; i++)
  6841. if (rate_supported(sta, sband->band, i))
  6842. return i;
  6843. /* warn when we cannot find a rate. */
  6844. WARN_ON_ONCE(1);
  6845. /* and return 0 (the lowest index) */
  6846. return 0;
  6847. }
  6848. static inline
  6849. bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
  6850. struct ieee80211_sta *sta)
  6851. {
  6852. unsigned int i;
  6853. for (i = 0; i < sband->n_bitrates; i++)
  6854. if (rate_supported(sta, sband->band, i))
  6855. return true;
  6856. return false;
  6857. }
  6858. /**
  6859. * rate_control_set_rates - pass the sta rate selection to mac80211/driver
  6860. *
  6861. * When not doing a rate control probe to test rates, rate control should pass
  6862. * its rate selection to mac80211. If the driver supports receiving a station
  6863. * rate table, it will use it to ensure that frames are always sent based on
  6864. * the most recent rate control module decision.
  6865. *
  6866. * @hw: pointer as obtained from ieee80211_alloc_hw()
  6867. * @pubsta: &struct ieee80211_sta pointer to the target destination.
  6868. * @rates: new tx rate set to be used for this station.
  6869. *
  6870. * Return: 0 on success. An error code otherwise.
  6871. */
  6872. int rate_control_set_rates(struct ieee80211_hw *hw,
  6873. struct ieee80211_sta *pubsta,
  6874. struct ieee80211_sta_rates *rates);
  6875. int ieee80211_rate_control_register(const struct rate_control_ops *ops);
  6876. void ieee80211_rate_control_unregister(const struct rate_control_ops *ops);
  6877. static inline bool
  6878. conf_is_ht20(struct ieee80211_conf *conf)
  6879. {
  6880. return conf->chandef.width == NL80211_CHAN_WIDTH_20;
  6881. }
  6882. static inline bool
  6883. conf_is_ht40_minus(struct ieee80211_conf *conf)
  6884. {
  6885. return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
  6886. conf->chandef.center_freq1 < conf->chandef.chan->center_freq;
  6887. }
  6888. static inline bool
  6889. conf_is_ht40_plus(struct ieee80211_conf *conf)
  6890. {
  6891. return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
  6892. conf->chandef.center_freq1 > conf->chandef.chan->center_freq;
  6893. }
  6894. static inline bool
  6895. conf_is_ht40(struct ieee80211_conf *conf)
  6896. {
  6897. return conf->chandef.width == NL80211_CHAN_WIDTH_40;
  6898. }
  6899. static inline bool
  6900. conf_is_ht(struct ieee80211_conf *conf)
  6901. {
  6902. return (conf->chandef.width != NL80211_CHAN_WIDTH_5) &&
  6903. (conf->chandef.width != NL80211_CHAN_WIDTH_10) &&
  6904. (conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT);
  6905. }
  6906. static inline enum nl80211_iftype
  6907. ieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p)
  6908. {
  6909. if (p2p) {
  6910. switch (type) {
  6911. case NL80211_IFTYPE_STATION:
  6912. return NL80211_IFTYPE_P2P_CLIENT;
  6913. case NL80211_IFTYPE_AP:
  6914. return NL80211_IFTYPE_P2P_GO;
  6915. default:
  6916. break;
  6917. }
  6918. }
  6919. return type;
  6920. }
  6921. static inline enum nl80211_iftype
  6922. ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
  6923. {
  6924. return ieee80211_iftype_p2p(vif->type, vif->p2p);
  6925. }
  6926. /**
  6927. * ieee80211_get_he_iftype_cap_vif - return HE capabilities for sband/vif
  6928. * @sband: the sband to search for the iftype on
  6929. * @vif: the vif to get the iftype from
  6930. *
  6931. * Return: pointer to the struct ieee80211_sta_he_cap, or %NULL is none found
  6932. */
  6933. static inline const struct ieee80211_sta_he_cap *
  6934. ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *sband,
  6935. struct ieee80211_vif *vif)
  6936. {
  6937. return ieee80211_get_he_iftype_cap(sband, ieee80211_vif_type_p2p(vif));
  6938. }
  6939. /**
  6940. * ieee80211_get_he_6ghz_capa_vif - return HE 6 GHz capabilities
  6941. * @sband: the sband to search for the STA on
  6942. * @vif: the vif to get the iftype from
  6943. *
  6944. * Return: the 6GHz capabilities
  6945. */
  6946. static inline __le16
  6947. ieee80211_get_he_6ghz_capa_vif(const struct ieee80211_supported_band *sband,
  6948. struct ieee80211_vif *vif)
  6949. {
  6950. return ieee80211_get_he_6ghz_capa(sband, ieee80211_vif_type_p2p(vif));
  6951. }
  6952. /**
  6953. * ieee80211_get_eht_iftype_cap_vif - return EHT capabilities for sband/vif
  6954. * @sband: the sband to search for the iftype on
  6955. * @vif: the vif to get the iftype from
  6956. *
  6957. * Return: pointer to the struct ieee80211_sta_eht_cap, or %NULL is none found
  6958. */
  6959. static inline const struct ieee80211_sta_eht_cap *
  6960. ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *sband,
  6961. struct ieee80211_vif *vif)
  6962. {
  6963. return ieee80211_get_eht_iftype_cap(sband, ieee80211_vif_type_p2p(vif));
  6964. }
  6965. /**
  6966. * ieee80211_get_uhr_iftype_cap_vif - return UHR capabilities for sband/vif
  6967. * @sband: the sband to search for the iftype on
  6968. * @vif: the vif to get the iftype from
  6969. *
  6970. * Return: pointer to the struct ieee80211_sta_uhr_cap, or %NULL is none found
  6971. */
  6972. static inline const struct ieee80211_sta_uhr_cap *
  6973. ieee80211_get_uhr_iftype_cap_vif(const struct ieee80211_supported_band *sband,
  6974. struct ieee80211_vif *vif)
  6975. {
  6976. return ieee80211_get_uhr_iftype_cap(sband, ieee80211_vif_type_p2p(vif));
  6977. }
  6978. /**
  6979. * ieee80211_update_mu_groups - set the VHT MU-MIMO groud data
  6980. *
  6981. * @vif: the specified virtual interface
  6982. * @link_id: the link ID for MLO, otherwise 0
  6983. * @membership: 64 bits array - a bit is set if station is member of the group
  6984. * @position: 2 bits per group id indicating the position in the group
  6985. *
  6986. * Note: This function assumes that the given vif is valid and the position and
  6987. * membership data is of the correct size and are in the same byte order as the
  6988. * matching GroupId management frame.
  6989. * Calls to this function need to be serialized with RX path.
  6990. */
  6991. void ieee80211_update_mu_groups(struct ieee80211_vif *vif, unsigned int link_id,
  6992. const u8 *membership, const u8 *position);
  6993. void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
  6994. int rssi_min_thold,
  6995. int rssi_max_thold);
  6996. void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
  6997. /**
  6998. * ieee80211_ave_rssi - report the average RSSI for the specified interface
  6999. *
  7000. * @vif: the specified virtual interface
  7001. * @link_id: the link ID for MLO, or -1 for non-MLO
  7002. *
  7003. * Note: This function assumes that the given vif is valid.
  7004. *
  7005. * Return: The average RSSI value for the requested interface, or 0 if not
  7006. * applicable.
  7007. */
  7008. int ieee80211_ave_rssi(struct ieee80211_vif *vif, int link_id);
  7009. /**
  7010. * ieee80211_report_wowlan_wakeup - report WoWLAN wakeup
  7011. * @vif: virtual interface
  7012. * @wakeup: wakeup reason(s)
  7013. * @gfp: allocation flags
  7014. *
  7015. * See cfg80211_report_wowlan_wakeup().
  7016. */
  7017. void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
  7018. struct cfg80211_wowlan_wakeup *wakeup,
  7019. gfp_t gfp);
  7020. /**
  7021. * ieee80211_tx_prepare_skb - prepare an 802.11 skb for transmission
  7022. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7023. * @vif: virtual interface
  7024. * @skb: frame to be sent from within the driver
  7025. * @band: the band to transmit on
  7026. * @sta: optional pointer to get the station to send the frame to
  7027. *
  7028. * Return: %true if the skb was prepared, %false otherwise.
  7029. * On failure, the skb is freed by this function; callers must not
  7030. * free it again.
  7031. *
  7032. * Note: must be called under RCU lock
  7033. */
  7034. bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
  7035. struct ieee80211_vif *vif, struct sk_buff *skb,
  7036. int band, struct ieee80211_sta **sta);
  7037. /**
  7038. * ieee80211_parse_tx_radiotap - Sanity-check and parse the radiotap header
  7039. * of injected frames.
  7040. *
  7041. * To accurately parse and take into account rate and retransmission fields,
  7042. * you must initialize the chandef field in the ieee80211_tx_info structure
  7043. * of the skb before calling this function.
  7044. *
  7045. * @skb: packet injected by userspace
  7046. * @dev: the &struct device of this 802.11 device
  7047. *
  7048. * Return: %true if the radiotap header was parsed, %false otherwise
  7049. */
  7050. bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
  7051. struct net_device *dev);
  7052. /**
  7053. * struct ieee80211_noa_data - holds temporary data for tracking P2P NoA state
  7054. *
  7055. * @next_tsf: TSF timestamp of the next absent state change
  7056. * @has_next_tsf: next absent state change event pending
  7057. *
  7058. * @absent: descriptor bitmask, set if GO is currently absent
  7059. *
  7060. * private:
  7061. *
  7062. * @count: count fields from the NoA descriptors
  7063. * @desc: adjusted data from the NoA
  7064. */
  7065. struct ieee80211_noa_data {
  7066. u32 next_tsf;
  7067. bool has_next_tsf;
  7068. u8 absent;
  7069. u8 count[IEEE80211_P2P_NOA_DESC_MAX];
  7070. struct {
  7071. u32 start;
  7072. u32 duration;
  7073. u32 interval;
  7074. } desc[IEEE80211_P2P_NOA_DESC_MAX];
  7075. };
  7076. /**
  7077. * ieee80211_parse_p2p_noa - initialize NoA tracking data from P2P IE
  7078. *
  7079. * @attr: P2P NoA IE
  7080. * @data: NoA tracking data
  7081. * @tsf: current TSF timestamp
  7082. *
  7083. * Return: number of successfully parsed descriptors
  7084. */
  7085. int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr,
  7086. struct ieee80211_noa_data *data, u32 tsf);
  7087. /**
  7088. * ieee80211_update_p2p_noa - get next pending P2P GO absent state change
  7089. *
  7090. * @data: NoA tracking data
  7091. * @tsf: current TSF timestamp
  7092. */
  7093. void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
  7094. /**
  7095. * ieee80211_tdls_oper_request - request userspace to perform a TDLS operation
  7096. * @vif: virtual interface
  7097. * @peer: the peer's destination address
  7098. * @oper: the requested TDLS operation
  7099. * @reason_code: reason code for the operation, valid for TDLS teardown
  7100. * @gfp: allocation flags
  7101. *
  7102. * See cfg80211_tdls_oper_request().
  7103. */
  7104. void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,
  7105. enum nl80211_tdls_operation oper,
  7106. u16 reason_code, gfp_t gfp);
  7107. /**
  7108. * ieee80211_reserve_tid - request to reserve a specific TID
  7109. *
  7110. * There is sometimes a need (such as in TDLS) for blocking the driver from
  7111. * using a specific TID so that the FW can use it for certain operations such
  7112. * as sending PTI requests. To make sure that the driver doesn't use that TID,
  7113. * this function must be called as it flushes out packets on this TID and marks
  7114. * it as blocked, so that any transmit for the station on this TID will be
  7115. * redirected to the alternative TID in the same AC.
  7116. *
  7117. * Note that this function blocks and may call back into the driver, so it
  7118. * should be called without driver locks held. Also note this function should
  7119. * only be called from the driver's @sta_state callback.
  7120. *
  7121. * @sta: the station to reserve the TID for
  7122. * @tid: the TID to reserve
  7123. *
  7124. * Returns: 0 on success, else on failure
  7125. */
  7126. int ieee80211_reserve_tid(struct ieee80211_sta *sta, u8 tid);
  7127. /**
  7128. * ieee80211_unreserve_tid - request to unreserve a specific TID
  7129. *
  7130. * Once there is no longer any need for reserving a certain TID, this function
  7131. * should be called, and no longer will packets have their TID modified for
  7132. * preventing use of this TID in the driver.
  7133. *
  7134. * Note that this function blocks and acquires a lock, so it should be called
  7135. * without driver locks held. Also note this function should only be called
  7136. * from the driver's @sta_state callback.
  7137. *
  7138. * @sta: the station
  7139. * @tid: the TID to unreserve
  7140. */
  7141. void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
  7142. /**
  7143. * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
  7144. *
  7145. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7146. * @txq: pointer obtained from station or virtual interface, or from
  7147. * ieee80211_next_txq()
  7148. *
  7149. * Return: the skb if successful, %NULL if no frame was available.
  7150. *
  7151. * Note that this must be called in an rcu_read_lock() critical section,
  7152. * which can only be released after the SKB was handled. Some pointers in
  7153. * skb->cb, e.g. the key pointer, are protected by RCU and thus the
  7154. * critical section must persist not just for the duration of this call
  7155. * but for the duration of the frame handling.
  7156. * However, also note that while in the wake_tx_queue() method,
  7157. * rcu_read_lock() is already held.
  7158. *
  7159. * softirqs must also be disabled when this function is called.
  7160. * In process context, use ieee80211_tx_dequeue_ni() instead.
  7161. */
  7162. struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  7163. struct ieee80211_txq *txq);
  7164. /**
  7165. * ieee80211_tx_dequeue_ni - dequeue a packet from a software tx queue
  7166. * (in process context)
  7167. *
  7168. * Like ieee80211_tx_dequeue() but can be called in process context
  7169. * (internally disables bottom halves).
  7170. *
  7171. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7172. * @txq: pointer obtained from station or virtual interface, or from
  7173. * ieee80211_next_txq()
  7174. *
  7175. * Return: the skb if successful, %NULL if no frame was available.
  7176. */
  7177. static inline struct sk_buff *ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw,
  7178. struct ieee80211_txq *txq)
  7179. {
  7180. struct sk_buff *skb;
  7181. local_bh_disable();
  7182. skb = ieee80211_tx_dequeue(hw, txq);
  7183. local_bh_enable();
  7184. return skb;
  7185. }
  7186. /**
  7187. * ieee80211_handle_wake_tx_queue - mac80211 handler for wake_tx_queue callback
  7188. *
  7189. * @hw: pointer as obtained from wake_tx_queue() callback().
  7190. * @txq: pointer as obtained from wake_tx_queue() callback().
  7191. *
  7192. * Drivers can use this function for the mandatory mac80211 wake_tx_queue
  7193. * callback in struct ieee80211_ops. They should not call this function.
  7194. */
  7195. void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,
  7196. struct ieee80211_txq *txq);
  7197. /**
  7198. * ieee80211_next_txq - get next tx queue to pull packets from
  7199. *
  7200. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7201. * @ac: AC number to return packets from.
  7202. *
  7203. * Return: the next txq if successful, %NULL if no queue is eligible. If a txq
  7204. * is returned, it should be returned with ieee80211_return_txq() after the
  7205. * driver has finished scheduling it.
  7206. */
  7207. struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac);
  7208. /**
  7209. * ieee80211_txq_schedule_start - start new scheduling round for TXQs
  7210. *
  7211. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7212. * @ac: AC number to acquire locks for
  7213. *
  7214. * Should be called before ieee80211_next_txq() or ieee80211_return_txq().
  7215. * The driver must not call multiple TXQ scheduling rounds concurrently.
  7216. */
  7217. void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac);
  7218. /* (deprecated) */
  7219. static inline void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
  7220. {
  7221. }
  7222. void __ieee80211_schedule_txq(struct ieee80211_hw *hw,
  7223. struct ieee80211_txq *txq, bool force);
  7224. /**
  7225. * ieee80211_schedule_txq - schedule a TXQ for transmission
  7226. *
  7227. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7228. * @txq: pointer obtained from station or virtual interface
  7229. *
  7230. * Schedules a TXQ for transmission if it is not already scheduled,
  7231. * even if mac80211 does not have any packets buffered.
  7232. *
  7233. * The driver may call this function if it has buffered packets for
  7234. * this TXQ internally.
  7235. */
  7236. static inline void
  7237. ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
  7238. {
  7239. __ieee80211_schedule_txq(hw, txq, true);
  7240. }
  7241. /**
  7242. * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq()
  7243. *
  7244. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7245. * @txq: pointer obtained from station or virtual interface
  7246. * @force: schedule txq even if mac80211 does not have any buffered packets.
  7247. *
  7248. * The driver may set force=true if it has buffered packets for this TXQ
  7249. * internally.
  7250. */
  7251. static inline void
  7252. ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
  7253. bool force)
  7254. {
  7255. __ieee80211_schedule_txq(hw, txq, force);
  7256. }
  7257. /**
  7258. * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
  7259. *
  7260. * This function is used to check whether given txq is allowed to transmit by
  7261. * the airtime scheduler, and can be used by drivers to access the airtime
  7262. * fairness accounting without using the scheduling order enforced by
  7263. * next_txq().
  7264. *
  7265. * Returns %true if the airtime scheduler thinks the TXQ should be allowed to
  7266. * transmit, and %false if it should be throttled. This function can also have
  7267. * the side effect of rotating the TXQ in the scheduler rotation, which will
  7268. * eventually bring the deficit to positive and allow the station to transmit
  7269. * again.
  7270. *
  7271. * The API ieee80211_txq_may_transmit() also ensures that TXQ list will be
  7272. * aligned against driver's own round-robin scheduler list. i.e it rotates
  7273. * the TXQ list till it makes the requested node becomes the first entry
  7274. * in TXQ list. Thus both the TXQ list and driver's list are in sync. If this
  7275. * function returns %true, the driver is expected to schedule packets
  7276. * for transmission, and then return the TXQ through ieee80211_return_txq().
  7277. *
  7278. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7279. * @txq: pointer obtained from station or virtual interface
  7280. *
  7281. * Return: %true if transmission is allowed, %false otherwise
  7282. */
  7283. bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
  7284. struct ieee80211_txq *txq);
  7285. /**
  7286. * ieee80211_txq_get_depth - get pending frame/byte count of given txq
  7287. *
  7288. * The values are not guaranteed to be coherent with regard to each other, i.e.
  7289. * txq state can change half-way of this function and the caller may end up
  7290. * with "new" frame_cnt and "old" byte_cnt or vice-versa.
  7291. *
  7292. * @txq: pointer obtained from station or virtual interface
  7293. * @frame_cnt: pointer to store frame count
  7294. * @byte_cnt: pointer to store byte count
  7295. */
  7296. void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
  7297. unsigned long *frame_cnt,
  7298. unsigned long *byte_cnt);
  7299. /**
  7300. * ieee80211_nan_func_terminated - notify about NAN function termination.
  7301. *
  7302. * This function is used to notify mac80211 about NAN function termination.
  7303. * Note that this function can't be called from hard irq.
  7304. *
  7305. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  7306. * @inst_id: the local instance id
  7307. * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
  7308. * @gfp: allocation flags
  7309. */
  7310. void ieee80211_nan_func_terminated(struct ieee80211_vif *vif,
  7311. u8 inst_id,
  7312. enum nl80211_nan_func_term_reason reason,
  7313. gfp_t gfp);
  7314. /**
  7315. * ieee80211_nan_func_match - notify about NAN function match event.
  7316. *
  7317. * This function is used to notify mac80211 about NAN function match. The
  7318. * cookie inside the match struct will be assigned by mac80211.
  7319. * Note that this function can't be called from hard irq.
  7320. *
  7321. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  7322. * @match: match event information
  7323. * @gfp: allocation flags
  7324. */
  7325. void ieee80211_nan_func_match(struct ieee80211_vif *vif,
  7326. struct cfg80211_nan_match_params *match,
  7327. gfp_t gfp);
  7328. /**
  7329. * ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
  7330. *
  7331. * This function calculates the estimated airtime usage of a frame based on the
  7332. * rate information in the RX status struct and the frame length.
  7333. *
  7334. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7335. * @status: &struct ieee80211_rx_status containing the transmission rate
  7336. * information.
  7337. * @len: frame length in bytes
  7338. *
  7339. * Return: the airtime estimate
  7340. */
  7341. u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
  7342. struct ieee80211_rx_status *status,
  7343. int len);
  7344. /**
  7345. * ieee80211_calc_tx_airtime - calculate estimated transmission airtime for TX.
  7346. *
  7347. * This function calculates the estimated airtime usage of a frame based on the
  7348. * rate information in the TX info struct and the frame length.
  7349. *
  7350. * @hw: pointer as obtained from ieee80211_alloc_hw()
  7351. * @info: &struct ieee80211_tx_info of the frame.
  7352. * @len: frame length in bytes
  7353. *
  7354. * Return: the airtime estimate
  7355. */
  7356. u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
  7357. struct ieee80211_tx_info *info,
  7358. int len);
  7359. /**
  7360. * ieee80211_get_fils_discovery_tmpl - Get FILS discovery template.
  7361. * @hw: pointer obtained from ieee80211_alloc_hw().
  7362. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  7363. *
  7364. * The driver is responsible for freeing the returned skb.
  7365. *
  7366. * Return: FILS discovery template. %NULL on error.
  7367. */
  7368. struct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
  7369. struct ieee80211_vif *vif);
  7370. /**
  7371. * ieee80211_get_unsol_bcast_probe_resp_tmpl - Get unsolicited broadcast
  7372. * probe response template.
  7373. * @hw: pointer obtained from ieee80211_alloc_hw().
  7374. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  7375. *
  7376. * The driver is responsible for freeing the returned skb.
  7377. *
  7378. * Return: Unsolicited broadcast probe response template. %NULL on error.
  7379. */
  7380. struct sk_buff *
  7381. ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
  7382. struct ieee80211_vif *vif);
  7383. /**
  7384. * ieee80211_obss_color_collision_notify - notify userland about a BSS color
  7385. * collision.
  7386. * @link_id: valid link_id during MLO or 0 for non-MLO
  7387. *
  7388. * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  7389. * @color_bitmap: a 64 bit bitmap representing the colors that the local BSS is
  7390. * aware of.
  7391. */
  7392. void
  7393. ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
  7394. u64 color_bitmap, u8 link_id);
  7395. /**
  7396. * ieee80211_is_tx_data - check if frame is a data frame
  7397. *
  7398. * The function is used to check if a frame is a data frame. Frames with
  7399. * hardware encapsulation enabled are data frames.
  7400. *
  7401. * @skb: the frame to be transmitted.
  7402. *
  7403. * Return: %true if @skb is a data frame, %false otherwise
  7404. */
  7405. static inline bool ieee80211_is_tx_data(struct sk_buff *skb)
  7406. {
  7407. struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  7408. struct ieee80211_hdr *hdr = (void *) skb->data;
  7409. return info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP ||
  7410. ieee80211_is_data(hdr->frame_control);
  7411. }
  7412. /**
  7413. * ieee80211_set_active_links - set active links in client mode
  7414. * @vif: interface to set active links on
  7415. * @active_links: the new active links bitmap
  7416. *
  7417. * Context: Must be called with wiphy mutex held; may sleep; calls
  7418. * back into the driver.
  7419. *
  7420. * This changes the active links on an interface. The interface
  7421. * must be in client mode (in AP mode, all links are always active),
  7422. * and @active_links must be a subset of the vif's valid_links.
  7423. *
  7424. * If a link is switched off and another is switched on at the same
  7425. * time (e.g. active_links going from 0x1 to 0x10) then you will get
  7426. * a sequence of calls like
  7427. *
  7428. * - change_vif_links(0x11)
  7429. * - unassign_vif_chanctx(link_id=0)
  7430. * - assign_vif_chanctx(link_id=4)
  7431. * - change_sta_links(0x11) for each affected STA (the AP)
  7432. * (TDLS connections on now inactive links should be torn down)
  7433. * - remove group keys on the old link (link_id 0)
  7434. * - add new group keys (GTK/IGTK/BIGTK) on the new link (link_id 4)
  7435. * - change_sta_links(0x10) for each affected STA (the AP)
  7436. * - change_vif_links(0x10)
  7437. *
  7438. * Return: 0 on success. An error code otherwise.
  7439. */
  7440. int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links);
  7441. /**
  7442. * ieee80211_set_active_links_async - asynchronously set active links
  7443. * @vif: interface to set active links on
  7444. * @active_links: the new active links bitmap
  7445. *
  7446. * See ieee80211_set_active_links() for more information, the only
  7447. * difference here is that the link change is triggered async and
  7448. * can be called in any context, but the link switch will only be
  7449. * completed after it returns.
  7450. */
  7451. void ieee80211_set_active_links_async(struct ieee80211_vif *vif,
  7452. u16 active_links);
  7453. /**
  7454. * ieee80211_send_teardown_neg_ttlm - tear down a negotiated TTLM request
  7455. * @vif: the interface on which the tear down request should be sent.
  7456. *
  7457. * This function can be used to tear down a previously accepted negotiated
  7458. * TTLM request.
  7459. */
  7460. void ieee80211_send_teardown_neg_ttlm(struct ieee80211_vif *vif);
  7461. /**
  7462. * ieee80211_chan_width_to_rx_bw - convert channel width to STA RX bandwidth
  7463. * @width: the channel width value to convert
  7464. * Return: the STA RX bandwidth value for the channel width
  7465. */
  7466. static inline enum ieee80211_sta_rx_bandwidth
  7467. ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width)
  7468. {
  7469. switch (width) {
  7470. default:
  7471. WARN_ON_ONCE(1);
  7472. fallthrough;
  7473. case NL80211_CHAN_WIDTH_20_NOHT:
  7474. case NL80211_CHAN_WIDTH_20:
  7475. return IEEE80211_STA_RX_BW_20;
  7476. case NL80211_CHAN_WIDTH_40:
  7477. return IEEE80211_STA_RX_BW_40;
  7478. case NL80211_CHAN_WIDTH_80:
  7479. return IEEE80211_STA_RX_BW_80;
  7480. case NL80211_CHAN_WIDTH_160:
  7481. case NL80211_CHAN_WIDTH_80P80:
  7482. return IEEE80211_STA_RX_BW_160;
  7483. case NL80211_CHAN_WIDTH_320:
  7484. return IEEE80211_STA_RX_BW_320;
  7485. }
  7486. }
  7487. /**
  7488. * ieee80211_prepare_rx_omi_bw - prepare for sending BW RX OMI
  7489. * @link_sta: the link STA the OMI is going to be sent to
  7490. * @bw: the bandwidth requested
  7491. *
  7492. * When the driver decides to do RX OMI to change bandwidth with a STA
  7493. * it calls this function to prepare, then sends the OMI, and finally
  7494. * calls ieee80211_finalize_rx_omi_bw().
  7495. *
  7496. * Note that the (link) STA rate control is updated accordingly as well,
  7497. * but the chanctx might not be updated if there are other users.
  7498. * If the intention is to reduce the listen bandwidth, the driver must
  7499. * ensure there are no TDLS stations nor other uses of the chanctx.
  7500. *
  7501. * Also note that in order to sequence correctly, narrowing bandwidth
  7502. * will only happen in ieee80211_finalize_rx_omi_bw(), whereas widening
  7503. * again (e.g. going back to normal) will happen here.
  7504. *
  7505. * Note that we treat this symmetrically, so if the driver calls this
  7506. * and tells the peer to only send with a lower bandwidth, we assume
  7507. * that the driver also wants to only send at that lower bandwidth, to
  7508. * allow narrowing of the chanctx request for this station/interface.
  7509. *
  7510. * Finally, the driver must ensure that if the function returned %true,
  7511. * ieee80211_finalize_rx_omi_bw() is also called, even for example in
  7512. * case of HW restart.
  7513. *
  7514. * Context: Must be called with wiphy mutex held, and will call back
  7515. * into the driver, so ensure no driver locks are held.
  7516. *
  7517. * Return: %true if changes are going to be made, %false otherwise
  7518. */
  7519. bool ieee80211_prepare_rx_omi_bw(struct ieee80211_link_sta *link_sta,
  7520. enum ieee80211_sta_rx_bandwidth bw);
  7521. /**
  7522. * ieee80211_finalize_rx_omi_bw - finalize BW RX OMI update
  7523. * @link_sta: the link STA the OMI was sent to
  7524. *
  7525. * See ieee80211_client_prepare_rx_omi_bw(). Context is the same here
  7526. * as well.
  7527. */
  7528. void ieee80211_finalize_rx_omi_bw(struct ieee80211_link_sta *link_sta);
  7529. /* for older drivers - let's not document these ... */
  7530. int ieee80211_emulate_add_chanctx(struct ieee80211_hw *hw,
  7531. struct ieee80211_chanctx_conf *ctx);
  7532. void ieee80211_emulate_remove_chanctx(struct ieee80211_hw *hw,
  7533. struct ieee80211_chanctx_conf *ctx);
  7534. void ieee80211_emulate_change_chanctx(struct ieee80211_hw *hw,
  7535. struct ieee80211_chanctx_conf *ctx,
  7536. u32 changed);
  7537. int ieee80211_emulate_switch_vif_chanctx(struct ieee80211_hw *hw,
  7538. struct ieee80211_vif_chanctx_switch *vifs,
  7539. int n_vifs,
  7540. enum ieee80211_chanctx_switch_mode mode);
  7541. /**
  7542. * ieee80211_vif_nan_started - Return whether a NAN vif is started
  7543. * @vif: the vif
  7544. * Return: %true iff the vif is a NAN interface and NAN is started
  7545. */
  7546. bool ieee80211_vif_nan_started(struct ieee80211_vif *vif);
  7547. #endif /* MAC80211_H */