12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179 |
- /*
- * Copyright (c) 2017-2018,2020 The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Changes from Qualcomm Innovation Center are provided under the following license:
- *
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <string.h>
- #include <stdint.h>
- #include "hton.h" // for htonl
- #include "InterfaceAbstraction.h"
- #include "Constants.h"
- #include "Logger.h"
- #include "TestsUtils.h"
- #include "linux/msm_ipa.h"
- #include "RoutingDriverWrapper.h"
- #include "Filtering.h"
- #include "IPAFilteringTable.h"
- #define TOS_FIELD_OFFSET (1)
- #define IPV4_TTL_OFFSET (8)
- #define IPV4_CSUM_OFFSET (10)
- #define DST_ADDR_LSB_OFFSET_IPV4 (19)
- #define SRC_ADDR_LSB_OFFSET_IPV4 (15)
- #define DST_ADDR_MSB_OFFSET_IPV6 (24)
- #define DST_ADDR_LSB_OFFSET_IPV6 (39)
- #define TRAFFIC_CLASS_MSB_OFFSET_IPV6 (0)
- #define TRAFFIC_CLASS_LSB_OFFSET_IPV6 (1)
- #define FLOW_CLASS_MSB_OFFSET_IPV6 (1)
- #define FLOW_CLASS_MB_OFFSET_IPV6 (2)
- #define FLOW_CLASS_LSB_OFFSET_IPV6 (3)
- #define HOP_LIMIT_OFFSET_IPV6 (7)
- #define IPV4_DST_PORT_OFFSET (20+2)
- #define IPV6_SRC_PORT_OFFSET (40)
- #define IPV6_DST_PORT_OFFSET (40+2)
- #define IPv4_TCP_FLAGS_OFFSET (20+13)
- #define IPv6_TCP_FLAGS_OFFSET (40+13)
- #define TCP_ACK_FLAG_MASK (0x10)
- extern Logger g_Logger;
- class IpaRoutingBlockTestFixture:public TestBase
- {
- public:
- IpaRoutingBlockTestFixture():
- m_sendSize (BUFF_MAX_SIZE),
- m_sendSize2 (BUFF_MAX_SIZE),
- m_sendSize3 (BUFF_MAX_SIZE),
- m_IpaIPType(IPA_IP_v4)
- {
- memset(m_sendBuffer, 0, sizeof(m_sendBuffer));
- memset(m_sendBuffer2, 0, sizeof(m_sendBuffer2));
- memset(m_sendBuffer3, 0, sizeof(m_sendBuffer3));
- m_testSuiteName.push_back("Routing");
- }
- static int SetupKernelModule(bool en_status = false)
- {
- int retval;
- struct ipa_channel_config from_ipa_channels[3];
- struct test_ipa_ep_cfg from_ipa_cfg[3];
- struct ipa_channel_config to_ipa_channels[1];
- struct test_ipa_ep_cfg to_ipa_cfg[1];
- struct ipa_test_config_header header = {0};
- struct ipa_channel_config *to_ipa_array[1];
- struct ipa_channel_config *from_ipa_array[3];
- /* From ipa configurations - 3 pipes */
- memset(&from_ipa_cfg[0], 0, sizeof(from_ipa_cfg[0]));
- prepare_channel_struct(&from_ipa_channels[0],
- header.from_ipa_channels_num++,
- IPA_CLIENT_TEST2_CONS,
- (void *)&from_ipa_cfg[0],
- sizeof(from_ipa_cfg[0]), en_status);
- from_ipa_array[0] = &from_ipa_channels[0];
- memset(&from_ipa_cfg[1], 0, sizeof(from_ipa_cfg[1]));
- prepare_channel_struct(&from_ipa_channels[1],
- header.from_ipa_channels_num++,
- IPA_CLIENT_TEST3_CONS,
- (void *)&from_ipa_cfg[1],
- sizeof(from_ipa_cfg[1]), en_status);
- from_ipa_array[1] = &from_ipa_channels[1];
- memset(&from_ipa_cfg[2], 0, sizeof(from_ipa_cfg[2]));
- prepare_channel_struct(&from_ipa_channels[2],
- header.from_ipa_channels_num++,
- IPA_CLIENT_TEST4_CONS,
- (void *)&from_ipa_cfg[2],
- sizeof(from_ipa_cfg[2]), en_status);
- from_ipa_array[2] = &from_ipa_channels[2];
- /* To ipa configurations - 1 pipes */
- memset(&to_ipa_cfg[0], 0, sizeof(to_ipa_cfg[0]));
- prepare_channel_struct(&to_ipa_channels[0],
- header.to_ipa_channels_num++,
- IPA_CLIENT_TEST_PROD,
- (void *)&to_ipa_cfg[0],
- sizeof(to_ipa_cfg[0]));
- to_ipa_array[0] = &to_ipa_channels[0];
- prepare_header_struct(&header, from_ipa_array, to_ipa_array);
- retval = GenericConfigureScenario(&header);
- return retval;
- }
- bool Setup(bool en_status)
- {
- bool bRetVal = true;
- bRetVal = SetupKernelModule(en_status);
- if (bRetVal != true) {
- return bRetVal;
- }
- m_producer.Open(INTERFACE0_TO_IPA_DATA_PATH, INTERFACE0_FROM_IPA_DATA_PATH);
- m_consumer.Open(INTERFACE1_TO_IPA_DATA_PATH, INTERFACE1_FROM_IPA_DATA_PATH);
- m_consumer2.Open(INTERFACE2_TO_IPA_DATA_PATH, INTERFACE2_FROM_IPA_DATA_PATH);
- m_defaultConsumer.Open(INTERFACE3_TO_IPA_DATA_PATH, INTERFACE3_FROM_IPA_DATA_PATH);
- if (!m_routing.DeviceNodeIsOpened()) {
- printf("Routing block is not ready for immediate commands!\n");
- return false;
- }
- if (!m_filtering.DeviceNodeIsOpened()) {
- printf("Filtering block is not ready for immediate commands!\n");
- return false;
- }
- m_routing.Reset(IPA_IP_v4);
- m_routing.Reset(IPA_IP_v6);
- return true;
- } /* Setup()*/
- bool Setup()
- {
- return Setup(false);
- }
- bool Teardown()
- {
- if (!m_routing.DeviceNodeIsOpened()) {
- printf("Routing block is not ready for immediate commands!\n");
- return false;
- }
- if (!m_filtering.DeviceNodeIsOpened()) {
- printf("Filtering block is not ready for immediate commands!\n");
- return false;
- }
- m_producer.Close();
- m_consumer.Close();
- m_consumer2.Close();
- m_defaultConsumer.Close();
- return true;
- } /* Teardown() */
- bool LoadFiles(enum ipa_ip_type ip)
- {
- string fileName;
- if (IPA_IP_v4 == ip) {
- fileName = "Input/IPv4_1";
- } else {
- fileName = "Input/IPv6";
- }
- if (!LoadDefaultPacket(ip, m_sendBuffer, m_sendSize)) {
- LOG_MSG_ERROR("Failed loading default Packet");
- return false;
- }
- if (!LoadDefaultPacket(ip, m_sendBuffer2, m_sendSize2)) {
- LOG_MSG_ERROR("Failed loading default Packet");
- return false;
- }
- if (!LoadDefaultPacket(ip, m_sendBuffer3, m_sendSize3)) {
- LOG_MSG_ERROR("Failed loading default Packet");
- return false;
- }
- return true;
- }
- bool ReceivePacketAndCompareFrom(InterfaceAbstraction& cons, Byte* send,
- size_t send_sz, bool shouldBeHit)
- {
- size_t receivedSize = 0;
- bool isSuccess = true;
- /* Receive results*/
- Byte *rxBuff1 = new Byte[0x400];
- if (NULL == rxBuff1)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = cons.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, cons.m_fromChannelName.c_str());
- // Compare results
- isSuccess &= CompareResultVsGolden_w_Status(send, send_sz, rxBuff1, receivedSize);
- if (shouldBeHit) {
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheHit_v5_0(send_sz, receivedSize, rxBuff1) : IsCacheHit(send_sz, receivedSize, rxBuff1);
- }
- else
- {
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(send_sz, receivedSize, rxBuff1) : IsCacheMiss(send_sz, receivedSize, rxBuff1);
- }
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- // char * p = recievedBuffer;
- size_t j;
- for(j = 0; j < m_sendSize; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", send[j]);
- for(j = 0; j < receivedSize; j++)
- // recievedBuffer += sprintf(recievedBuffer, "%02X", rxBuff1[i]);
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff1[j]);
- printf("Expected Value (%zu)\n%s\n, Received Value1(%zu)\n%s\n",send_sz,sentBuffer,receivedSize,recievedBuffer);
- delete[] rxBuff1;
- delete[] recievedBuffer;
- delete[] sentBuffer;
- return isSuccess;
- }
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool pkt1_cmp_succ, pkt2_cmp_succ, pkt3_cmp_succ;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- memset(rxBuff1, 0, 0x400);
- memset(rxBuff2, 0, 0x400);
- memset(rxBuff3, 0, 0x400);
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer2.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Compare results */
- pkt1_cmp_succ = CompareResultVsGolden(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- pkt2_cmp_succ = CompareResultVsGolden(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- pkt3_cmp_succ = CompareResultVsGolden(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- size_t recievedBufferSize =
- MAX3(receivedSize, receivedSize2, receivedSize3) * 3;
- size_t sentBufferSize =
- MAX3(m_sendSize, m_sendSize2, m_sendSize3) * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- if (NULL == recievedBuffer || NULL == sentBuffer) {
- printf("Memory allocation error\n");
- return false;
- }
- size_t j;
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer[j]);
- for(j = 0; j < receivedSize; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff1[j]);
- printf("Expected Value1(%zu)\n%s\n, Received Value1(%zu)\n%s\n-->Value1 %s\n",
- m_sendSize,sentBuffer,receivedSize,recievedBuffer,
- pkt1_cmp_succ?"Match":"no Match");
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize2; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer2[j]);
- for(j = 0; j < receivedSize2; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff2[j]);
- printf("Expected Value2 (%zu)\n%s\n, Received Value2(%zu)\n%s\n-->Value2 %s\n",
- m_sendSize2,sentBuffer,receivedSize2,recievedBuffer,
- pkt2_cmp_succ?"Match":"no Match");
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize3; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer3[j]);
- for(j = 0; j < receivedSize3; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff3[j]);
- printf("Expected Value3 (%zu)\n%s\n, Received Value3(%zu)\n%s\n-->Value3 %s\n",
- m_sendSize3,sentBuffer,receivedSize3,recievedBuffer,
- pkt3_cmp_succ?"Match":"no Match");
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return pkt1_cmp_succ && pkt2_cmp_succ && pkt3_cmp_succ;
- }
- void print_packets(size_t receivedSize, size_t m_sendSize, size_t recievedBufferSize, size_t sentBufferSize, Byte *rxBuff, Byte *m_sendBuffer, char *recievedBuffer, char *sentBuffer)
- {
- size_t j;
- for(j = 0; j < m_sendSize; j++) {
- snprintf(&sentBuffer[3 * j], sentBufferSize - 3 * j,
- " %02X", m_sendBuffer[j]);
- }
- for(j = 0; j < receivedSize; j++) {
- snprintf(&recievedBuffer[3 * j], recievedBufferSize- 3 * j,
- " %02X", rxBuff[j]);
- }
- printf("Expected Value (%zu)\n%s\n, Received Value(%zu)\n%s\n",m_sendSize,sentBuffer,receivedSize,recievedBuffer);
- }
- ~IpaRoutingBlockTestFixture()
- {
- m_sendSize = 0;
- m_sendSize2 = 0;
- m_sendSize3 = 0;
- }
- void InitFilteringBlock()
- {
- IPAFilteringTable fltTable;
- struct ipa_ioc_get_rt_tbl st_rt_tbl;
- struct ipa_flt_rule_add flt_rule_entry;
- memset(&st_rt_tbl, 0, sizeof(st_rt_tbl));
- memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
- strlcpy(st_rt_tbl.name, "LAN", sizeof(st_rt_tbl.name));
- st_rt_tbl.ip = m_IpaIPType;
- fltTable.Init(m_IpaIPType, IPA_CLIENT_TEST_PROD, false, 1);
- m_routing.GetRoutingTable(&st_rt_tbl);
- flt_rule_entry.rule.rt_tbl_hdl = st_rt_tbl.hdl;
- fltTable.AddRuleToTable(flt_rule_entry);
- m_filtering.AddFilteringRule(fltTable.GetFilteringTable());
- }
- inline bool VerifyStatusReceived(size_t SendSize, size_t RecvSize)
- {
- size_t stts_size = sizeof(struct ipa3_hw_pkt_status);
- if (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) {
- stts_size = sizeof(struct ipa3_hw_pkt_status_hw_v5_0);
- }
- if ((RecvSize <= SendSize) ||
- ((RecvSize - SendSize) != stts_size)){
- printf("received buffer size does not match! sent:receive [%zu]:[%zu]\n",SendSize,RecvSize);
- return false;
- }
- return true;
- }
- inline bool IsCacheHit(size_t SendSize, size_t RecvSize, void *Buff)
- {
- struct ipa3_hw_pkt_status *pStatus = (struct ipa3_hw_pkt_status *)Buff;
- if (VerifyStatusReceived(SendSize,RecvSize) == false){
- return false;
- }
- if((bool)pStatus->route_hash){
- printf ("%s::cache hit!! \n",__FUNCTION__);
- return true;
- }
- printf ("%s::cache miss!! \n",__FUNCTION__);
- return false;
- }
- inline bool IsCacheHit_v5_0(size_t SendSize, size_t RecvSize, void *Buff)
- {
- struct ipa3_hw_pkt_status_hw_v5_0 *pStatus = (struct ipa3_hw_pkt_status_hw_v5_0 *)Buff;
- if (VerifyStatusReceived(SendSize,RecvSize) == false){
- return false;
- }
- if((bool)pStatus->route_hash){
- printf ("%s::cache hit!! \n",__FUNCTION__);
- return true;
- }
- printf ("%s::cache miss!! \n",__FUNCTION__);
- return false;
- }
- inline bool IsCacheMiss(size_t SendSize, size_t RecvSize, void *Buff)
- {
- struct ipa3_hw_pkt_status *pStatus = (struct ipa3_hw_pkt_status *)Buff;
- if (VerifyStatusReceived(SendSize,RecvSize) == false){
- return false;
- }
- if(!((bool)pStatus->route_hash)){
- printf ("%s::cache miss!! \n",__FUNCTION__);
- return true;
- }
- printf ("%s::cache hit!! \n",__FUNCTION__);
- return false;
- }
- inline bool IsCacheMiss_v5_0(size_t SendSize, size_t RecvSize, void *Buff)
- {
- struct ipa3_hw_pkt_status_hw_v5_0 *pStatus = (struct ipa3_hw_pkt_status_hw_v5_0 *)Buff;
- if (VerifyStatusReceived(SendSize,RecvSize) == false){
- return false;
- }
- if(!((bool)pStatus->route_hash)){
- printf ("%s::cache miss!! \n",__FUNCTION__);
- return true;
- }
- printf ("%s::cache hit!! \n",__FUNCTION__);
- return false;
- }
- inline bool IsTTLUpdated_v5_5(size_t SendSize, size_t RecvSize, void *Buff)
- {
- struct ipa3_hw_pkt_status_hw_v5_5 *pStatus = (struct ipa3_hw_pkt_status_hw_v5_5 *)Buff;
- if (VerifyStatusReceived(SendSize,RecvSize) == false){
- return false;
- }
- if(!((bool)pStatus->ttl_dec)){
- printf ("%s::cache miss!! \n",__FUNCTION__);
- return true;
- }
- printf ("%s::cache hit!! \n",__FUNCTION__);
- return false;
- }
- static RoutingDriverWrapper m_routing;
- static Filtering m_filtering;
- static const size_t BUFF_MAX_SIZE = 1024;
- InterfaceAbstraction m_producer;
- InterfaceAbstraction m_consumer;
- InterfaceAbstraction m_consumer2;
- InterfaceAbstraction m_defaultConsumer;
- Byte m_sendBuffer[BUFF_MAX_SIZE]; // First input file / IP packet
- Byte m_sendBuffer2[BUFF_MAX_SIZE]; // Second input file / IP packet
- Byte m_sendBuffer3[BUFF_MAX_SIZE]; // Third input file (default) / IP packet
- size_t m_sendSize;
- size_t m_sendSize2;
- size_t m_sendSize3;
- enum ipa_ip_type m_IpaIPType;
- private:
- };
- RoutingDriverWrapper IpaRoutingBlockTestFixture::m_routing;
- Filtering IpaRoutingBlockTestFixture::m_filtering;
- /*---------------------------------------------------------------------------*/
- /* Test1: Tests routing by destination address */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest1 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest1()
- {
- m_name = "IpaRoutingBlockTest1";
- m_description =" \
- Routing block test 001 - Destination address exact match\1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.169.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.255 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802FF;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test2: Tests routing by destination address with a subnet (mask) */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest2 : IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest2()
- {
- m_name = "IpaRoutingBlockTest2";
- m_description =" \
- Routing block test 002 - Destination address subnet match \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.169.170.0 & 255.255.255.0)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.255.0 & 255.255.255.0)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- printf("ENTRY: IpaRoutingBlockTest2::Run()\n");
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[18] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[18] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- printf("ENTRY: IpaRoutingBlockTest2::AddRules()\n");
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A8FF00;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFF00;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A8AA00;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFF00;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- printf("Before calling m_routing.AddRoutingRule()\n");
- printf("m_routing = %p\n", &m_routing);
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test3: Tests routing by TOS (Type Of Service) */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest3 : IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest3()
- {
- m_name = "IpaRoutingBlockTest3";
- m_description = " \
- Routing block test 003 - TOS exact match\
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All TOS == 0xBF traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All TOS == 0x3A traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[TOS_FIELD_OFFSET] = 0xBF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[TOS_FIELD_OFFSET] = 0x3A;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if (!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl;
- // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_TOS;
- rt_rule_entry->rule.attrib.u.v4.tos = 0xBF;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_TOS;
- rt_rule_entry->rule.attrib.u.v4.tos = 0x3A;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test4: Destination address exact match and TOS exact match */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest4 : IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest4()
- {
- m_name = "IpaRoutingBlockTest4";
- m_description =" \
- Routing block test 004 - Source and Destination address and TOS exact match \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.169.2.255 & 255.255.255.255) and TOS == 0xFF traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.170 & 255.255.255.255) and TOS == 0xAA traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All DST_IP == (192.168.2.85 & 255.255.255.255) and SRC_IP == (192.168.2.241 & 255.255.255.255) TOS == 0x24 traffic goes to pipe IPA_CLIENT_TEST3_CONS";
- m_IpaIPType = IPA_IP_v4;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[TOS_FIELD_OFFSET] = 0xFF;
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[TOS_FIELD_OFFSET] = 0xAA;
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- m_sendBuffer3[TOS_FIELD_OFFSET] = 0x24;
- m_sendBuffer3[DST_ADDR_LSB_OFFSET_IPV4] = 0x55;
- m_sendBuffer3[SRC_ADDR_LSB_OFFSET_IPV4] = 0xF1;
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_TOS | IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.tos = 0xFF;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802FF;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_TOS | IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.tos = 0xAA;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_TOS | IPA_FLT_DST_ADDR | IPA_FLT_SRC_ADDR;
- rt_rule_entry->rule.attrib.u.v4.tos = 0x24;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A80255;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v4.src_addr = 0xC0A802F1;
- rt_rule_entry->rule.attrib.u.v4.src_addr_mask = 0xFFFFFFFF;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test5: IPv6 - Tests routing by destination address */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest5 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest5()
- {
- m_name = "IpaRoutingBlockTest5";
- m_description =" \
- Routing block test 005 - IPv6 Destination address exact match \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF \
- traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000AA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test6: IPv6 - Tests routing by destination address */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest006 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest006()
- {
- m_name = "IpaRoutingBlockTest006";
- m_description =" \
- Routing block test 006 - IPv6 Destination address Subnet match \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match 0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x0000000). \
- All DST_IP == 0X11020000 \
- 0x00000000 \
- 0x00000000 \
- 0X0000000C \
- traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == 0X22020000 \
- 0x00000000 \
- 0x00000000 \
- 0X0000000C \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_MSB_OFFSET_IPV6] = 0x11;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_MSB_OFFSET_IPV6] = 0x22;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // TODO: Header Insertion gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0X11020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X0000000C;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0x00000000;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // TODO: Header Insertion gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0X22020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X0000000C;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0x00000000;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test7: IPv6 - Tests routing by destination address */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest007 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest007()
- {
- m_name = "IpaRoutingBlockTest007";
- m_description = " \
- Routing block test 007 - IPv6 Exact Traffic Class Match \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All Traffic Class == 0xAA traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All Traffic Class == 0xBB traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[TRAFFIC_CLASS_MSB_OFFSET_IPV6] &= 0xF0;
- m_sendBuffer[TRAFFIC_CLASS_MSB_OFFSET_IPV6] |= 0x0A;
- m_sendBuffer[TRAFFIC_CLASS_LSB_OFFSET_IPV6] &= 0x0F;
- m_sendBuffer[TRAFFIC_CLASS_LSB_OFFSET_IPV6] |= 0xA0;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[TRAFFIC_CLASS_MSB_OFFSET_IPV6] &= 0xF0;
- m_sendBuffer2[TRAFFIC_CLASS_MSB_OFFSET_IPV6] |= 0x0B;
- m_sendBuffer2[TRAFFIC_CLASS_LSB_OFFSET_IPV6] &= 0x0F;
- m_sendBuffer2[TRAFFIC_CLASS_LSB_OFFSET_IPV6] |= 0xB0;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // TODO: Header Insertion gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_TC;
- rt_rule_entry->rule.attrib.u.v6.tc = 0xAA;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // TODO: Header Insertion gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_TC;
- rt_rule_entry->rule.attrib.u.v6.tc = 0xBB;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test8: IPv6 - Tests routing by destination address */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest008 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest008()
- {
- m_name = "IpaRoutingBlockTest008";
- m_description = " \
- Routing block test 008 - IPv6 Destination address exact match and Traffic Class Match \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All Traffic Class == 0xAA & IPv6 DST Addr 0xFF020000...00AA traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All Traffic Class == 0xBB & IPv6 DST Addr 0xFF020000...00BB traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[TRAFFIC_CLASS_MSB_OFFSET_IPV6] &= 0xF0;
- m_sendBuffer[TRAFFIC_CLASS_MSB_OFFSET_IPV6] |= 0x0A;
- m_sendBuffer[TRAFFIC_CLASS_LSB_OFFSET_IPV6] &= 0x0F;
- m_sendBuffer[TRAFFIC_CLASS_LSB_OFFSET_IPV6] |= 0xA0;
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[TRAFFIC_CLASS_MSB_OFFSET_IPV6] &= 0xF0;
- m_sendBuffer2[TRAFFIC_CLASS_MSB_OFFSET_IPV6] |= 0x0B;
- m_sendBuffer2[TRAFFIC_CLASS_LSB_OFFSET_IPV6] &= 0x0F;
- m_sendBuffer2[TRAFFIC_CLASS_LSB_OFFSET_IPV6] |= 0xB0;
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR | IPA_FLT_TC;
- rt_rule_entry->rule.attrib.u.v6.tc = 0xAA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR | IPA_FLT_TC;
- rt_rule_entry->rule.attrib.u.v6.tc = 0xBB;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000AA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test9: IPv6 - Tests routing by destination address */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest009 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest009()
- {
- m_name = "IpaRoutingBlockTest009";
- m_description = " \
- Routing block test 009 - IPv6 Exact Flow Label Match \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All Flow Label == 0xABCDE traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All Flow Label == 0x12345 traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[FLOW_CLASS_MSB_OFFSET_IPV6] &= 0xF0;
- m_sendBuffer[FLOW_CLASS_MSB_OFFSET_IPV6] |= 0x0A;
- m_sendBuffer[FLOW_CLASS_MB_OFFSET_IPV6] = 0xBC;
- m_sendBuffer[FLOW_CLASS_LSB_OFFSET_IPV6] = 0xDE;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[FLOW_CLASS_MSB_OFFSET_IPV6] &= 0xF0;
- m_sendBuffer2[FLOW_CLASS_MSB_OFFSET_IPV6] |= 0x01;
- m_sendBuffer2[FLOW_CLASS_MB_OFFSET_IPV6] = 0x23;
- m_sendBuffer2[FLOW_CLASS_LSB_OFFSET_IPV6] = 0x45;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_FLOW_LABEL;
- rt_rule_entry->rule.attrib.u.v6.flow_label = 0xABCDE;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_FLOW_LABEL;
- rt_rule_entry->rule.attrib.u.v6.flow_label = 0x12345;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test10: IPv4 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest010 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest010()
- {
- m_name = "IpaRoutingBlockTest10";
- m_description =" \
- Routing block test 010 - Destination address exact match non hashable priority higher than hashable \
- both match the packet but only non hashable should hit\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v3_0;
- Register(*this);
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool isSuccess = true;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Compare results */
- isSuccess &= CompareResultVsGolden(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= CompareResultVsGolden(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- isSuccess &= CompareResultVsGolden(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- print_packets(receivedSize, m_sendSize, recievedBufferSize, sentBufferSize, rxBuff1, m_sendBuffer, recievedBuffer, sentBuffer);
- print_packets(receivedSize2, m_sendSize2, recievedBufferSize, sentBufferSize, rxBuff2, m_sendBuffer2, recievedBuffer, sentBuffer);
- print_packets(receivedSize3, m_sendSize3, recievedBufferSize, sentBufferSize, rxBuff3, m_sendBuffer3, recievedBuffer, sentBuffer);
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return isSuccess;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test11: IPv4 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest011 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest011()
- {
- m_name = "IpaRoutingBlockTest011";
- m_description =" \
- Routing block test 011 - Destination address exact match hashable priority higher than non hashable \
- both match the packet but only hashable should hit, second packet should get cache hit\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v3_0;
- Register(*this);
- }
- bool Setup()
- {
- return IpaRoutingBlockTestFixture:: Setup(true);
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool isSuccess = true;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Compare results */
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize, receivedSize, rxBuff1) : IsCacheMiss(m_sendSize,receivedSize,rxBuff1);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheHit_v5_0(m_sendSize2, receivedSize2, rxBuff2) : IsCacheHit(m_sendSize2,receivedSize2,rxBuff2);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize3, receivedSize3, rxBuff3) : IsCacheMiss(m_sendSize3,receivedSize3,rxBuff3);
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- print_packets(receivedSize, m_sendSize, recievedBufferSize, sentBufferSize, rxBuff1, m_sendBuffer, recievedBuffer, sentBuffer);
- print_packets(receivedSize2, m_sendSize2, recievedBufferSize, sentBufferSize, rxBuff2, m_sendBuffer2, recievedBuffer, sentBuffer);
- print_packets(receivedSize3, m_sendSize3, recievedBufferSize, sentBufferSize, rxBuff3, m_sendBuffer3, recievedBuffer, sentBuffer);
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return isSuccess;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test12: IPv4 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest012 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest012()
- {
- m_name = "IpaRoutingBlockTest012";
- m_description =" \
- Routing block test 012 - Destination address exact match hashable priority lower than non hashable \
- no match on non hashable rule (with higher priority), match on hashable rule. two packets with\
- different tuple are sent (but match the rule) cache miss expected\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.171 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v3_0;
- Register(*this);
- }
- bool Setup()
- {
- return IpaRoutingBlockTestFixture:: Setup(true);
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AB; //192.168.02.171
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- unsigned short port;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- port = ntohs(547);//DHCP Client Port
- memcpy (&m_sendBuffer[IPV4_DST_PORT_OFFSET], &port, sizeof(port));
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- port = ntohs(546);//DHCP Client Port
- memcpy (&m_sendBuffer2[IPV4_DST_PORT_OFFSET], &port, sizeof(port));
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool isSuccess = true;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer2.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer2.m_fromChannelName.c_str());
- receivedSize2 = m_consumer2.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Compare results */
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize, receivedSize, rxBuff1) : IsCacheMiss(m_sendSize,receivedSize,rxBuff1);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize2, receivedSize2, rxBuff2) : IsCacheMiss(m_sendSize2,receivedSize2,rxBuff2);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize3, receivedSize3, rxBuff3) : IsCacheMiss(m_sendSize3,receivedSize3,rxBuff3);
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- print_packets(receivedSize, m_sendSize, recievedBufferSize, sentBufferSize, rxBuff1, m_sendBuffer, recievedBuffer, sentBuffer);
- print_packets(receivedSize2, m_sendSize2, recievedBufferSize, sentBufferSize, rxBuff2, m_sendBuffer2, recievedBuffer, sentBuffer);
- print_packets(receivedSize3, m_sendSize3, recievedBufferSize, sentBufferSize, rxBuff3, m_sendBuffer3, recievedBuffer, sentBuffer);
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return isSuccess;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test13: IPv4 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest013 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest013()
- {
- m_name = "IpaRoutingBlockTest013";
- m_description =" \
- Routing block test 013 - Destination address exact match \
- no match on non hashable rule (with lower priority), match on hashable rule. two packets with\
- different tuple are sent (but match the rule) cache miss expected\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.171 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v3_0;
- Register(*this);
- }
- bool Setup()
- {
- return IpaRoutingBlockTestFixture:: Setup(true);
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AB; //192.168.02.171
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- unsigned short port;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- port = ntohs(547);//DHCP Client Port
- memcpy (&m_sendBuffer[IPV4_DST_PORT_OFFSET], &port, sizeof(port));
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- port = ntohs(546);//DHCP Client Port
- memcpy (&m_sendBuffer2[IPV4_DST_PORT_OFFSET], &port, sizeof(port));
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool isSuccess = true;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Compare results */
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize, receivedSize, rxBuff1) : IsCacheMiss(m_sendSize,receivedSize,rxBuff1);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize2, receivedSize2, rxBuff2) : IsCacheMiss(m_sendSize2,receivedSize2,rxBuff2);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize3, receivedSize3, rxBuff3) : IsCacheMiss(m_sendSize3,receivedSize3,rxBuff3);
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- print_packets(receivedSize, m_sendSize, recievedBufferSize, sentBufferSize, rxBuff1, m_sendBuffer, recievedBuffer, sentBuffer);
- print_packets(receivedSize2, m_sendSize2, recievedBufferSize, sentBufferSize, rxBuff2, m_sendBuffer2, recievedBuffer, sentBuffer);
- print_packets(receivedSize3, m_sendSize3, recievedBufferSize, sentBufferSize, rxBuff3, m_sendBuffer3, recievedBuffer, sentBuffer);
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return isSuccess;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test14: IPv4 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest014 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest014()
- {
- m_name = "IpaRoutingBlockTest014";
- m_description =" \
- Routing block test 014 - Destination address exact match \
- no match on non hashable rule(with higher priority) , match on hashable rule. two identical\
- packets are sent cache hit expected on the second one\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.168.2.171 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v3_0;
- Register(*this);
- }
- bool Setup()
- {
- return IpaRoutingBlockTestFixture:: Setup(true);
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AB; //192.168.02.171
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- free(rt_rule);
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool isSuccess = true;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer2.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer2.m_fromChannelName.c_str());
- receivedSize2 = m_consumer2.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Compare results */
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize, receivedSize, rxBuff1) : IsCacheMiss(m_sendSize,receivedSize,rxBuff1);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheHit_v5_0(m_sendSize2, receivedSize2, rxBuff2) : IsCacheHit(m_sendSize2,receivedSize2,rxBuff2);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize3, receivedSize3, rxBuff3) : IsCacheMiss(m_sendSize3,receivedSize3,rxBuff3);
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- print_packets(receivedSize, m_sendSize, recievedBufferSize, sentBufferSize, rxBuff1, m_sendBuffer, recievedBuffer, sentBuffer);
- print_packets(receivedSize2, m_sendSize2, recievedBufferSize, sentBufferSize, rxBuff2, m_sendBuffer2, recievedBuffer, sentBuffer);
- print_packets(receivedSize3, m_sendSize3, recievedBufferSize, sentBufferSize, rxBuff3, m_sendBuffer3, recievedBuffer, sentBuffer);
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return isSuccess;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test15: IPv4 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest015 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest015()
- {
- m_name = "IpaRoutingBlockTest015";
- m_description =" \
- Routing block test 015 - Destination address exact match \
- no match on non hashable rule(with lower priority) , match on hashable rule. two identical\
- packets are sent cache hit expected on the second one\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.171 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v3_0;
- Register(*this);
- }
- bool Setup()
- {
- return IpaRoutingBlockTestFixture:: Setup(true);
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AB; //192.168.02.171
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- for (int i = 0; i < rt_rule->num_rules; i++) {
- uRtRuleHdl[i] = rt_rule->rules[i].rt_rule_hdl;
- }
- uNumRtRules = rt_rule->num_rules;
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool RemoveLastRule(enum ipa_ip_type ipType)
- {
- struct ipa_ioc_del_rt_rule *ruleTable;
- ruleTable = (struct ipa_ioc_del_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_del_rt_rule) +
- sizeof(struct ipa_rt_rule_del));
- ruleTable->commit = 1;
- ruleTable->ip = ipType;
- ruleTable->num_hdls = 1;
- ruleTable->hdl[0].hdl = uRtRuleHdl[uNumRtRules - 1];
- ruleTable->hdl[0].status = 0;
- if (false == m_routing.DeleteRoutingRule(ruleTable))
- {
- printf("Routing rule deletion failed!\n");
- return false;
- }
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool isSuccess = true;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Compare results */
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize, receivedSize, rxBuff1) : IsCacheMiss(m_sendSize,receivedSize,rxBuff1);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheHit_v5_0(m_sendSize2, receivedSize2, rxBuff2) : IsCacheHit(m_sendSize2,receivedSize2,rxBuff2);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize3, receivedSize3, rxBuff3) : IsCacheMiss(m_sendSize3,receivedSize3,rxBuff3);
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- print_packets(receivedSize, m_sendSize, recievedBufferSize, sentBufferSize, rxBuff1, m_sendBuffer, recievedBuffer, sentBuffer);
- print_packets(receivedSize2, m_sendSize2, recievedBufferSize, sentBufferSize, rxBuff2, m_sendBuffer2, recievedBuffer, sentBuffer);
- print_packets(receivedSize3, m_sendSize3, recievedBufferSize, sentBufferSize, rxBuff3, m_sendBuffer3, recievedBuffer, sentBuffer);
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return isSuccess;
- }
- bool ReceivePacketsAndCompareSpecial()
- {
- size_t receivedSize = 0;
- bool isSuccess = true;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- if (NULL == rxBuff1)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- /* Compare results */
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize, receivedSize, rxBuff1) : IsCacheMiss(m_sendSize,receivedSize,rxBuff1);
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- size_t j;
- for(j = 0; j < m_sendSize; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - 3 * j,
- " %02X", m_sendBuffer[j]);
- for(j = 0; j < receivedSize; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - 3 * j,
- " %02X", rxBuff1[j]);
- printf("Expected Value1 (%zu)\n%s\n, Received Value1(%zu)\n%s\n",m_sendSize,sentBuffer,receivedSize,recievedBuffer);
- delete[] rxBuff1;
- return isSuccess;
- }
- protected:
- uint32_t uRtRuleHdl[3];
- uint8_t uNumRtRules;
- };
- /*--------------------------------------------------------------------------*/
- /* Test16: IPv4 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest016 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest016()
- {
- m_name = "IpaRoutingBlockTest016";
- m_description =" \
- Routing block test 016 - Destination address exact match max priority for non hashable \
- match on both rule, non hashable rule should win because max priority\
- packets are sent. No cache hit is expected\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v3_0;
- Register(*this);
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry->rule.max_prio = 1; // max priority
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool isSuccess = true;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer2.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer2.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Compare results */
- isSuccess &= CompareResultVsGolden(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= CompareResultVsGolden(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- isSuccess &= CompareResultVsGolden(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- print_packets(receivedSize, m_sendSize, recievedBufferSize, sentBufferSize, rxBuff1, m_sendBuffer, recievedBuffer, sentBuffer);
- print_packets(receivedSize2, m_sendSize2, recievedBufferSize, sentBufferSize, rxBuff2, m_sendBuffer2, recievedBuffer, sentBuffer);
- print_packets(receivedSize3, m_sendSize3, recievedBufferSize, sentBufferSize, rxBuff3, m_sendBuffer3, recievedBuffer, sentBuffer);
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return isSuccess;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test17: IPv4 - Tests routing hashable, non hashable, */
- /* cache/hash invalidation test on rule addition */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest017 : public IpaRoutingBlockTest015
- {
- public:
- IpaRoutingBlockTest017()
- {
- m_name = "IpaRoutingBlockTest017";
- m_description =" \
- Routing block test 017 - this test perform test 015 and then commits another rule\
- another identical packet is sent: DST_IP == 192.168.02.170 and expected to get cache miss";
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- if (false == isSuccess)
- {
- printf("ReceivePacketsAndCompare failure.\n");
- return false;
- }
- // until here test 15 was run, now we test hash invalidation
- // commit the rules again to clear the cache
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // send the packet again
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // validate we got cache miss
- isSuccess = ReceivePacketsAndCompareSpecial();
- if (false == isSuccess)
- {
- printf("ReceivePacketsAndCompareSpecial failure.\n");
- }
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test18: IPv4 - Tests routing hashable, non hashable, */
- /* cache/hash invalidation test on rule delition */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest018 : public IpaRoutingBlockTest015
- {
- public:
- IpaRoutingBlockTest018()
- {
- m_name = "IpaRoutingBlockTest018";
- m_description =" \
- Routing block test 018 - this test perform test 015 and then removes last rule\
- another identical packet is sent: DST_IP == 192.168.02.170 and expected to get cache miss";
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- if (false == isSuccess)
- {
- printf("ReceivePacketsAndCompare failure.\n");
- return false;
- }
- // until here test 15 was run, now we test hash invalidation
- // delete the last rule, this should clear the cache
- res = RemoveLastRule(IPA_IP_v4);
- if (false == res) {
- printf("Failed removing filtering rules.\n");
- return false;
- }
- // send the packet again
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // validate we got cache miss
- isSuccess = ReceivePacketsAndCompareSpecial();
- if (false == isSuccess)
- {
- printf("ReceivePacketsAndCompareSpecial failure.\n");
- }
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test20: IPv6 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest020 : public IpaRoutingBlockTest010
- {
- public:
- IpaRoutingBlockTest020()
- {
- m_name = "IpaRoutingBlockTest20";
- m_description =" \
- Routing block test 020 - Destination address exact match non hashable priority higher than hashable \
- both match the packet but only non hashable should hit\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF \
- traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v3_0;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.hashable = 0; // non hashable
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- free(rt_rule);
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test21: IPv6 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest021 : public IpaRoutingBlockTest011
- {
- public:
- IpaRoutingBlockTest021()
- {
- m_name = "IpaRoutingBlockTest021";
- m_description =" \
- Routing block test 021 - Destination address exact match hashable priority higher than non hashable \
- both match the packet but only hashable should hit, second packet should get cache hit\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF - hashable\
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF - non hahsable \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v3_0;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.hashable = 0; // non hashable
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- free(rt_rule);
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test22: IPv6 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest022 : public IpaRoutingBlockTest012
- {
- public:
- IpaRoutingBlockTest022()
- {
- m_name = "IpaRoutingBlockTest022";
- m_description =" \
- Routing block test 022 - Destination address exact match hashable priority higher than non hashable \
- no match on non hashable rule (with higher priority), match on hashable rule. two packets with\
- different tuple are sent (but match the rule) cache miss expected\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000AA - non hashable\
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF - hahsable \
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v3_0;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000AA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.hashable = 0; // non hashable
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- free(rt_rule);
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- unsigned short port;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- port = ntohs(546);//DHCP Client Port
- memcpy (&m_sendBuffer[IPV6_DST_PORT_OFFSET], &port, sizeof(port));
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- port = ntohs(547);//DHCP Client Port
- memcpy (&m_sendBuffer2[IPV6_DST_PORT_OFFSET], &port, sizeof(port));
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test23: IPv6 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest023 : public IpaRoutingBlockTest013
- {
- public:
- IpaRoutingBlockTest023()
- {
- m_name = "IpaRoutingBlockTest023";
- m_description =" \
- Routing block test 023 - Destination address exact match \
- no match on non hashable rule (with lower priority), match on hashable rule. two packets with\
- different tuple are sent (but match the rule) cache miss expected\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF - hashable\
- traffic goes to pipe IPA_CLIENT_TEST2_CONS\
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000AA - non hahsable \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v3_0;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000AA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.hashable = 0; // non hashable
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- free(rt_rule);
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- unsigned short port;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- port = ntohs(546);//DHCP Client Port
- memcpy (&m_sendBuffer[IPV6_DST_PORT_OFFSET], &port, sizeof(port));
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- port = ntohs(547);//DHCP Client Port
- memcpy (&m_sendBuffer2[IPV6_DST_PORT_OFFSET], &port, sizeof(port));
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test24: IPv6 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest024 : public IpaRoutingBlockTest014
- {
- public:
- IpaRoutingBlockTest024()
- {
- m_name = "IpaRoutingBlockTest024";
- m_description =" \
- Routing block test 024 - Destination address exact match \
- no match on non hashable rule(with higher priority) , match on hashable rule. two identical\
- packets are sent cache hit expected on the second one\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000AA - non hashable\
- traffic goes to pipe IPA_CLIENT_TEST2_CONS\
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF - hahsable \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v3_0;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000AA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.hashable = 0; // non hashable
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- free(rt_rule);
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test25: IPv6 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest025 : public IpaRoutingBlockTest015
- {
- public:
- IpaRoutingBlockTest025()
- {
- m_name = "IpaRoutingBlockTest025";
- m_description =" \
- Routing block test 025 - Destination address exact match \
- no match on non hashable rule(with lower priority) , match on hashable rule. two identical\
- packets are sent cache hit expected on the second one\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF - hashable\
- traffic goes to pipe IPA_CLIENT_TEST2_CONS\
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000AA - non hahsable \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v3_0;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000AA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.hashable = 0; // non hashable
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- free(rt_rule);
- return false;
- }
- for (int i = 0; i < rt_rule->num_rules; i++) {
- uRtRuleHdl[i] = rt_rule->rules[i].rt_rule_hdl;
- }
- uNumRtRules = rt_rule->num_rules;
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test26: IPv6 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest026 : public IpaRoutingBlockTest016
- {
- public:
- IpaRoutingBlockTest026()
- {
- m_name = "IpaRoutingBlockTest026";
- m_description =" \
- Routing block test 026 - Destination address exact match max priority for non hashable \
- match on both rule, non hashable rule should win because max priority\
- packets are sent cache hit expected on the second one\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF - hashable\
- traffic goes to pipe IPA_CLIENT_TEST2_CONS\
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF - non hahsable max prio \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v3_0;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry->rule.max_prio = 1; // max prio
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.hashable = 0; // non hashable
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- free(rt_rule);
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test27: IPv6 - Tests routing hashable, non hashable, */
- /* cache/hash invalidation test on rule addition */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest027 : public IpaRoutingBlockTest025
- {
- public:
- IpaRoutingBlockTest027()
- {
- m_name = "IpaRoutingBlockTest027";
- m_description =" \
- Routing block test 027 - this test perform test 025 and then commits another rule\
- another identical packet is sent: DST_IP == 192.168.02.170 and expected to get cache miss";
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- if (false == isSuccess)
- {
- printf("ReceivePacketsAndCompare failure.\n");
- return false;
- }
- // until here test 25 was run, now we test hash invalidation
- // commit the rules again to clear the cache
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // send the packet again
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // validate we got cache miss
- isSuccess = ReceivePacketsAndCompareSpecial();
- if (false == isSuccess)
- {
- printf("ReceivePacketsAndCompareSpecial failure.\n");
- }
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test28: IPv6 - Tests routing hashable, non hashable, */
- /* cache/hash invalidation test on rule delition */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest028 : public IpaRoutingBlockTest025
- {
- public:
- IpaRoutingBlockTest028()
- {
- m_name = "IpaRoutingBlockTest028";
- m_description =" \
- Routing block test 028 - this test perform test 025 and then deletes last rule\
- another identical packet is sent: DST_IP == 192.168.02.170 and expected to get cache miss";
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- if (false == isSuccess)
- {
- printf("ReceivePacketsAndCompare failure.\n");
- return false;
- }
- // until here test 25 was run, now we test hash invalidation
- // delete the last rule, this should clear the cache
- res = RemoveLastRule(IPA_IP_v6);
- if (false == res) {
- printf("Failed removing filtering rules.\n");
- return false;
- }
- // send the packet again
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // validate we got cache miss
- isSuccess = ReceivePacketsAndCompareSpecial();
- if (false == isSuccess)
- {
- printf("ReceivePacketsAndCompareSpecial failure.\n");
- }
- return isSuccess;
- } // Run()
- };
- /*--------------------------------------------------------------------------*/
- /* Test30: Pure ack packet matching */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest030 : IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest030()
- {
- m_name = "IpaRoutingBlockTest030";
- m_description =" \
- Routing block test 030 - Pure Ack packet matching \
- 1. Generate and commit a single routing table. \
- 2. Generate and commit Three routing rules: \
- All TCP pure ack traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.200 & 255.255.255.255) traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v4_5;
- Register(*this);
- }
- bool LoadPackets()
- {
- if (!LoadNoPayloadPacket(m_IpaIPType, m_sendBuffer, m_sendSize)) {
- LOG_MSG_ERROR("Failed loading No Payload Packet");
- return false;
- }
- if (!LoadDefaultPacket(m_IpaIPType, m_sendBuffer2, m_sendSize2)) {
- LOG_MSG_ERROR("Failed loading default Packet");
- return false;
- }
- if (!LoadDefaultPacket(m_IpaIPType, m_sendBuffer3, m_sendSize3)) {
- LOG_MSG_ERROR("Failed loading default Packet");
- return false;
- }
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load IP packets
- res = LoadPackets();
- if (false == res) {
- printf("Failed loading packets\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[IPv4_TCP_FLAGS_OFFSET] |= TCP_ACK_FLAG_MASK;
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xC8;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[IPv4_TCP_FLAGS_OFFSET] |= TCP_ACK_FLAG_MASK;
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xC8;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- m_sendBuffer3[IPv4_TCP_FLAGS_OFFSET] |= TCP_ACK_FLAG_MASK;
- m_sendBuffer3[DST_ADDR_LSB_OFFSET_IPV4] = 0x64;
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_IS_PURE_ACK;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802C8;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test31: IPv6 Pure ack packet matching */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest031 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest031()
- {
- m_name = "IpaRoutingBlockTest031";
- m_description =" \
- Routing block test 031 - IPv6 Pure Ack packet matching \
- 1. Generate and commit a single routing table. \
- 2. Generate and commit Three routing rules: \
- All TCP pure ack traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000F5 \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS \
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v4_5;
- Register(*this);
- }
- bool LoadPackets()
- {
- if (!LoadNoPayloadPacket(m_IpaIPType, m_sendBuffer, m_sendSize)) {
- LOG_MSG_ERROR("Failed loading No Payload Packet");
- return false;
- }
- if (!LoadNoPayloadPacket(m_IpaIPType, m_sendBuffer2, m_sendSize2)) {
- LOG_MSG_ERROR("Failed loading default Packet");
- return false;
- }
- if (!LoadNoPayloadPacket(m_IpaIPType, m_sendBuffer3, m_sendSize3)) {
- LOG_MSG_ERROR("Failed loading default Packet");
- return false;
- }
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet)
- res = LoadPackets();
- if (false == res) {
- printf("Failed loading packets\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xF5;
- m_sendBuffer[IPv6_TCP_FLAGS_OFFSET] |= TCP_ACK_FLAG_MASK;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xF5;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- NUM_RULES*sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &rt_rule->rules[0];
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_IS_PURE_ACK;
- rt_rule_entry = &rt_rule->rules[1];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000F5;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry = &rt_rule->rules[2];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test100: Cache LRU behavior test */
- /*---------------------------------------------------------------------------*/
- #define CHACHE_ENTRIES 64
- #define CHACHE_PLUS_ONE (CHACHE_ENTRIES +1)
- class IpaRoutingBlockTest040 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest040()
- {
- m_name = "IpaRoutingBlockTest040";
- m_description = " \
- Routing block test 40 - Cache LRU behavior test \
- 1. Preload the cache by sending 64 packets for different connections \
- 2. Send another packet for 65th connection \
- 3. Send packets for first 64 connections \
- 4. Verify that 1st connections entry was reclaimed";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v4_0;
- Register(*this);
- }
- bool Setup()
- {
- return IpaRoutingBlockTestFixture:: Setup(true);
- }
- virtual bool AddRules()
- {
- struct ipa_ioc_add_rt_rule *rt_rule;
- struct ipa_rt_rule_add *rt_rule_entry;
- printf("Entering %s, %s()\n", __FUNCTION__, __FILE__);
- rt_rule = (struct ipa_ioc_add_rt_rule *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
- CHACHE_PLUS_ONE * sizeof(struct ipa_rt_rule_add));
- if(!rt_rule) {
- printf("Failed memory allocation for rt_rule\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = CHACHE_PLUS_ONE;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- for (int i = 0; i < CHACHE_PLUS_ONE; i++) {
- rt_rule_entry = &rt_rule->rules[i];
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A80101 + i; // DST_IP == 192.168.1.(1+i)
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1;
- }
- // The last rule has to be catch all, otherwize no rule will work
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0x0;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- printf("Leaving %s, %s()\n",__FUNCTION__, __FILE__);
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- printf("Entering %s, %s()\n", __FUNCTION__, __FILE__);
- // Add the relevant filtering rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding filtering rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send the first CHACHE_ENTRIES packets
- // Receive packets from the channels and compare results
- // All rules should be cache miss
- for (int i = 0; i < CHACHE_ENTRIES; i++) {
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0x1 + i;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- isSuccess = ReceivePacketAndCompareFrom(m_consumer, m_sendBuffer, m_sendSize, false);
- if (false == isSuccess) {
- printf("%s:%d: ReceivePacketAndCompareFrom failure.\n", __FUNCTION__, __LINE__);
- return false;
- }
- }
- // Send again the first CHACHE_ENTRIES packets
- // Receive packets from the channels and compare results
- // All rules should be cache hit
- for (int i = 0; i < CHACHE_ENTRIES; i++) {
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0x1 + i;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- isSuccess = ReceivePacketAndCompareFrom(m_consumer, m_sendBuffer, m_sendSize, true);
- if (false == isSuccess) {
- printf("%s:%d: ReceivePacketAndCompareFrom failure.\n", __FUNCTION__, __LINE__);
- return false;
- }
- }
- // Send a packet to a new filter entry, this should trigger the LRU clear
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0x1 + CHACHE_ENTRIES;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess) {
- printf("SendData failure.\n");
- return false;
- }
- // receive and verify that cache was missed
- isSuccess = ReceivePacketAndCompareFrom(m_consumer, m_sendBuffer, m_sendSize, false);
- if (false == isSuccess) {
- printf("%s:%d: ReceivePacketAndCompareFrom failure.\n", __FUNCTION__, __LINE__);
- return false;
- }
- // send the first packet again
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0x1;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess) {
- printf("SendData failure.\n");
- return false;
- }
- // receive and verify that cache was missed
- isSuccess = ReceivePacketAndCompareFrom(m_consumer, m_sendBuffer, m_sendSize, false);
- if (false == isSuccess) {
- printf("%s:%d: ReceivePacketAndCompareFrom failure.\n", __FUNCTION__, __LINE__);
- return false;
- }
- printf("Leaving %s, %s(), Returning %d\n",__FUNCTION__, __FILE__, isSuccess);
- return isSuccess;
- } // Run()
- };
- /*---------------------------------------------------------------------------*/
- /* Test50: Test TTL update by routing to a destination address */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest050 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest050()
- {
- m_name = "IpaRoutingBlockTest050";
- m_description =" \
- Routing block test 050 - Destination address exact match\1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.169.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.255 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS \
- 3. Check if TTL is updated. ";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v5_5;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xFF;
- m_sendBuffer[IPV4_TTL_OFFSET] = 5;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- m_sendBuffer2[IPV4_TTL_OFFSET] = 4;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- m_sendBuffer3[IPV4_TTL_OFFSET] = 3;
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool pkt1_cmp_succ, pkt2_cmp_succ, pkt3_cmp_succ;
- uint16_t csum = 0;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- memset(rxBuff1, 0, 0x400);
- memset(rxBuff2, 0, 0x400);
- memset(rxBuff3, 0, 0x400);
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer2.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Update TTL values. */
- m_sendBuffer[IPV4_TTL_OFFSET] = 4;
- m_sendBuffer2[IPV4_TTL_OFFSET] = 3;
- /* Update Checksum.*/
- csum = *((uint16_t *)(m_sendBuffer + IPV4_CSUM_OFFSET));
- csum += 1;
- *((uint16_t *)(m_sendBuffer+ IPV4_CSUM_OFFSET)) = csum;
- csum = *((uint16_t *)(m_sendBuffer2 + IPV4_CSUM_OFFSET));
- csum += 1;
- *((uint16_t *)(m_sendBuffer2 + IPV4_CSUM_OFFSET)) = csum;
- /* Compare results */
- pkt1_cmp_succ = CompareResultVsGolden(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- pkt2_cmp_succ = CompareResultVsGolden(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- pkt3_cmp_succ = CompareResultVsGolden(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- size_t recievedBufferSize =
- MAX3(receivedSize, receivedSize2, receivedSize3) * 3;
- size_t sentBufferSize =
- MAX3(m_sendSize, m_sendSize2, m_sendSize3) * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- if (NULL == recievedBuffer || NULL == sentBuffer) {
- printf("Memory allocation error\n");
- return false;
- }
- size_t j;
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer[j]);
- for(j = 0; j < receivedSize; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff1[j]);
- printf("Expected Value1(%zu)\n%s\n, Received Value1(%zu)\n%s\n-->Value1 %s\n",
- m_sendSize,sentBuffer,receivedSize,recievedBuffer,
- pkt1_cmp_succ?"Match":"no Match");
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize2; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer2[j]);
- for(j = 0; j < receivedSize2; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff2[j]);
- printf("Expected Value2 (%zu)\n%s\n, Received Value2(%zu)\n%s\n-->Value2 %s\n",
- m_sendSize2,sentBuffer,receivedSize2,recievedBuffer,
- pkt2_cmp_succ?"Match":"no Match");
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize3; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer3[j]);
- for(j = 0; j < receivedSize3; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff3[j]);
- printf("Expected Value3 (%zu)\n%s\n, Received Value3(%zu)\n%s\n-->Value3 %s\n",
- m_sendSize3,sentBuffer,receivedSize3,recievedBuffer,
- pkt3_cmp_succ?"Match":"no Match");
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return pkt1_cmp_succ && pkt2_cmp_succ && pkt3_cmp_succ;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule_v2 *rt_rule;
- struct ipa_rt_rule_add_v2 *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule_v2 *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule_v2));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->rules = (uint64_t)calloc(3, sizeof(struct ipa_rt_rule_add_v2));
- if(!rt_rule->rules) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[0]);
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802FF;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.ttl_update = 1;
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[1]);
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.ttl_update = 1;
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[2]);
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.ttl_update = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*--------------------------------------------------------------------------*/
- /* Test51: IPv4 - Tests routing hashable vs non hashable priorities */
- /*--------------------------------------------------------------------------*/
- class IpaRoutingBlockTest051 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest051()
- {
- m_name = "IpaRoutingBlockTest051";
- m_description =" \
- Routing block test 051 - Destination address exact match hashable priority higher than non hashable \
- both match the packet but only hashable should hit, second packet should get cache hit, \
- Check if TTL is updated.\
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == (192.168.2.170 & 255.255.255.255)traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS \
- 3. Check if TTL is updated.";
- m_IpaIPType = IPA_IP_v4;
- m_minIPAHwType = IPA_HW_v5_5;
- Register(*this);
- }
- bool Setup()
- {
- return IpaRoutingBlockTestFixture:: Setup(true);
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule_v2 *rt_rule;
- struct ipa_rt_rule_add_v2 *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule_v2 *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule_v2));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->rules = (uint64_t)calloc(3, sizeof(struct ipa_rt_rule_add_v2));
- if(!rt_rule->rules) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[0]);
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 1; // hashable
- rt_rule_entry->rule.ttl_update = 1; // TTL Update
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[1]);
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA; //192.168.02.170
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.hashable = 0; // non hashable
- rt_rule_entry->rule.ttl_update = 1; // TTL Update
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[2]);
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.ttl_update = 0; // TTL Update
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v4);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- m_sendBuffer[IPV4_TTL_OFFSET] = 5;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV4] = 0xAA;
- m_sendBuffer2[IPV4_TTL_OFFSET] = 4;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize2);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- m_sendBuffer3[IPV4_TTL_OFFSET] = 3;
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool isSuccess = true;
- uint16_t csum = 0;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Update TTL values. */
- m_sendBuffer[IPV4_TTL_OFFSET] = 4;
- m_sendBuffer2[IPV4_TTL_OFFSET] = 3;
- /* Update Checksum.*/
- csum = *((uint16_t *)(m_sendBuffer + IPV4_CSUM_OFFSET));
- csum += 1;
- *((uint16_t *)(m_sendBuffer+ IPV4_CSUM_OFFSET)) = csum;
- csum = *((uint16_t *)(m_sendBuffer2 + IPV4_CSUM_OFFSET));
- csum += 1;
- *((uint16_t *)(m_sendBuffer2 + IPV4_CSUM_OFFSET)) = csum;
- /* Compare results */
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- isSuccess &= CompareResultVsGolden_w_Status(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize, receivedSize, rxBuff1) : IsCacheMiss(m_sendSize,receivedSize,rxBuff1);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheHit_v5_0(m_sendSize2, receivedSize2, rxBuff2) : IsCacheHit(m_sendSize2,receivedSize2,rxBuff2);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_0) ?
- IsCacheMiss_v5_0(m_sendSize3, receivedSize3, rxBuff3) : IsCacheMiss(m_sendSize3,receivedSize3,rxBuff3);
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_5) ?
- IsTTLUpdated_v5_5(m_sendSize, receivedSize, rxBuff1) : true;
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_5) ?
- IsTTLUpdated_v5_5(m_sendSize2, receivedSize2, rxBuff2) : true;
- isSuccess &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_5) ?
- !IsTTLUpdated_v5_5(m_sendSize3, receivedSize3, rxBuff3) : true;
- size_t recievedBufferSize = receivedSize * 3;
- size_t sentBufferSize = m_sendSize * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- print_packets(receivedSize, m_sendSize, recievedBufferSize, sentBufferSize, rxBuff1, m_sendBuffer, recievedBuffer, sentBuffer);
- print_packets(receivedSize2, m_sendSize2, recievedBufferSize, sentBufferSize, rxBuff2, m_sendBuffer2, recievedBuffer, sentBuffer);
- print_packets(receivedSize3, m_sendSize3, recievedBufferSize, sentBufferSize, rxBuff3, m_sendBuffer3, recievedBuffer, sentBuffer);
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return isSuccess;
- }
- };
- /*---------------------------------------------------------------------------*/
- /* Test52: IPv6 - Test TTL update by routing to destination address */
- /*---------------------------------------------------------------------------*/
- class IpaRoutingBlockTest052 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest052()
- {
- m_name = "IpaRoutingBlockTest052";
- m_description =" \
- Routing block test 052 - IPv6 Destination address exact match and check if TTL is updated \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF \
- traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS \
- 3. Check if TTL is updated.";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v5_5;
- Register(*this);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- m_sendBuffer[HOP_LIMIT_OFFSET_IPV6] = 5;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
- m_sendBuffer2[HOP_LIMIT_OFFSET_IPV6] = 4;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- m_sendBuffer3[HOP_LIMIT_OFFSET_IPV6] = 3;
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool pkt1_cmp_succ, pkt2_cmp_succ, pkt3_cmp_succ;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- memset(rxBuff1, 0, 0x400);
- memset(rxBuff2, 0, 0x400);
- memset(rxBuff3, 0, 0x400);
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer2.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Update TTL values. */
- m_sendBuffer[HOP_LIMIT_OFFSET_IPV6] = 4;
- m_sendBuffer2[HOP_LIMIT_OFFSET_IPV6] = 3;
- /* Compare results */
- pkt1_cmp_succ = CompareResultVsGolden(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- pkt2_cmp_succ = CompareResultVsGolden(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- pkt3_cmp_succ = CompareResultVsGolden(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- size_t recievedBufferSize =
- MAX3(receivedSize, receivedSize2, receivedSize3) * 3;
- size_t sentBufferSize =
- MAX3(m_sendSize, m_sendSize2, m_sendSize3) * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- if (NULL == recievedBuffer || NULL == sentBuffer) {
- printf("Memory allocation error\n");
- return false;
- }
- size_t j;
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer[j]);
- for(j = 0; j < receivedSize; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff1[j]);
- printf("Expected Value1(%zu)\n%s\n, Received Value1(%zu)\n%s\n-->Value1 %s\n",
- m_sendSize,sentBuffer,receivedSize,recievedBuffer,
- pkt1_cmp_succ?"Match":"no Match");
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize2; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer2[j]);
- for(j = 0; j < receivedSize2; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff2[j]);
- printf("Expected Value2 (%zu)\n%s\n, Received Value2(%zu)\n%s\n-->Value2 %s\n",
- m_sendSize2,sentBuffer,receivedSize2,recievedBuffer,
- pkt2_cmp_succ?"Match":"no Match");
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize3; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer3[j]);
- for(j = 0; j < receivedSize3; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff3[j]);
- printf("Expected Value3 (%zu)\n%s\n, Received Value3(%zu)\n%s\n-->Value3 %s\n",
- m_sendSize3,sentBuffer,receivedSize3,recievedBuffer,
- pkt3_cmp_succ?"Match":"no Match");
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return pkt1_cmp_succ && pkt2_cmp_succ && pkt3_cmp_succ;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule_v2 *rt_rule;
- struct ipa_rt_rule_add_v2 *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule_v2 *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule_v2));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->rules = (uint64_t)calloc(3, sizeof(struct ipa_rt_rule_add_v2));
- if(!rt_rule->rules) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[0]);
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.ttl_update = 1; // TTL Update
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[1]);
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000AA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.ttl_update = 1; // TTL Update
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[2]);
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.ttl_update = 0; // TTL Update
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- /*---------------------------------------------------------------------------------------*/
- /* Test53: IPv6 - Test TTL update by routing to destination address and check for status */
- /*---------------------------------------------------------------------------------------*/
- class IpaRoutingBlockTest053 : public IpaRoutingBlockTestFixture
- {
- public:
- IpaRoutingBlockTest053()
- {
- m_name = "IpaRoutingBlockTest053";
- m_description =" \
- Routing block test 053 - IPv6 Destination address exact match and check if TTL is updated \
- 1. Generate and commit a single routing tables. \
- 2. Generate and commit Three routing rules: (DST & Mask Match). \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF \
- traffic goes to pipe IPA_CLIENT_TEST2_CONS \
- All DST_IP == 0XFF020000 \
- 0x00000000 \
- 0x00000000 \
- 0X000000FF \
- traffic goes to pipe IPA_CLIENT_TEST3_CONS\
- All other traffic goes to pipe IPA_CLIENT_TEST4_CONS \
- 3. Check if TTL is updated and also the status has TTL bit updated.";
- m_IpaIPType = IPA_IP_v6;
- m_minIPAHwType = IPA_HW_v5_5;
- Register(*this);
- }
- bool Setup()
- {
- return IpaRoutingBlockTestFixture:: Setup(true);
- }
- bool Run()
- {
- bool res = false;
- bool isSuccess = false;
- // Add the relevant routing rules
- res = AddRules();
- if (false == res) {
- printf("Failed adding routing rules.\n");
- return false;
- }
- // Load input data (IP packet) from file
- res = LoadFiles(IPA_IP_v6);
- if (false == res) {
- printf("Failed loading files.\n");
- return false;
- }
- // Send first packet
- m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xFF;
- m_sendBuffer[HOP_LIMIT_OFFSET_IPV6] = 5;
- isSuccess = m_producer.SendData(m_sendBuffer, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send second packet
- m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
- m_sendBuffer2[HOP_LIMIT_OFFSET_IPV6] = 4;
- isSuccess = m_producer.SendData(m_sendBuffer2, m_sendSize);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Send third packet
- m_sendBuffer3[HOP_LIMIT_OFFSET_IPV6] = 3;
- isSuccess = m_producer.SendData(m_sendBuffer3, m_sendSize3);
- if (false == isSuccess)
- {
- printf("SendData failure.\n");
- return false;
- }
- // Receive packets from the channels and compare results
- isSuccess = ReceivePacketsAndCompare();
- return isSuccess;
- } // Run()
- bool ReceivePacketsAndCompare()
- {
- size_t receivedSize = 0;
- size_t receivedSize2 = 0;
- size_t receivedSize3 = 0;
- bool pkt1_cmp_succ, pkt2_cmp_succ, pkt3_cmp_succ;
- // Receive results
- Byte *rxBuff1 = new Byte[0x400];
- Byte *rxBuff2 = new Byte[0x400];
- Byte *rxBuff3 = new Byte[0x400];
- if (NULL == rxBuff1 || NULL == rxBuff2 || NULL == rxBuff3)
- {
- printf("Memory allocation error.\n");
- return false;
- }
- memset(rxBuff1, 0, 0x400);
- memset(rxBuff2, 0, 0x400);
- memset(rxBuff3, 0, 0x400);
- receivedSize = m_consumer.ReceiveData(rxBuff1, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize, m_consumer.m_fromChannelName.c_str());
- receivedSize2 = m_consumer2.ReceiveData(rxBuff2, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize2, m_consumer2.m_fromChannelName.c_str());
- receivedSize3 = m_defaultConsumer.ReceiveData(rxBuff3, 0x400);
- printf("Received %zu bytes on %s.\n", receivedSize3, m_defaultConsumer.m_fromChannelName.c_str());
- /* Update TTL values. */
- m_sendBuffer[HOP_LIMIT_OFFSET_IPV6] = 4;
- m_sendBuffer2[HOP_LIMIT_OFFSET_IPV6] = 3;
- /* Compare results */
- pkt1_cmp_succ = CompareResultVsGolden_w_Status(m_sendBuffer, m_sendSize, rxBuff1, receivedSize);
- pkt2_cmp_succ = CompareResultVsGolden_w_Status(m_sendBuffer2, m_sendSize2, rxBuff2, receivedSize2);
- pkt3_cmp_succ = CompareResultVsGolden_w_Status(m_sendBuffer3, m_sendSize3, rxBuff3, receivedSize3);
- pkt1_cmp_succ &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_5) ?
- IsTTLUpdated_v5_5(m_sendSize, receivedSize, rxBuff1) : true;
- pkt2_cmp_succ &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_5) ?
- IsTTLUpdated_v5_5(m_sendSize2, receivedSize2, rxBuff2) : true;
- pkt3_cmp_succ &= (TestManager::GetInstance()->GetIPAHwType() >= IPA_HW_v5_5) ?
- !IsTTLUpdated_v5_5(m_sendSize3, receivedSize3, rxBuff3) : true;
- size_t recievedBufferSize =
- MAX3(receivedSize, receivedSize2, receivedSize3) * 3;
- size_t sentBufferSize =
- MAX3(m_sendSize, m_sendSize2, m_sendSize3) * 3;
- char *recievedBuffer = new char[recievedBufferSize];
- char *sentBuffer = new char[sentBufferSize];
- if (NULL == recievedBuffer || NULL == sentBuffer) {
- printf("Memory allocation error\n");
- return false;
- }
- size_t j;
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer[j]);
- for(j = 0; j < receivedSize; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff1[j]);
- printf("Expected Value1(%zu)\n%s\n, Received Value1(%zu)\n%s\n-->Value1 %s\n",
- m_sendSize,sentBuffer,receivedSize,recievedBuffer,
- pkt1_cmp_succ?"Match":"no Match");
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize2; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer2[j]);
- for(j = 0; j < receivedSize2; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff2[j]);
- printf("Expected Value2 (%zu)\n%s\n, Received Value2(%zu)\n%s\n-->Value2 %s\n",
- m_sendSize2,sentBuffer,receivedSize2,recievedBuffer,
- pkt2_cmp_succ?"Match":"no Match");
- memset(recievedBuffer, 0, recievedBufferSize);
- memset(sentBuffer, 0, sentBufferSize);
- for(j = 0; j < m_sendSize3; j++)
- snprintf(&sentBuffer[3 * j], sentBufferSize - (3 * j + 1), " %02X", m_sendBuffer3[j]);
- for(j = 0; j < receivedSize3; j++)
- snprintf(&recievedBuffer[3 * j], recievedBufferSize - (3 * j + 1), " %02X", rxBuff3[j]);
- printf("Expected Value3 (%zu)\n%s\n, Received Value3(%zu)\n%s\n-->Value3 %s\n",
- m_sendSize3,sentBuffer,receivedSize3,recievedBuffer,
- pkt3_cmp_succ?"Match":"no Match");
- delete[] recievedBuffer;
- delete[] sentBuffer;
- delete[] rxBuff1;
- delete[] rxBuff2;
- delete[] rxBuff3;
- return pkt1_cmp_succ && pkt2_cmp_succ && pkt3_cmp_succ;
- }
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule_v2 *rt_rule;
- struct ipa_rt_rule_add_v2 *rt_rule_entry;
- const int NUM_RULES = 3;
- rt_rule = (struct ipa_ioc_add_rt_rule_v2 *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule_v2));
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
- rt_rule->rules = (uint64_t)calloc(3, sizeof(struct ipa_rt_rule_add_v2));
- if(!rt_rule->rules) {
- printf("fail\n");
- return false;
- }
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v6;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[0]);
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000FF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.ttl_update = 1; // TTL Update
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[1]);
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
- // rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = 0XFF020000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[2] = 0x00000000;
- rt_rule_entry->rule.attrib.u.v6.dst_addr[3] = 0X000000AA;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
- rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
- rt_rule_entry->rule.ttl_update = 1; // TTL Update
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[2]);
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
- rt_rule_entry->rule.ttl_update = 0; // TTL Update
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
- free(rt_rule);
- InitFilteringBlock();
- return true;
- }
- };
- static class IpaRoutingBlockTest1 ipaRoutingBlockTest1;
- static class IpaRoutingBlockTest2 ipaRoutingBlockTest2;
- static class IpaRoutingBlockTest3 ipaRoutingBlockTest3;
- static class IpaRoutingBlockTest4 ipaRoutingBlockTest4;
- static class IpaRoutingBlockTest5 ipaRoutingBlockTest5;
- static class IpaRoutingBlockTest006 ipaRoutingBlockTest006;
- static class IpaRoutingBlockTest007 ipaRoutingBlockTest007;
- static class IpaRoutingBlockTest008 ipaRoutingBlockTest008;
- static class IpaRoutingBlockTest009 ipaRoutingBlockTest009;
- static class IpaRoutingBlockTest010 ipaRoutingBlockTest010;
- static class IpaRoutingBlockTest011 ipaRoutingBlockTest011;
- static class IpaRoutingBlockTest012 ipaRoutingBlockTest012;
- static class IpaRoutingBlockTest013 ipaRoutingBlockTest013;
- static class IpaRoutingBlockTest014 ipaRoutingBlockTest014;
- static class IpaRoutingBlockTest015 ipaRoutingBlockTest015;
- static class IpaRoutingBlockTest016 ipaRoutingBlockTest016;
- static class IpaRoutingBlockTest017 ipaRoutingBlockTest017;
- static class IpaRoutingBlockTest018 ipaRoutingBlockTest018;
- static class IpaRoutingBlockTest020 ipaRoutingBlockTest020;
- static class IpaRoutingBlockTest021 ipaRoutingBlockTest021;
- static class IpaRoutingBlockTest022 ipaRoutingBlockTest022;
- static class IpaRoutingBlockTest023 ipaRoutingBlockTest023;
- static class IpaRoutingBlockTest024 ipaRoutingBlockTest024;
- static class IpaRoutingBlockTest025 ipaRoutingBlockTest025;
- static class IpaRoutingBlockTest026 ipaRoutingBlockTest026;
- static class IpaRoutingBlockTest027 ipaRoutingBlockTest027;
- static class IpaRoutingBlockTest028 ipaRoutingBlockTest028;
- static class IpaRoutingBlockTest030 ipaRoutingBlockTest030;
- static class IpaRoutingBlockTest031 ipaRoutingBlockTest031;
- static class IpaRoutingBlockTest040 ipaRoutingBlockTest040;
- static class IpaRoutingBlockTest050 ipaRoutingBlockTest050;
- static class IpaRoutingBlockTest051 ipaRoutingBlockTest051;
- static class IpaRoutingBlockTest052 ipaRoutingBlockTest052;
- static class IpaRoutingBlockTest053 ipaRoutingBlockTest053;
|