MBIMAggregationTests.cpp 111 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366
  1. /*
  2. * Copyright (c) 2017,2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above
  10. * copyright notice, this list of conditions and the following
  11. * disclaimer in the documentation and/or other materials provided
  12. * with the distribution.
  13. * * Neither the name of The Linux Foundation nor the names of its
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  18. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  20. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  21. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  22. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  23. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  24. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  25. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  26. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  27. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31. #include <unistd.h>
  32. #include <string.h>
  33. #include <stdint.h>
  34. #include "hton.h" // for htonl
  35. #include "MBIMAggregationTestFixtureConf11.h"
  36. #include "Constants.h"
  37. #include "TestsUtils.h"
  38. #include "linux/msm_ipa.h"
  39. #define AGGREGATION_LOOP 4
  40. #define IPV4_DST_ADDR_OFFSET (16)
  41. /////////////////////////////////////////////////////////////////////////////////
  42. // MBIM Aggregation scenarios //
  43. /////////////////////////////////////////////////////////////////////////////////
  44. class MBIMAggregationScenarios {
  45. public:
  46. //MBIM Aggregation test - sends 5 packets and receives 1 aggregated packet
  47. static bool MBIMAggregationTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  48. //MBIM Deaggregation test - sends an aggregated packet made from 5 packets
  49. //and receives 5 packets
  50. static bool MBIMDeaggregationTest(Pipe* input,
  51. Pipe* output, enum ipa_ip_type m_eIP);
  52. //MBIM Deaggregation one packet test - sends an aggregated packet made from
  53. //1 packet and receives 1 packet
  54. static bool MBIMDeaggregationOnePacketTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  55. //MBIM Deaggregation and Aggregation test - sends an aggregated packet made
  56. //from 5 packets and receives the same aggregated packet
  57. static bool MBIMDeaggregationAndAggregationTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  58. //MBIM multiple Deaggregation and Aggregation test - sends 5 aggregated
  59. //packets each one made of 1 packet and receives an aggregated packet made
  60. //of the 5 packets
  61. static bool MBIMMultipleDeaggregationAndAggregationTest(
  62. Pipe* input, Pipe* output,
  63. enum ipa_ip_type m_eIP);
  64. //MBIM Aggregation Loop test - sends 5 packets and expects to receive 1
  65. //aggregated packet a few times
  66. static bool MBIMAggregationLoopTest(Pipe* input,
  67. Pipe* output, enum ipa_ip_type m_eIP);
  68. //MBIM Aggregation time limit test - sends 1 small packet smaller than the
  69. //byte limit and receives 1 aggregated packet
  70. static bool MBIMAggregationTimeLimitTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  71. //MBIM Aggregation byte limit test - sends 2 packets that together are
  72. //larger than the byte limit
  73. static bool MBIMAggregationByteLimitTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  74. static bool MBIMAggregationByteLimitTestFC(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  75. static bool MBIMAggregationDualDpTestFC(Pipe* input, Pipe* output1, Pipe* output2, enum ipa_ip_type m_eIP);
  76. //MBIM Deaggregation multiple NDP test - sends an aggregated packet made
  77. //from 5 packets and 2 NDPs and receives 5 packets
  78. static bool MBIMDeaggregationMultipleNDPTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  79. //MBIM Aggregation 2 pipes test - sends 3 packets from one pipe and an
  80. //aggregated packet made of 2 packets from another pipe and receives 1
  81. //aggregated packet made of all 5 packets
  82. static bool MBIMAggregation2PipesTest(Pipe* input1, Pipe* input2, Pipe* output, enum ipa_ip_type m_eIP);
  83. //MBIM Aggregation time limit loop test - sends 5 small packet smaller than
  84. //the byte limit and receives 5 aggregated packet
  85. static bool MBIMAggregationTimeLimitLoopTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  86. //MBIM Aggregation 0 limits test - sends 5 packets and expects to get each
  87. //packet back aggregated (both size and time limits are 0)
  88. static bool MBIMAggregation0LimitsTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  89. //MBIM Aggregation multiple packets test - sends 9 packets with same stream
  90. //ID and receives 1 aggregated packet with 2 NDPs
  91. static bool MBIMAggregationMultiplePacketsTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  92. //MBIM Aggregation different stream IDs test - sends 5 packets with
  93. //different stream IDs and receives 1 aggregated packet made of 5 NDPs
  94. static bool MBIMAggregationDifferentStreamIdsTest(Pipe* input, Pipe* output, enum ipa_ip_type m_eIP);
  95. //MBIM Aggregation no interleaving stream IDs test - sends 5 packets with
  96. //interleaving stream IDs (0, 1, 0, 1, 0) and receives 1 aggregated packet
  97. //made of 5 NDPs
  98. static bool MBIMAggregationNoInterleavingStreamIdsTest(
  99. Pipe* input, Pipe* output,
  100. enum ipa_ip_type m_eIP);
  101. private:
  102. //This method will deaggregate an aggregated packet and compare the packets
  103. //to the expected packets
  104. static bool DeaggragateAndComparePackets(
  105. Byte pAggregatedPacket[MAX_PACKET_SIZE],
  106. Byte pExpectedPackets[MAX_PACKETS_IN_MBIM_TESTS][MAX_PACKET_SIZE],
  107. int pPacketsSizes[MAX_PACKETS_IN_MBIM_TESTS], int nNumPackets,
  108. int nAggregatedPacketSize);
  109. //This method will aggregate packets
  110. static void AggregatePackets(
  111. Byte pAggregatedPacket[MAX_PACKET_SIZE]/*ouput*/,
  112. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE],
  113. int pPacketsSizes[NUM_PACKETS], int nNumPackets,
  114. int nAggregatedPacketSize);
  115. //This method will aggregate packets and take into consideration their
  116. //stream id to seperate them into different NDPs
  117. static void AggregatePacketsWithStreamId(
  118. Byte pAggregatedPacket[MAX_PACKET_SIZE]/*ouput*/,
  119. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE],
  120. int pPacketsSizes[NUM_PACKETS], int nNumPackets,
  121. int nAggregatedPacketSize, Byte pPacketsStreamId[NUM_PACKETS]);
  122. //This method will deaggregate an aggregated packet made of one packet and
  123. //compare the packet to the expected packet
  124. static bool DeaggragateAndCompareOnePacket(
  125. Byte pAggregatedPacket[MAX_PACKET_SIZE],
  126. Byte pExpectedPacket[MAX_PACKET_SIZE], int nPacketsSize,
  127. int nAggregatedPacketSize);
  128. //This method will deaggregate an aggregated packet and compare the packets
  129. //to the expected packets
  130. static bool DeaggragateAndComparePacketsWithStreamId(
  131. Byte pAggregatedPacket[MAX_PACKET_SIZE],
  132. Byte pExpectedPackets[][MAX_PACKET_SIZE], int pPacketsSizes[],
  133. int nNumPackets, int nAggregatedPacketSize,
  134. Byte pPacketsStreamId[NUM_PACKETS]);
  135. };
  136. /////////////////////////////////////////////////////////////////////////////////
  137. /////////////////////////////////////////////////////////////////////////////////
  138. /////////////////////////////////////////////////////////////////////////////////
  139. bool MBIMAggregationScenarios::MBIMAggregationTest(
  140. Pipe* input, Pipe* output, enum ipa_ip_type m_eIP)
  141. {
  142. //The packets that will be sent
  143. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  144. //The real sizes of the packets that will be sent
  145. int pPacketsSizes[NUM_PACKETS];
  146. //Buffer for the packet that will be received
  147. Byte pReceivedPacket[2*MAX_PACKET_SIZE];
  148. //Total size of all sent packets (this is the max size of the aggregated
  149. //packet minus the size of the header and the NDP)
  150. int nTotalPacketsSize = MAX_PACKET_SIZE - (4 * NUM_PACKETS) - 24;
  151. uint32_t nIPv4DSTAddr;
  152. size_t pIpPacketsSizes[NUM_PACKETS];
  153. //initialize the packets
  154. for (int i = 0; i < NUM_PACKETS; i++)
  155. {
  156. if (NUM_PACKETS - 1 == i)
  157. pPacketsSizes[i] = nTotalPacketsSize;
  158. else
  159. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  160. while (0 != pPacketsSizes[i] % 4)
  161. {
  162. pPacketsSizes[i]++;
  163. }
  164. nTotalPacketsSize -= pPacketsSizes[i];
  165. // Load input data (IP packet) from file
  166. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  167. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  168. {
  169. LOG_MSG_ERROR("Failed default Packet");
  170. return false;
  171. }
  172. nIPv4DSTAddr = ntohl(0x7F000001);
  173. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  174. sizeof(nIPv4DSTAddr));
  175. int size = pIpPacketsSizes[i];
  176. while (size < pPacketsSizes[i])
  177. {
  178. pPackets[i][size] = i;
  179. size++;
  180. }
  181. }
  182. //send the packets
  183. for (int i = 0; i < NUM_PACKETS; i++)
  184. {
  185. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  186. pPacketsSizes[i]);
  187. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  188. if (pPacketsSizes[i] != nBytesSent)
  189. {
  190. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  191. "failed!\n", i, pPacketsSizes[i]);
  192. return false;
  193. }
  194. }
  195. //receive the aggregated packet
  196. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be there)"
  197. "\n", MAX_PACKET_SIZE);
  198. int nBytesReceived = output->Receive(pReceivedPacket, MAX_PACKET_SIZE);
  199. if (MAX_PACKET_SIZE != nBytesReceived)
  200. {
  201. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes) "
  202. "failed!\n", MAX_PACKET_SIZE);
  203. print_buff(pReceivedPacket, nBytesReceived);
  204. return false;
  205. }
  206. //deaggregating the aggregated packet
  207. return DeaggragateAndComparePackets(pReceivedPacket, pPackets,
  208. pPacketsSizes, NUM_PACKETS, nBytesReceived);
  209. }
  210. /////////////////////////////////////////////////////////////////////////////////
  211. bool MBIMAggregationScenarios::MBIMDeaggregationTest(
  212. Pipe* input, Pipe* output, enum ipa_ip_type m_eIP)
  213. {
  214. bool bTestResult = true;
  215. //The packets that the aggregated packet will be made of
  216. Byte pExpectedPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  217. //The real sizes of the packets that the aggregated packet will be made of
  218. int pPacketsSizes[NUM_PACKETS];
  219. //Buffers for the packets that will be received
  220. Byte pReceivedPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  221. //Total size of all the packets that the aggregated packet will be made of
  222. //(this is the max size of the aggregated packet
  223. //minus the size of the header and the NDP)
  224. int nTotalPacketsSize = MAX_PACKET_SIZE - (4 * NUM_PACKETS) - 24;
  225. //The aggregated packet that will be sent
  226. Byte pAggregatedPacket[MAX_PACKET_SIZE] = {0};
  227. uint32_t nIPv4DSTAddr;
  228. size_t pIpPacketsSizes[NUM_PACKETS];
  229. //initialize the packets
  230. for (int i = 0; i < NUM_PACKETS; i++)
  231. {
  232. if (NUM_PACKETS - 1 == i)
  233. pPacketsSizes[i] = nTotalPacketsSize;
  234. else
  235. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  236. while (0 != pPacketsSizes[i] % 4)
  237. {
  238. pPacketsSizes[i]++;
  239. }
  240. nTotalPacketsSize -= pPacketsSizes[i];
  241. // Load input data (IP packet) from file
  242. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  243. if (!LoadDefaultPacket(m_eIP, pExpectedPackets[i],
  244. pIpPacketsSizes[i]))
  245. {
  246. LOG_MSG_ERROR("Failed default Packet");
  247. return false;
  248. }
  249. nIPv4DSTAddr = ntohl(0x7F000001);
  250. memcpy (&pExpectedPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  251. sizeof(nIPv4DSTAddr));
  252. int size = pIpPacketsSizes[i];
  253. while (size < pPacketsSizes[i])
  254. {
  255. pExpectedPackets[i][size] = i;
  256. size++;
  257. }
  258. }
  259. //initializing the aggregated packet
  260. AggregatePackets(pAggregatedPacket, pExpectedPackets, pPacketsSizes,
  261. NUM_PACKETS, MAX_PACKET_SIZE);
  262. //send the aggregated packet
  263. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes)\n",
  264. sizeof(pAggregatedPacket));
  265. int nBytesSent = input->Send(pAggregatedPacket, sizeof(pAggregatedPacket));
  266. if (sizeof(pAggregatedPacket) != nBytesSent)
  267. {
  268. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes) "
  269. "failed!\n", sizeof(pAggregatedPacket));
  270. return false;
  271. }
  272. //receive the packets
  273. for (int i = 0; i < NUM_PACKETS; i++)
  274. {
  275. LOG_MSG_DEBUG("Reading packet %d from the USB pipe(%d bytes should be "
  276. "there)\n", i, pPacketsSizes[i]);
  277. int nBytesReceived = output->Receive(pReceivedPackets[i],
  278. pPacketsSizes[i]);
  279. if (pPacketsSizes[i] != nBytesReceived)
  280. {
  281. LOG_MSG_DEBUG("Receiving packet %d from the USB pipe(%d bytes) "
  282. "failed!\n", i, pPacketsSizes[i]);
  283. print_buff(pReceivedPackets[i], nBytesReceived);
  284. return false;
  285. }
  286. }
  287. //comparing the received packet to the aggregated packet
  288. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  289. for (int i = 0; i < NUM_PACKETS; i++)
  290. bTestResult &= !memcmp(pExpectedPackets[i], pReceivedPackets[i],
  291. pPacketsSizes[i]);
  292. return bTestResult;
  293. }
  294. /////////////////////////////////////////////////////////////////////////////////
  295. bool MBIMAggregationScenarios::MBIMDeaggregationOnePacketTest(
  296. Pipe* input, Pipe* output,
  297. enum ipa_ip_type m_eIP)
  298. {
  299. bool bTestResult = true;
  300. //The packets that the aggregated packet will be made of
  301. Byte pExpectedPackets[1][MAX_PACKET_SIZE];
  302. //The real sizes of the packets that the aggregated packet will be made of
  303. int pPacketsSizes[1] = {100};
  304. //Buffers for the packets that will be received
  305. Byte pReceivedPackets[1][MAX_PACKET_SIZE];
  306. //Total size of the aggregated packet
  307. //(this is the max size of the aggregated packet
  308. //minus the size of the header and the NDP)
  309. int nTotalAggregatedPacketSize = 100 + 12 + 16;
  310. //The aggregated packet that will be sent
  311. Byte pAggregatedPacket[MAX_PACKET_SIZE] = {0};
  312. uint32_t nIPv4DSTAddr;
  313. size_t pIpPacketsSizes[1];
  314. // Load input data (IP packet) from file
  315. pIpPacketsSizes[0] = 100;
  316. if (!LoadDefaultPacket(m_eIP, pExpectedPackets[0], pIpPacketsSizes[0]))
  317. {
  318. LOG_MSG_ERROR("Failed default Packet");
  319. return false;
  320. }
  321. nIPv4DSTAddr = ntohl(0x7F000001);
  322. memcpy (&pExpectedPackets[0][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  323. sizeof(nIPv4DSTAddr));
  324. int size = pIpPacketsSizes[0];
  325. while (size < pPacketsSizes[0])
  326. {
  327. pExpectedPackets[0][size] = 0;
  328. size++;
  329. }
  330. //initializing the aggregated packet
  331. AggregatePackets(pAggregatedPacket, pExpectedPackets, pPacketsSizes, 1,
  332. nTotalAggregatedPacketSize);
  333. //send the aggregated packet
  334. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes)\n",
  335. nTotalAggregatedPacketSize);
  336. int nBytesSent = input->Send(pAggregatedPacket, nTotalAggregatedPacketSize);
  337. if (nTotalAggregatedPacketSize != nBytesSent)
  338. {
  339. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes) "
  340. "failed!\n", nTotalAggregatedPacketSize);
  341. return false;
  342. }
  343. //receive the packet
  344. for (int i = 0; i < 1; i++)
  345. {
  346. LOG_MSG_DEBUG("Reading packet %d from the USB pipe(%d bytes should be "
  347. "there)\n", i, pPacketsSizes[i]);
  348. int nBytesReceived = output->Receive(pReceivedPackets[i],
  349. pPacketsSizes[i]);
  350. if (pPacketsSizes[i] != nBytesReceived)
  351. {
  352. LOG_MSG_DEBUG("Receiving packet %d from the USB pipe(%d bytes) "
  353. "failed!\n", i, pPacketsSizes[i]);
  354. print_buff(pReceivedPackets[i], nBytesReceived);
  355. return false;
  356. }
  357. }
  358. //comparing the received packet to the aggregated packet
  359. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  360. for (int i = 0; i < 1; i++)
  361. bTestResult &= !memcmp(pExpectedPackets[i], pReceivedPackets[i],
  362. pPacketsSizes[i]);
  363. return bTestResult;
  364. }
  365. /////////////////////////////////////////////////////////////////////////////////
  366. bool MBIMAggregationScenarios::MBIMDeaggregationAndAggregationTest(
  367. Pipe* input, Pipe* output,
  368. enum ipa_ip_type m_eIP)
  369. {
  370. //The packets that the aggregated packet will be made of
  371. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  372. //The real sizes of the packets that the aggregated packet will be made of
  373. int pPacketsSizes[NUM_PACKETS];
  374. //Buffers for the packets that will be received
  375. Byte pReceivedPacket[MAX_PACKET_SIZE];
  376. //Total size of all the packets that the aggregated packet will be made of
  377. //(this is the max size of the aggregated packet
  378. //minus the size of the header and the NDP)
  379. int nTotalPacketsSize = MAX_PACKET_SIZE - (4 * NUM_PACKETS) - 24;
  380. //The aggregated packet that will be sent
  381. Byte pAggregatedPacket[MAX_PACKET_SIZE] = {0};
  382. uint32_t nIPv4DSTAddr;
  383. size_t pIpPacketsSizes[NUM_PACKETS];
  384. //initialize the packets
  385. for (int i = 0; i < NUM_PACKETS; i++)
  386. {
  387. if (NUM_PACKETS - 1 == i)
  388. pPacketsSizes[i] = nTotalPacketsSize;
  389. else
  390. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  391. while (0 != pPacketsSizes[i] % 4)
  392. pPacketsSizes[i]++;
  393. nTotalPacketsSize -= pPacketsSizes[i];
  394. // Load input data (IP packet) from file
  395. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  396. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  397. {
  398. LOG_MSG_ERROR("Failed default Packet");
  399. return false;
  400. }
  401. nIPv4DSTAddr = ntohl(0x7F000001);
  402. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  403. sizeof(nIPv4DSTAddr));
  404. int size = pIpPacketsSizes[i];
  405. while (size < pPacketsSizes[i])
  406. {
  407. pPackets[i][size] = i;
  408. size++;
  409. }
  410. }
  411. //initializing the aggregated packet
  412. AggregatePackets(pAggregatedPacket, pPackets, pPacketsSizes, NUM_PACKETS,
  413. MAX_PACKET_SIZE);
  414. //send the aggregated packet
  415. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes)\n",
  416. MAX_PACKET_SIZE);
  417. int nBytesSent = input->Send(pAggregatedPacket, MAX_PACKET_SIZE);
  418. if (MAX_PACKET_SIZE != nBytesSent)
  419. {
  420. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes) "
  421. "failed!\n", MAX_PACKET_SIZE);
  422. return false;
  423. }
  424. //receive the aggregated packet
  425. LOG_MSG_DEBUG("Reading aggregated packet from the USB pipe(%d bytes should "
  426. "be there)\n", MAX_PACKET_SIZE);
  427. int nBytesReceived = output->Receive(pReceivedPacket, MAX_PACKET_SIZE);
  428. if (MAX_PACKET_SIZE != nBytesReceived)
  429. {
  430. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes) "
  431. "failed!\n", MAX_PACKET_SIZE);
  432. LOG_MSG_DEBUG("Received %d bytes\n", nBytesReceived);
  433. print_buff(pReceivedPacket, nBytesReceived);
  434. return false;
  435. }
  436. //comparing the received packet to the aggregated packet
  437. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  438. return DeaggragateAndComparePackets(pReceivedPacket, pPackets, pPacketsSizes,
  439. NUM_PACKETS, nBytesReceived);
  440. }
  441. /////////////////////////////////////////////////////////////////////////////////
  442. bool MBIMAggregationScenarios::MBIMMultipleDeaggregationAndAggregationTest(
  443. Pipe* input, Pipe* output,
  444. enum ipa_ip_type m_eIP)
  445. {
  446. //The packets that the aggregated packets will be made of
  447. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  448. //The real sizes of the packets that the aggregated packet will be made of
  449. int pPacketsSizes[NUM_PACKETS];
  450. //Buffers for the packets that will be received
  451. Byte pReceivedPacket[MAX_PACKET_SIZE];
  452. //Total size of all the packets that the aggregated packet will be made of
  453. //(this is the max size of the aggregated packet
  454. //minus the size of the header and the NDP)
  455. int nTotalPacketsSize = MAX_PACKET_SIZE - (4 * NUM_PACKETS) - 24;
  456. //The aggregated packet that will be sent
  457. Byte pAggregatedPacket[NUM_PACKETS][MAX_PACKET_SIZE];
  458. uint32_t nIPv4DSTAddr;
  459. size_t pIpPacketsSizes[NUM_PACKETS];
  460. //initialize the packets
  461. for (int i = 0; i < NUM_PACKETS; i++)
  462. {
  463. if (NUM_PACKETS - 1 == i)
  464. pPacketsSizes[i] = nTotalPacketsSize;
  465. else
  466. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  467. while (0 != pPacketsSizes[i] % 4)
  468. pPacketsSizes[i]++;
  469. nTotalPacketsSize -= pPacketsSizes[i];
  470. // Load input data (IP packet) from file
  471. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  472. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  473. {
  474. LOG_MSG_ERROR("Failed default Packet");
  475. return false;
  476. }
  477. nIPv4DSTAddr = ntohl(0x7F000001);
  478. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  479. sizeof(nIPv4DSTAddr));
  480. int size = pIpPacketsSizes[i];
  481. while (size < pPacketsSizes[i])
  482. {
  483. pPackets[i][size] = i;
  484. size++;
  485. }
  486. }
  487. //initializing the aggregated packets
  488. for (int i = 0; i < NUM_PACKETS; i++)
  489. AggregatePackets(pAggregatedPacket[i], &pPackets[i], &pPacketsSizes[i],
  490. 1, pPacketsSizes[i] + 12 + 16);
  491. //send the aggregated packets
  492. for (int i = 0; i < NUM_PACKETS; i++)
  493. {
  494. LOG_MSG_DEBUG("Sending aggregated packet %d into the USB pipe(%d "
  495. "bytes)\n", i, pPacketsSizes[i] + 12 + 16);
  496. int nBytesSent = input->Send(pAggregatedPacket[i],
  497. pPacketsSizes[i] + 12 + 16);
  498. if (pPacketsSizes[i] + 12 + 16 != nBytesSent)
  499. {
  500. LOG_MSG_DEBUG("Sending aggregated packet %d into the USB pipe(%d "
  501. "bytes) failed!\n", i, pPacketsSizes[i] + 12 + 16);
  502. return false;
  503. }
  504. }
  505. //receive the aggregated packet
  506. LOG_MSG_DEBUG("Reading aggregated packet from the USB pipe(%d bytes should "
  507. "be there)\n", MAX_PACKET_SIZE);
  508. int nBytesReceived = output->Receive(pReceivedPacket, MAX_PACKET_SIZE);
  509. if (MAX_PACKET_SIZE != nBytesReceived)
  510. {
  511. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes) "
  512. "failed!\n", MAX_PACKET_SIZE);
  513. LOG_MSG_DEBUG("Received %d bytes\n", nBytesReceived);
  514. print_buff(pReceivedPacket, nBytesReceived);
  515. return false;
  516. }
  517. //comparing the received packet to the aggregated packet
  518. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  519. return DeaggragateAndComparePackets(pReceivedPacket, pPackets,
  520. pPacketsSizes, NUM_PACKETS, nBytesReceived);
  521. }
  522. /////////////////////////////////////////////////////////////////////////////////
  523. bool MBIMAggregationScenarios::MBIMAggregationLoopTest(
  524. Pipe* input, Pipe* output, enum ipa_ip_type m_eIP)
  525. {
  526. //The packets that will be sent
  527. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  528. //The real sizes of the packets that will be sent
  529. int pPacketsSizes[NUM_PACKETS];
  530. //Buffer for the packet that will be received
  531. Byte pReceivedPacket[MAX_PACKET_SIZE];
  532. //Total size of all sent packets (this is the max size of the aggregated
  533. //packet minus the size of the header and the NDP)
  534. int nTotalPacketsSize = MAX_PACKET_SIZE - (4 * NUM_PACKETS) - 24;
  535. uint32_t nIPv4DSTAddr;
  536. size_t pIpPacketsSizes[NUM_PACKETS];
  537. //initialize the packets
  538. for (int i = 0; i < NUM_PACKETS; i++)
  539. {
  540. if (NUM_PACKETS - 1 == i)
  541. pPacketsSizes[i] = nTotalPacketsSize;
  542. else
  543. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  544. while (0 != pPacketsSizes[i] % 4)
  545. pPacketsSizes[i]++;
  546. nTotalPacketsSize -= pPacketsSizes[i];
  547. // Load input data (IP packet) from file
  548. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  549. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  550. {
  551. LOG_MSG_ERROR("Failed default Packet");
  552. return false;
  553. }
  554. nIPv4DSTAddr = ntohl(0x7F000001);
  555. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  556. sizeof(nIPv4DSTAddr));
  557. int size = pIpPacketsSizes[i];
  558. while (size < pPacketsSizes[i])
  559. {
  560. pPackets[i][size] = i;
  561. size++;
  562. }
  563. }
  564. int num_iters = AGGREGATION_LOOP - 1;
  565. for (int j = 0; j < num_iters; j++)
  566. {
  567. //send the packets
  568. for (int i = 0; i < NUM_PACKETS; i++)
  569. {
  570. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  571. pPacketsSizes[i]);
  572. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  573. if (pPacketsSizes[i] != nBytesSent)
  574. {
  575. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  576. "failed!\n", i, pPacketsSizes[i]);
  577. return false;
  578. }
  579. }
  580. memset(pReceivedPacket, 0, sizeof(pReceivedPacket));
  581. //receive the aggregated packet
  582. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be "
  583. "there)\n", MAX_PACKET_SIZE);
  584. int nBytesReceived = output->Receive(pReceivedPacket, MAX_PACKET_SIZE);
  585. if (MAX_PACKET_SIZE != nBytesReceived)
  586. {
  587. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d "
  588. "bytes) failed!\n", MAX_PACKET_SIZE);
  589. print_buff(pReceivedPacket, nBytesReceived);
  590. return false;
  591. }
  592. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  593. if (false == DeaggragateAndComparePackets(pReceivedPacket, pPackets,
  594. pPacketsSizes, NUM_PACKETS, nBytesReceived))
  595. {
  596. LOG_MSG_DEBUG("Comparing aggregated packet failed!\n");
  597. return false;
  598. }
  599. }
  600. return true;
  601. }
  602. /////////////////////////////////////////////////////////////////////////////////
  603. bool MBIMAggregationScenarios::MBIMAggregationTimeLimitTest(
  604. Pipe* input, Pipe* output,
  605. enum ipa_ip_type m_eIP)
  606. {
  607. //The packets that will be sent
  608. Byte pPackets[1][MAX_PACKET_SIZE];
  609. //The real sizes of the packets that will be sent
  610. int pPacketsSizes[1] = {0};
  611. //Buffer for the packet that will be received
  612. Byte pReceivedPacket[MAX_PACKET_SIZE] = {0};
  613. //Size of aggregated packet
  614. int nTotalPacketsSize = 24;
  615. uint32_t nIPv4DSTAddr;
  616. size_t pIpPacketsSizes[1];
  617. //initialize the packets
  618. for (int i = 0; i < 1 ; i++)
  619. {
  620. pPacketsSizes[i] = 52 + 4*i;
  621. nTotalPacketsSize += pPacketsSizes[i] + 4; //size of the packet + 4 bytes for index and length
  622. // Load input data (IP packet) from file
  623. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  624. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  625. {
  626. LOG_MSG_ERROR("Failed default Packet");
  627. return false;
  628. }
  629. nIPv4DSTAddr = ntohl(0x7F000001);
  630. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  631. sizeof(nIPv4DSTAddr));
  632. int size = pIpPacketsSizes[i];
  633. while (size < pPacketsSizes[i])
  634. {
  635. pPackets[i][size] = i;
  636. size++;
  637. }
  638. }
  639. int nAllPacketsSizes = 0;
  640. for (int i = 0; i < 1; i++)
  641. nAllPacketsSizes += pPacketsSizes[i];
  642. while (0 != nAllPacketsSizes % 4)
  643. {
  644. nAllPacketsSizes++;
  645. nTotalPacketsSize++; //zero padding for NDP offset to be 4x
  646. }
  647. //send the packets
  648. for (int i = 0; i < 1; i++)
  649. {
  650. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  651. pPacketsSizes[i]);
  652. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  653. if (pPacketsSizes[i] != nBytesSent)
  654. {
  655. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  656. "failed!\n", i, pPacketsSizes[i]);
  657. return false;
  658. }
  659. }
  660. //receive the aggregated packet
  661. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be "
  662. "there)\n", nTotalPacketsSize);
  663. int nBytesReceived = output->Receive(pReceivedPacket, nTotalPacketsSize);
  664. // IPA HW may add padding to the packets to align to 4B
  665. if (nTotalPacketsSize > nBytesReceived)
  666. {
  667. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes) "
  668. "failed!\n", nTotalPacketsSize);
  669. print_buff(pReceivedPacket, nBytesReceived);
  670. return false;
  671. }
  672. //comparing the received packet to the aggregated packet
  673. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  674. if (false == DeaggragateAndComparePackets(pReceivedPacket, pPackets,
  675. pPacketsSizes, 1, nBytesReceived))
  676. {
  677. LOG_MSG_DEBUG("Comparing aggregated packet failed!\n");
  678. print_buff(pReceivedPacket, nBytesReceived);
  679. return false;
  680. }
  681. return true;
  682. }
  683. /////////////////////////////////////////////////////////////////////////////////
  684. bool MBIMAggregationScenarios::MBIMAggregationByteLimitTest(
  685. Pipe* input, Pipe* output,
  686. enum ipa_ip_type m_eIP)
  687. {
  688. //The packets that will be sent
  689. Byte pPackets[2][MAX_PACKET_SIZE];
  690. //The real sizes of the packets that will be sent
  691. int pPacketsSizes[2];
  692. //Buffer for the packet that will be received
  693. Byte pReceivedPacket[2*MAX_PACKET_SIZE] = {0};
  694. //Size of aggregated packet
  695. int nTotalPacketsSize = 24;
  696. uint32_t nIPv4DSTAddr;
  697. size_t pIpPacketsSizes[2];
  698. //initialize the packets
  699. for (int i = 0; i < 2; i++)
  700. {
  701. pPacketsSizes[i] = (MAX_PACKET_SIZE / 2) + 10;
  702. nTotalPacketsSize += pPacketsSizes[i] + 4;
  703. // Load input data (IP packet) from file
  704. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  705. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  706. {
  707. LOG_MSG_ERROR("Failed default Packet");
  708. return false;
  709. }
  710. nIPv4DSTAddr = ntohl(0x7F000001);
  711. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  712. sizeof(nIPv4DSTAddr));
  713. int size = pIpPacketsSizes[i];
  714. while (size < pPacketsSizes[i])
  715. {
  716. pPackets[i][size] = i;
  717. size++;
  718. }
  719. }
  720. //send the packets
  721. for (int i = 0; i < 2; i++)
  722. {
  723. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  724. pPacketsSizes[i]);
  725. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  726. if (pPacketsSizes[i] != nBytesSent)
  727. {
  728. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  729. "failed!\n", i, pPacketsSizes[i]);
  730. return false;
  731. }
  732. }
  733. //receive the aggregated packet
  734. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be "
  735. "there)\n", nTotalPacketsSize);
  736. int nBytesReceived = output->Receive(pReceivedPacket, nTotalPacketsSize);
  737. // IPA HW may add padding to the packets to align to 4B
  738. if (nTotalPacketsSize > nBytesReceived)
  739. {
  740. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes) "
  741. "failed!\n", nTotalPacketsSize);
  742. print_buff(pReceivedPacket, nBytesReceived);
  743. return false;
  744. }
  745. //comparing the received packet to the aggregated packet
  746. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  747. if (false == DeaggragateAndComparePackets(pReceivedPacket, pPackets,
  748. pPacketsSizes, 2, nBytesReceived))
  749. {
  750. LOG_MSG_DEBUG("Comparing aggregated packet failed!\n");
  751. return false;
  752. }
  753. return true;
  754. }
  755. /////////////////////////////////////////////////////////////////////////////////
  756. bool MBIMAggregationScenarios::MBIMAggregationByteLimitTestFC(
  757. Pipe *input, Pipe *output,
  758. enum ipa_ip_type m_eIP)
  759. {
  760. //The packets that will be sent
  761. Byte pPackets[2][MAX_PACKET_SIZE];
  762. //The real sizes of the packets that will be sent
  763. int pPacketsSizes[2];
  764. //Buffer for the packet that will be received
  765. Byte pReceivedPacket[2][MAX_PACKET_SIZE] = {0};
  766. //Size of aggregated packet
  767. int nTotalPacketsSize = 24 + (MAX_PACKET_SIZE / 2) + 8 + 4;
  768. uint32_t nIPv4DSTAddr;
  769. size_t pIpPacketsSizes[2];
  770. int nBytesReceived;
  771. for (int i = 0; i < 2; i++)
  772. {
  773. pPacketsSizes[i] = (MAX_PACKET_SIZE / 2) + 8;
  774. // Load input data (IP packet) from file
  775. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  776. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  777. {
  778. LOG_MSG_ERROR("Failed default Packet");
  779. return false;
  780. }
  781. nIPv4DSTAddr = ntohl(0x7F000001);
  782. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  783. sizeof(nIPv4DSTAddr));
  784. int size = pIpPacketsSizes[i];
  785. while (size < pPacketsSizes[i])
  786. {
  787. pPackets[i][size] = i;
  788. size++;
  789. }
  790. }
  791. //send the packets
  792. for (int i = 0; i < 2; i++)
  793. {
  794. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  795. pPacketsSizes[i]);
  796. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  797. if (pPacketsSizes[i] != nBytesSent)
  798. {
  799. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  800. "failed!\n", i, pPacketsSizes[i]);
  801. return false;
  802. }
  803. }
  804. /* receive the packet */
  805. LOG_MSG_DEBUG(
  806. "Reading packets from the USB pipe(%d bytes for each)"
  807. "\n", nTotalPacketsSize);
  808. for (int i = 0; i < 2; i++)
  809. {
  810. nBytesReceived = output->Receive(pReceivedPacket[i], MAX_PACKET_SIZE);
  811. if (nTotalPacketsSize != nBytesReceived)
  812. {
  813. LOG_MSG_ERROR(
  814. "Receiving aggregated packet from the USB pipe(%d bytes) "
  815. "failed!\n", nBytesReceived);
  816. print_buff(pReceivedPacket[i], nBytesReceived);
  817. return false;
  818. }
  819. }
  820. //comparing the received packets to the aggregated packets
  821. LOG_MSG_DEBUG("Checking sent.vs.received packets\n");
  822. for (int i = 0; i < 2; i++)
  823. {
  824. if (false == DeaggragateAndComparePackets(pReceivedPacket[i],
  825. &pPackets[i],
  826. (int *)&pPacketsSizes[i],
  827. 1,
  828. nBytesReceived))
  829. {
  830. LOG_MSG_DEBUG("Comparing aggregated packet failed!\n");
  831. return false;
  832. }
  833. }
  834. return true;
  835. }
  836. /////////////////////////////////////////////////////////////////////////////////
  837. #define DUAL_FC_IP_PACKET_L ((MAX_PACKET_SIZE / 2) + 8)
  838. #define DUAL_FC_1_AGG_PACKET_L (12 + DUAL_FC_IP_PACKET_L + 12 + 4)
  839. #define DUAL_FC_2_AGG_PACKET_L (12 + DUAL_FC_IP_PACKET_L + DUAL_FC_IP_PACKET_L + 12 + 4 + 4)
  840. bool MBIMAggregationScenarios::MBIMAggregationDualDpTestFC(
  841. Pipe *input, Pipe *output1, Pipe *output2,
  842. enum ipa_ip_type m_eIP)
  843. {
  844. int i;
  845. //The packets that will be sent
  846. Byte pPackets[4][MAX_PACKET_SIZE];
  847. //The real sizes of the packets that will be sent
  848. int pPacketsSizes[4];
  849. //Buffer for the packet that will be received
  850. Byte pReceivedPacket[2 * MAX_PACKET_SIZE] = {0};
  851. Byte pReceivedPacketFC[2][MAX_PACKET_SIZE] = {0};
  852. uint32_t nIPv4DSTAddr;
  853. size_t pIpPacketsSizes[4];
  854. int nBytesReceived;
  855. for (i = 0; i < 4; i++)
  856. {
  857. pPacketsSizes[i] = DUAL_FC_IP_PACKET_L;
  858. // Load input data (IP packet) from file
  859. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  860. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  861. {
  862. LOG_MSG_ERROR("Failed default Packet");
  863. return false;
  864. }
  865. nIPv4DSTAddr = ntohl(0x7F000001 + (i & 0x1));
  866. memcpy(&pPackets[i][IPV4_DST_ADDR_OFFSET], &nIPv4DSTAddr,
  867. sizeof(nIPv4DSTAddr));
  868. int size = pIpPacketsSizes[i];
  869. while (size < pPacketsSizes[i])
  870. {
  871. pPackets[i][size] = 0xAA;
  872. size++;
  873. }
  874. }
  875. //send the packets
  876. for (int i = 0; i < 4; i++)
  877. {
  878. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  879. pPacketsSizes[i]);
  880. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  881. if (pPacketsSizes[i] != nBytesSent)
  882. {
  883. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  884. "failed!\n", i, pPacketsSizes[i]);
  885. return false;
  886. }
  887. }
  888. /* receive the packets from FC pipe */
  889. LOG_MSG_DEBUG(
  890. "Reading packets from the FC pipe (%d bytes for each)"
  891. "\n", DUAL_FC_1_AGG_PACKET_L);
  892. for (i = 0; i < 2; i++)
  893. {
  894. nBytesReceived = output1->Receive(pReceivedPacketFC[i], MAX_PACKET_SIZE);
  895. if (DUAL_FC_1_AGG_PACKET_L != nBytesReceived)
  896. {
  897. LOG_MSG_ERROR(
  898. "Receiving aggregated packet from the USB pipe (%d bytes) "
  899. "failed!\n", nBytesReceived);
  900. print_buff(pReceivedPacketFC[i], nBytesReceived);
  901. return false;
  902. }
  903. }
  904. for (i = 0; i < 2; i++)
  905. {
  906. if (false == DeaggragateAndComparePackets(pReceivedPacketFC[i],
  907. &pPackets[i * 2],
  908. (int *)&pPacketsSizes[i * 2],
  909. 1,
  910. nBytesReceived))
  911. {
  912. LOG_MSG_DEBUG("Comparing aggregated packet failed!\n");
  913. return false;
  914. }
  915. }
  916. /* receive the packet from non-FC pipe */
  917. LOG_MSG_DEBUG(
  918. "Reading packet from the non-FC pipe (%d bytes)"
  919. "\n", DUAL_FC_2_AGG_PACKET_L);
  920. nBytesReceived = output2->Receive(pReceivedPacket, MAX_PACKET_SIZE);
  921. if (DUAL_FC_2_AGG_PACKET_L != nBytesReceived)
  922. {
  923. LOG_MSG_ERROR(
  924. "Receiving aggregated packet from the USB pipe (%d bytes) "
  925. "failed!\n", nBytesReceived);
  926. print_buff(pReceivedPacket, nBytesReceived);
  927. return false;
  928. }
  929. // Setting all source packets IP to 127.0.0.2 for comparison
  930. nIPv4DSTAddr = ntohl(0x7F000002);
  931. memcpy(&pPackets[0][IPV4_DST_ADDR_OFFSET], &nIPv4DSTAddr, sizeof(nIPv4DSTAddr));
  932. memcpy(&pPackets[2][IPV4_DST_ADDR_OFFSET], &nIPv4DSTAddr, sizeof(nIPv4DSTAddr));
  933. if (false == DeaggragateAndComparePackets(&pReceivedPacket[0], pPackets,
  934. (int *)&pPacketsSizes, 2, nBytesReceived))
  935. {
  936. LOG_MSG_DEBUG("Comparing aggregated packet failed!\n");
  937. print_buff(pReceivedPacket, nBytesReceived);
  938. return false;
  939. }
  940. return true;
  941. }
  942. /////////////////////////////////////////////////////////////////////////////////
  943. bool MBIMAggregationScenarios::MBIMDeaggregationMultipleNDPTest(
  944. Pipe* input, Pipe* output,
  945. enum ipa_ip_type m_eIP)
  946. {
  947. bool bTestResult = true;
  948. //The packets that the aggregated packet will be made of
  949. Byte pExpectedPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  950. //The real sizes of the packets that the aggregated packet will be made of
  951. int pPacketsSizes[NUM_PACKETS];
  952. //Buffers for the packets that will be received
  953. Byte pReceivedPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  954. //Total size of all the packets that the aggregated packet will be made of
  955. //(this is the max size of the aggregated packet
  956. //minus the size of the header and the 2 NDPs)
  957. int nTotalPacketsSize = MAX_PACKET_SIZE - (4 * NUM_PACKETS) - 36;
  958. //The aggregated packet that will be sent
  959. Byte pAggregatedPacket[MAX_PACKET_SIZE] = {0};
  960. //The stream Id byte for every packet - this will determine on which NDP the
  961. //packet will appear
  962. Byte pPacketsStreamId[NUM_PACKETS] = {0};
  963. uint32_t nIPv4DSTAddr;
  964. size_t pIpPacketsSizes[NUM_PACKETS];
  965. //initialize the packets
  966. for (int i = 0; i < NUM_PACKETS; i++)
  967. {
  968. if (NUM_PACKETS - 1 == i)
  969. pPacketsSizes[i] = nTotalPacketsSize;
  970. else {
  971. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  972. pPacketsSizes[i] += (pPacketsSizes[i] % 4 == 0 ? 0 :
  973. 4 - pPacketsSizes[i] % 4);
  974. }
  975. nTotalPacketsSize -= pPacketsSizes[i];
  976. pPacketsStreamId[i] = i < 3 ? 0 : 1;
  977. // Load input data (IP packet) from file
  978. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  979. if (!LoadDefaultPacket(m_eIP, pExpectedPackets[i],
  980. pIpPacketsSizes[i]))
  981. {
  982. LOG_MSG_ERROR("Failed default Packet");
  983. return false;
  984. }
  985. nIPv4DSTAddr = ntohl(0x7F000001);
  986. memcpy (&pExpectedPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  987. sizeof(nIPv4DSTAddr));
  988. int size = pIpPacketsSizes[i];
  989. while (size < pPacketsSizes[i])
  990. {
  991. pExpectedPackets[i][size] = i;
  992. size++;
  993. }
  994. }
  995. //initializing the aggregated packet
  996. AggregatePacketsWithStreamId(pAggregatedPacket, pExpectedPackets,
  997. pPacketsSizes, NUM_PACKETS, MAX_PACKET_SIZE, pPacketsStreamId);
  998. //send the aggregated packet
  999. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes)\n",
  1000. sizeof(pAggregatedPacket));
  1001. int nBytesSent = input->Send(pAggregatedPacket, sizeof(pAggregatedPacket));
  1002. if (sizeof(pAggregatedPacket) != nBytesSent)
  1003. {
  1004. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes) "
  1005. "failed!\n", sizeof(pAggregatedPacket));
  1006. return false;
  1007. }
  1008. //receive the packets
  1009. for (int i = 0; i < NUM_PACKETS; i++)
  1010. {
  1011. LOG_MSG_DEBUG("Reading packet %d from the USB pipe(%d bytes should be "
  1012. "there)\n", i, pPacketsSizes[i]);
  1013. int nBytesReceived = output->Receive(pReceivedPackets[i],
  1014. pPacketsSizes[i]);
  1015. if (pPacketsSizes[i] != nBytesReceived)
  1016. {
  1017. LOG_MSG_DEBUG("Receiving packet %d from the USB pipe(%d bytes) "
  1018. "failed!\n", i, pPacketsSizes[i]);
  1019. print_buff(pReceivedPackets[i], nBytesReceived);
  1020. return false;
  1021. }
  1022. }
  1023. //comparing the received packet to the aggregated packet
  1024. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  1025. for (int i = 0; i < NUM_PACKETS; i++)
  1026. bTestResult &= !memcmp(pExpectedPackets[i], pReceivedPackets[i],
  1027. pPacketsSizes[i]);
  1028. return bTestResult;
  1029. }
  1030. /////////////////////////////////////////////////////////////////////////////////
  1031. bool MBIMAggregationScenarios::MBIMAggregation2PipesTest(
  1032. Pipe* input1, Pipe* input2, Pipe* output, enum ipa_ip_type m_eIP)
  1033. {
  1034. //The packets that will be sent
  1035. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  1036. //The real sizes of the packets that will be sent
  1037. int pPacketsSizes[NUM_PACKETS];
  1038. //Buffer for the packet that will be received
  1039. Byte pReceivedPacket[2*MAX_PACKET_SIZE];
  1040. //Total size of all sent packets (this is the max size of the aggregated
  1041. //packet minus the size of the header and the NDP)
  1042. int nTotalPacketsSize = MAX_PACKET_SIZE - (4 * NUM_PACKETS) - 24;
  1043. //The aggregated packet that will be sent
  1044. Byte pAggregatedPacket[2][MAX_PACKET_SIZE];
  1045. //The size of the sent aggregated packet
  1046. int nAggregatedPacketSize[2] = {0};
  1047. uint32_t nIPv4DSTAddr;
  1048. size_t pIpPacketsSizes[NUM_PACKETS];
  1049. //initialize the packets
  1050. for (int i = 0; i < NUM_PACKETS; i++)
  1051. {
  1052. if (NUM_PACKETS - 1 == i)
  1053. pPacketsSizes[i] = nTotalPacketsSize;
  1054. else
  1055. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  1056. while (0 != pPacketsSizes[i] % 4)
  1057. pPacketsSizes[i]++;
  1058. nTotalPacketsSize -= pPacketsSizes[i];
  1059. // Load input data (IP packet) from file
  1060. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  1061. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  1062. {
  1063. LOG_MSG_ERROR("Failed default Packet");
  1064. return false;
  1065. }
  1066. nIPv4DSTAddr = ntohl(0x7F000001);
  1067. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1068. sizeof(nIPv4DSTAddr));
  1069. int size = pIpPacketsSizes[i];
  1070. while (size < pPacketsSizes[i])
  1071. {
  1072. pPackets[i][size] = i;
  1073. size++;
  1074. }
  1075. }
  1076. nAggregatedPacketSize[0] += pPacketsSizes[0] + pPacketsSizes[1]; //adding the packets
  1077. nAggregatedPacketSize[0] += 12; //adding the header
  1078. nAggregatedPacketSize[0] += 12 + 4*2; //adding the NDP
  1079. //initializing the aggregated packet
  1080. AggregatePackets(pAggregatedPacket[0], pPackets, pPacketsSizes, 2,
  1081. nAggregatedPacketSize[0]);
  1082. //send the aggregated packet
  1083. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d "
  1084. "bytes)\n", nAggregatedPacketSize[0]);
  1085. int nBytesSent = input1->Send(pAggregatedPacket[0],
  1086. nAggregatedPacketSize[0]);
  1087. if (nAggregatedPacketSize[0] != nBytesSent)
  1088. {
  1089. LOG_MSG_DEBUG("Sending aggregated packet into the USB pipe(%d bytes) "
  1090. "failed!\n", nAggregatedPacketSize[0]);
  1091. return false;
  1092. }
  1093. //send the packets
  1094. for (int i = 2; i < NUM_PACKETS; i++)
  1095. {
  1096. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  1097. pPacketsSizes[i]);
  1098. int nBytesSent = input2->Send(pPackets[i], pPacketsSizes[i]);
  1099. if (pPacketsSizes[i] != nBytesSent)
  1100. {
  1101. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  1102. "failed!\n", i, pPacketsSizes[i]);
  1103. return false;
  1104. }
  1105. }
  1106. //receive the aggregated packet
  1107. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be "
  1108. "there)\n", MAX_PACKET_SIZE);
  1109. int nBytesReceived = output->Receive(pReceivedPacket, MAX_PACKET_SIZE);
  1110. if (MAX_PACKET_SIZE != nBytesReceived)
  1111. {
  1112. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes) "
  1113. "failed!\n", MAX_PACKET_SIZE);
  1114. print_buff(pReceivedPacket, nBytesReceived);
  1115. return false;
  1116. }
  1117. //deaggregating the aggregated packet
  1118. return DeaggragateAndComparePackets(pReceivedPacket, pPackets, pPacketsSizes, NUM_PACKETS, nBytesReceived);
  1119. }
  1120. /////////////////////////////////////////////////////////////////////////////////
  1121. bool MBIMAggregationScenarios::MBIMAggregationTimeLimitLoopTest(
  1122. Pipe* input, Pipe* output,
  1123. enum ipa_ip_type m_eIP)
  1124. {
  1125. //The packets that will be sent
  1126. Byte pPackets[1][MAX_PACKET_SIZE];
  1127. //The real sizes of the packets that will be sent
  1128. int pPacketsSizes[1] = {0};
  1129. //Buffer for the packet that will be received
  1130. Byte pReceivedPacket[MAX_PACKET_SIZE] = {0};
  1131. //Size of aggregated packet
  1132. int nTotalPacketsSize = 24;
  1133. uint32_t nIPv4DSTAddr;
  1134. size_t pIpPacketsSizes[NUM_PACKETS];
  1135. //initialize the packets
  1136. for (int i = 0; i < 1 ; i++)
  1137. {
  1138. pPacketsSizes[i] = 52 + 4*i;
  1139. nTotalPacketsSize += pPacketsSizes[i] + 4; //size of the packet + 4 bytes for index and length
  1140. // Load input data (IP packet) from file
  1141. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  1142. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  1143. {
  1144. LOG_MSG_ERROR("Failed default Packet");
  1145. return false;
  1146. }
  1147. nIPv4DSTAddr = ntohl(0x7F000001);
  1148. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1149. sizeof(nIPv4DSTAddr));
  1150. int size = pIpPacketsSizes[i];
  1151. while (size < pPacketsSizes[i])
  1152. {
  1153. pPackets[i][size] = i;
  1154. size++;
  1155. }
  1156. }
  1157. int nAllPacketsSizes = 0;
  1158. for (int i = 0; i < 1; i++)
  1159. nAllPacketsSizes += pPacketsSizes[i];
  1160. while (0 != nAllPacketsSizes % 4)
  1161. {
  1162. nAllPacketsSizes++;
  1163. nTotalPacketsSize++; //zero padding for NDP offset to be 4x
  1164. }
  1165. for (int k = 0; k < AGGREGATION_LOOP; k++)
  1166. {
  1167. //send the packets
  1168. for (int i = 0; i < 1; i++)
  1169. {
  1170. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  1171. pPacketsSizes[i]);
  1172. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  1173. if (pPacketsSizes[i] != nBytesSent)
  1174. {
  1175. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  1176. "failed!\n", i, pPacketsSizes[i]);
  1177. return false;
  1178. }
  1179. }
  1180. //receive the aggregated packet
  1181. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be "
  1182. "there)\n", nTotalPacketsSize);
  1183. int nBytesReceived = output->Receive(pReceivedPacket,
  1184. nTotalPacketsSize);
  1185. // IPA HW may add padding to the packets to align to 4B
  1186. if (nTotalPacketsSize > nBytesReceived)
  1187. {
  1188. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d "
  1189. "bytes) failed!\n", nTotalPacketsSize);
  1190. print_buff(pReceivedPacket, nBytesReceived);
  1191. return false;
  1192. }
  1193. //comparing the received packet to the aggregated packet
  1194. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  1195. if (false == DeaggragateAndComparePackets(pReceivedPacket, pPackets,
  1196. pPacketsSizes, 1, nBytesReceived))
  1197. {
  1198. LOG_MSG_DEBUG("Comparing aggregated packet failed!\n");
  1199. return false;
  1200. }
  1201. }
  1202. return true;
  1203. }
  1204. /////////////////////////////////////////////////////////////////////////////////
  1205. bool MBIMAggregationScenarios::MBIMAggregation0LimitsTest(
  1206. Pipe* input, Pipe* output,
  1207. enum ipa_ip_type m_eIP)
  1208. {
  1209. //The packets that will be sent
  1210. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  1211. //The real sizes of the packets that will be sent
  1212. int pPacketsSizes[NUM_PACKETS];
  1213. //Buffer for the packet that will be received
  1214. Byte pReceivedPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  1215. //The expected aggregated packets sizes
  1216. int pAggragatedPacketsSizes[NUM_PACKETS] = {0};
  1217. uint32_t nIPv4DSTAddr;
  1218. size_t pIpPacketsSizes[NUM_PACKETS];
  1219. //initialize the packets
  1220. for (int i = 0; i < NUM_PACKETS ; i++)
  1221. {
  1222. pPacketsSizes[i] = 52 + 4*i;
  1223. // Load input data (IP packet) from file
  1224. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  1225. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  1226. {
  1227. LOG_MSG_ERROR("Failed default Packet");
  1228. return false;
  1229. }
  1230. nIPv4DSTAddr = ntohl(0x7F000001);
  1231. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1232. sizeof(nIPv4DSTAddr));
  1233. int size = pIpPacketsSizes[i];
  1234. while (size < pPacketsSizes[i])
  1235. {
  1236. pPackets[i][size] = i;
  1237. size++;
  1238. }
  1239. }
  1240. //calculate aggregated packets sizes
  1241. for (int i = 0; i < NUM_PACKETS; i++)
  1242. {
  1243. pAggragatedPacketsSizes[i] += pPacketsSizes[i];
  1244. while (0 != pAggragatedPacketsSizes[i] % 4)
  1245. pAggragatedPacketsSizes[i]++; //zero padding for NDP offset to be 4x
  1246. pAggragatedPacketsSizes[i] += 28; //header + NDP
  1247. }
  1248. //send the packets
  1249. for (int i = 0; i < NUM_PACKETS; i++)
  1250. {
  1251. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  1252. pPacketsSizes[i]);
  1253. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  1254. if (pPacketsSizes[i] != nBytesSent)
  1255. {
  1256. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  1257. "failed!\n", i, pPacketsSizes[i]);
  1258. return false;
  1259. }
  1260. }
  1261. //receive the aggregated packets
  1262. for (int i = 0; i < NUM_PACKETS; i++)
  1263. {
  1264. LOG_MSG_DEBUG("Reading packet %d from the USB pipe(%d bytes should be "
  1265. "there)\n", i, pAggragatedPacketsSizes[i]);
  1266. int nBytesReceived = output->Receive(pReceivedPackets[i],
  1267. pAggragatedPacketsSizes[i]);
  1268. // IPA HW may add padding to the packets to align to 4B
  1269. if (pAggragatedPacketsSizes[i] > nBytesReceived)
  1270. {
  1271. LOG_MSG_DEBUG("Receiving aggregated packet %d from the USB pipe(%d "
  1272. "bytes) failed!\n", i, pAggragatedPacketsSizes[i]);
  1273. print_buff(pReceivedPackets[i], nBytesReceived);
  1274. return false;
  1275. }
  1276. pAggragatedPacketsSizes[i] = nBytesReceived;
  1277. }
  1278. //comparing the received packet to the aggregated packet
  1279. LOG_MSG_DEBUG("Checking sent.vs.received packet\n");
  1280. for (int i = 0; i < NUM_PACKETS; i++)
  1281. {
  1282. if (false == DeaggragateAndCompareOnePacket(pReceivedPackets[i],
  1283. pPackets[i], pPacketsSizes[i], pAggragatedPacketsSizes[i]))
  1284. {
  1285. LOG_MSG_DEBUG("Comparing aggregated packet %d failed!\n", i);
  1286. return false;
  1287. }
  1288. }
  1289. return true;
  1290. }
  1291. /////////////////////////////////////////////////////////////////////////////////
  1292. bool MBIMAggregationScenarios::MBIMAggregationMultiplePacketsTest(
  1293. Pipe* input, Pipe* output,
  1294. enum ipa_ip_type m_eIP)
  1295. {
  1296. //The packets that will be sent
  1297. Byte pPackets[MAX_PACKETS_IN_NDP + 1][MAX_PACKET_SIZE];
  1298. //The real sizes of the packets that will be sent
  1299. int pPacketsSizes[MAX_PACKETS_IN_NDP + 1];
  1300. //Buffer for the packet that will be received
  1301. Byte pReceivedPacket[2*MAX_PACKET_SIZE];
  1302. uint32_t nIPv4DSTAddr;
  1303. size_t pIpPacketsSizes[MAX_PACKETS_IN_NDP + 1];
  1304. //Total size of all sent packets (this is the max size of the aggregated packet
  1305. //minus the size of the header and the 2 NDPs)
  1306. int nTotalPacketsSize = MAX_PACKET_SIZE - (4 * (MAX_PACKETS_IN_NDP + 1)) - 24;
  1307. //initialize the packets
  1308. for (int i = 0; i < MAX_PACKETS_IN_NDP + 1; i++)
  1309. {
  1310. if (MAX_PACKETS_IN_NDP == i)
  1311. pPacketsSizes[i] = nTotalPacketsSize;
  1312. else
  1313. {
  1314. pPacketsSizes[i] = nTotalPacketsSize / (MAX_PACKETS_IN_NDP + 1);
  1315. pPacketsSizes[i] += (pPacketsSizes[i] % 4 == 0 ? 0 :
  1316. 4 - pPacketsSizes[i] % 4);
  1317. }
  1318. nTotalPacketsSize -= pPacketsSizes[i];
  1319. // Load input data (IP packet) from file
  1320. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  1321. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  1322. {
  1323. LOG_MSG_ERROR("Failed default Packet");
  1324. return false;
  1325. }
  1326. nIPv4DSTAddr = ntohl(0x7F000001);
  1327. memcpy (&pPackets[i][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1328. sizeof(nIPv4DSTAddr));
  1329. int size = pIpPacketsSizes[i];
  1330. while (size < pPacketsSizes[i])
  1331. {
  1332. pPackets[i][size] = i;
  1333. size++;
  1334. }
  1335. }
  1336. //send the packets
  1337. for (int i = 0; i < MAX_PACKETS_IN_NDP + 1; i++)
  1338. {
  1339. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  1340. pPacketsSizes[i]);
  1341. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  1342. if (pPacketsSizes[i] != nBytesSent)
  1343. {
  1344. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  1345. "failed!\n", i, pPacketsSizes[i]);
  1346. return false;
  1347. }
  1348. }
  1349. //receive the aggregated packet
  1350. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be "
  1351. "there)\n", MAX_PACKET_SIZE);
  1352. int nBytesReceived = output->Receive(pReceivedPacket, MAX_PACKET_SIZE);
  1353. if (MAX_PACKET_SIZE != nBytesReceived)
  1354. {
  1355. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes) "
  1356. "failed!\n", MAX_PACKET_SIZE);
  1357. print_buff(pReceivedPacket, nBytesReceived);
  1358. return false;
  1359. }
  1360. //deaggregating the aggregated packet
  1361. return DeaggragateAndComparePackets(pReceivedPacket, pPackets,
  1362. pPacketsSizes, MAX_PACKETS_IN_NDP+1, nBytesReceived);
  1363. }
  1364. /////////////////////////////////////////////////////////////////////////////////
  1365. bool MBIMAggregationScenarios::MBIMAggregationDifferentStreamIdsTest(
  1366. Pipe* input, Pipe* output,
  1367. enum ipa_ip_type m_eIP)
  1368. {
  1369. //The packets that will be sent
  1370. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  1371. //The real sizes of the packets that will be sent
  1372. int pPacketsSizes[NUM_PACKETS];
  1373. //Buffer for the packet that will be received
  1374. Byte pReceivedPacket[2*MAX_PACKET_SIZE];
  1375. //Total size of all sent packets (this is the max size of the aggregated
  1376. //packet minus the size of the header and the NDPs)
  1377. int nTotalPacketsSize = MAX_PACKET_SIZE - (16 * NUM_PACKETS) - 12;
  1378. uint32_t nIPv4DSTAddr;
  1379. size_t pIpPacketsSizes[NUM_PACKETS];
  1380. Byte pPacketsStreamId[NUM_PACKETS];
  1381. //initialize the packets
  1382. for (int i = 0; i < NUM_PACKETS; i++)
  1383. {
  1384. pPacketsStreamId[i] = i;
  1385. if (NUM_PACKETS - 1 == i)
  1386. pPacketsSizes[i] = nTotalPacketsSize + 12;
  1387. else
  1388. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  1389. while (0 != pPacketsSizes[i] % 4)
  1390. pPacketsSizes[i]++;
  1391. nTotalPacketsSize -= pPacketsSizes[i];
  1392. // Load input data (IP packet) from file
  1393. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  1394. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  1395. {
  1396. LOG_MSG_ERROR("Failed default Packet");
  1397. return false;
  1398. }
  1399. int size = pIpPacketsSizes[i];
  1400. while (size < pPacketsSizes[i])
  1401. {
  1402. pPackets[i][size] = i;
  1403. size++;
  1404. }
  1405. }
  1406. nIPv4DSTAddr = ntohl(0x7F000001);
  1407. memcpy (&pPackets[0][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1408. sizeof(nIPv4DSTAddr));
  1409. nIPv4DSTAddr = ntohl(0xC0A80101);
  1410. memcpy (&pPackets[1][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1411. sizeof(nIPv4DSTAddr));
  1412. nIPv4DSTAddr = ntohl(0xC0A80102);
  1413. memcpy (&pPackets[2][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1414. sizeof(nIPv4DSTAddr));
  1415. nIPv4DSTAddr = ntohl(0xC0A80103);
  1416. memcpy (&pPackets[3][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1417. sizeof(nIPv4DSTAddr));
  1418. nIPv4DSTAddr = ntohl(0xC0A80104);
  1419. memcpy (&pPackets[4][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1420. sizeof(nIPv4DSTAddr));
  1421. //send the packets
  1422. for (int i = 0; i < NUM_PACKETS; i++)
  1423. {
  1424. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  1425. pPacketsSizes[i]);
  1426. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  1427. if (pPacketsSizes[i] != nBytesSent)
  1428. {
  1429. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  1430. "failed!\n", i, pPacketsSizes[i]);
  1431. return false;
  1432. }
  1433. }
  1434. //receive the aggregated packet
  1435. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be "
  1436. "there)\n", MAX_PACKET_SIZE + 12);
  1437. int nBytesReceived = output->Receive(pReceivedPacket, MAX_PACKET_SIZE + 12);
  1438. if (MAX_PACKET_SIZE + 12 != nBytesReceived)
  1439. {
  1440. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes) "
  1441. "failed!\n", MAX_PACKET_SIZE + 12);
  1442. print_buff(pReceivedPacket, nBytesReceived + 12);
  1443. return false;
  1444. }
  1445. //deaggregating the aggregated packet
  1446. return DeaggragateAndComparePacketsWithStreamId(pReceivedPacket, pPackets,
  1447. pPacketsSizes, NUM_PACKETS, nBytesReceived, pPacketsStreamId);
  1448. }
  1449. /////////////////////////////////////////////////////////////////////////////////
  1450. bool MBIMAggregationScenarios::MBIMAggregationNoInterleavingStreamIdsTest(
  1451. Pipe* input, Pipe* output,
  1452. enum ipa_ip_type m_eIP)
  1453. {
  1454. //The packets that will be sent
  1455. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE];
  1456. //The real sizes of the packets that will be sent
  1457. int pPacketsSizes[NUM_PACKETS];
  1458. //Buffer for the packet that will be received
  1459. Byte pReceivedPacket[2*MAX_PACKET_SIZE];
  1460. //Total size of all sent packets (this is the max size of the aggregated packet
  1461. //minus the size of the header and the NDPs)
  1462. int nTotalPacketsSize = MAX_PACKET_SIZE - (16 * NUM_PACKETS) - 12;
  1463. uint32_t nIPv4DSTAddr;
  1464. size_t pIpPacketsSizes[NUM_PACKETS];
  1465. Byte pPacketsStreamId[NUM_PACKETS];
  1466. //initialize the packets
  1467. for (int i = 0; i < NUM_PACKETS; i++)
  1468. {
  1469. pPacketsStreamId[i] = i % 2;
  1470. if (NUM_PACKETS - 1 == i)
  1471. pPacketsSizes[i] = nTotalPacketsSize + 12;
  1472. else
  1473. pPacketsSizes[i] = nTotalPacketsSize / NUM_PACKETS;
  1474. while (0 != pPacketsSizes[i] % 4)
  1475. pPacketsSizes[i]++;
  1476. nTotalPacketsSize -= pPacketsSizes[i];
  1477. // Load input data (IP packet) from file
  1478. pIpPacketsSizes[i] = MAX_PACKET_SIZE;
  1479. if (!LoadDefaultPacket(m_eIP, pPackets[i], pIpPacketsSizes[i]))
  1480. {
  1481. LOG_MSG_ERROR("Failed default Packet");
  1482. return false;
  1483. }
  1484. int size = pIpPacketsSizes[i];
  1485. while (size < pPacketsSizes[i])
  1486. {
  1487. pPackets[i][size] = i;
  1488. size++;
  1489. }
  1490. }
  1491. nIPv4DSTAddr = ntohl(0x7F000001);
  1492. memcpy (&pPackets[0][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1493. sizeof(nIPv4DSTAddr));
  1494. nIPv4DSTAddr = ntohl(0xC0A80101);
  1495. memcpy (&pPackets[1][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1496. sizeof(nIPv4DSTAddr));
  1497. nIPv4DSTAddr = ntohl(0x7F000001);
  1498. memcpy (&pPackets[2][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1499. sizeof(nIPv4DSTAddr));
  1500. nIPv4DSTAddr = ntohl(0xC0A80101);
  1501. memcpy (&pPackets[3][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1502. sizeof(nIPv4DSTAddr));
  1503. nIPv4DSTAddr = ntohl(0x7F000001);
  1504. memcpy (&pPackets[4][IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,
  1505. sizeof(nIPv4DSTAddr));
  1506. //send the packets
  1507. for (int i = 0; i < NUM_PACKETS; i++)
  1508. {
  1509. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes)\n", i,
  1510. pPacketsSizes[i]);
  1511. int nBytesSent = input->Send(pPackets[i], pPacketsSizes[i]);
  1512. if (pPacketsSizes[i] != nBytesSent)
  1513. {
  1514. LOG_MSG_DEBUG("Sending packet %d into the USB pipe(%d bytes) "
  1515. "failed!\n", i, pPacketsSizes[i]);
  1516. return false;
  1517. }
  1518. }
  1519. //receive the aggregated packet
  1520. LOG_MSG_DEBUG("Reading packet from the USB pipe(%d bytes should be "
  1521. "there)\n", MAX_PACKET_SIZE + 12);
  1522. int nBytesReceived = output->Receive(pReceivedPacket,
  1523. MAX_PACKET_SIZE + 12);
  1524. if (MAX_PACKET_SIZE + 12 != nBytesReceived)
  1525. {
  1526. LOG_MSG_DEBUG("Receiving aggregated packet from the USB pipe(%d bytes)"
  1527. " failed!\n", MAX_PACKET_SIZE + 12);
  1528. print_buff(pReceivedPacket, nBytesReceived + 12);
  1529. return false;
  1530. }
  1531. //deaggregating the aggregated packet
  1532. return DeaggragateAndComparePacketsWithStreamId(pReceivedPacket, pPackets,
  1533. pPacketsSizes, NUM_PACKETS, nBytesReceived, pPacketsStreamId);
  1534. }
  1535. /////////////////////////////////////////////////////////////////////////////////
  1536. /////////////////////////////////////////////////////////////////////////////////
  1537. /////////////////////////////////////////////////////////////////////////////////
  1538. bool MBIMAggregationScenarios::DeaggragateAndComparePackets(
  1539. Byte pAggregatedPacket[MAX_PACKET_SIZE],
  1540. Byte pExpectedPackets[MAX_PACKETS_IN_MBIM_TESTS][MAX_PACKET_SIZE],
  1541. int pPacketsSizes[MAX_PACKETS_IN_MBIM_TESTS], int nNumPackets, int nAggregatedPacketSize)
  1542. {
  1543. int nPacketNum = 0;
  1544. int i = 0;
  1545. int nNdpStart = 0;
  1546. Byte pNdpIndex[2] = {0};
  1547. Byte pNdpLen[2] = {0};
  1548. if (0x4e != pAggregatedPacket[i] || 0x43 != pAggregatedPacket[i+1] ||
  1549. 0x4d != pAggregatedPacket[i+2]|| 0x48 != pAggregatedPacket[i+3])
  1550. {
  1551. LOG_MSG_DEBUG("Error: Wrong NTH16 signature: 0x%02x 0x%02x 0x%02x "
  1552. "0x%02x(should be 0x4e, 0x43, 0x4d, 0x48)\n",
  1553. pAggregatedPacket[i], pAggregatedPacket[i+1],
  1554. pAggregatedPacket[i+2], pAggregatedPacket[i+3]);
  1555. return false;
  1556. }
  1557. i += 4;
  1558. if (0x0c != pAggregatedPacket[i] || 0x00 != pAggregatedPacket[i+1])
  1559. {
  1560. LOG_MSG_DEBUG("Error: Wrong header length: 0x%02x 0x%02x(should be 0x0c, "
  1561. "0x00)\n",
  1562. pAggregatedPacket[i], pAggregatedPacket[i+1]);
  1563. return false;
  1564. }
  1565. i += 4; //ignoring sequence number
  1566. if ((nAggregatedPacketSize & 0x00FF) != pAggregatedPacket[i] ||
  1567. (nAggregatedPacketSize >> 8) != pAggregatedPacket[i+1])
  1568. {
  1569. LOG_MSG_DEBUG("Error: Wrong aggregated packet length: 0x%02x 0x%02x"
  1570. "(should be 0x%02x, 0x%02x)\n",
  1571. pAggregatedPacket[i], pAggregatedPacket[i+1],
  1572. nAggregatedPacketSize & 0x00FF, nAggregatedPacketSize >> 8);
  1573. return false;
  1574. }
  1575. i += 2;
  1576. pNdpIndex[0] = pAggregatedPacket[i]; //least significant byte
  1577. pNdpIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  1578. //reading the NDP
  1579. while (0x00 != pNdpIndex[0] || 0x00 != pNdpIndex[1])
  1580. {
  1581. i = pNdpIndex[0] + 256*pNdpIndex[1]; //NDP should begin here
  1582. nNdpStart = i;
  1583. if (0x49 != pAggregatedPacket[i] || 0x50 != pAggregatedPacket[i + 1] ||
  1584. 0x53 != pAggregatedPacket[i + 2] || 0x00 != pAggregatedPacket[i + 3])
  1585. {
  1586. LOG_MSG_DEBUG("Error: Wrong NDP16 signature: 0x%02x 0x%02x "
  1587. "0x%02x 0x%02x(should be 0x49, 0x50, 0x53, 0x00)\n",
  1588. pAggregatedPacket[i], pAggregatedPacket[i + 1],
  1589. pAggregatedPacket[i + 2], pAggregatedPacket[i + 3]);
  1590. return false;
  1591. }
  1592. i += 4;
  1593. pNdpLen[0] = pAggregatedPacket[i]; //least significant byte
  1594. pNdpLen[1] = pAggregatedPacket[i+1]; //most significant byte
  1595. if (0x00 != pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2] ||
  1596. 0x00 != pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] -1])
  1597. {
  1598. LOG_MSG_DEBUG("Error: Wrong end of NDP: 0x%02x 0x%02x(should be 0x00,"
  1599. " 0x00)\n",
  1600. pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2],
  1601. pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 1]);
  1602. return false;
  1603. }
  1604. i += 2;
  1605. pNdpIndex[0] = pAggregatedPacket[i]; //least significant byte
  1606. pNdpIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  1607. i += 2;
  1608. while (i <= nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2)
  1609. { //going over all the datagrams in this NDP
  1610. Byte pDatagramIndex[2] = {0};
  1611. Byte pDatagramLen[2] = {0};
  1612. int packetIndex = 0;
  1613. pDatagramIndex[0] = pAggregatedPacket[i]; //least significant byte
  1614. pDatagramIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  1615. i += 2;
  1616. if (0x00 == pDatagramIndex[0] && 0x00 == pDatagramIndex[1])
  1617. break; //zero padding after all datagrams
  1618. if (nPacketNum >= nNumPackets)
  1619. {
  1620. LOG_MSG_DEBUG("Error: wrong number of packets: %d(should be %d)\n",
  1621. nPacketNum, nNumPackets);
  1622. return false;
  1623. }
  1624. pDatagramLen[0] = pAggregatedPacket[i]; //least significant byte
  1625. pDatagramLen[1] = pAggregatedPacket[i+1]; //most significant byte
  1626. i += 2;
  1627. packetIndex = pDatagramIndex[0] + 256*pDatagramIndex[1];
  1628. if (pDatagramLen[0] + 256*pDatagramLen[1] != pPacketsSizes[nPacketNum])
  1629. {
  1630. LOG_MSG_DEBUG("Error: Wrong packet %d length: 0x%02x 0x%02x"
  1631. "(should be %d)\n", nPacketNum, pDatagramLen[0],
  1632. pDatagramLen[1], pPacketsSizes[nPacketNum]);
  1633. return false;
  1634. }
  1635. if (0 != memcmp(pExpectedPackets[nPacketNum],
  1636. &pAggregatedPacket[packetIndex], pPacketsSizes[nPacketNum]))
  1637. {
  1638. LOG_MSG_DEBUG("Error: Comparison of packet %d failed!\n",
  1639. nPacketNum);
  1640. return false;
  1641. }
  1642. nPacketNum++;
  1643. }
  1644. }
  1645. return true;
  1646. }
  1647. /////////////////////////////////////////////////////////////////////////////////
  1648. void MBIMAggregationScenarios::AggregatePackets(
  1649. Byte pAggregatedPacket[MAX_PACKET_SIZE]/*ouput*/,
  1650. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE],
  1651. int pPacketsSizes[NUM_PACKETS], int nNumPackets,
  1652. int nAggregatedPacketSize)
  1653. {
  1654. int i = 0;
  1655. int pDatagramIndexes[NUM_PACKETS] = {0};
  1656. int nNdpIndex = 0;
  1657. int nNdpLen = 0;
  1658. //NTH16 signature
  1659. pAggregatedPacket[i] = 0x4e;
  1660. pAggregatedPacket[i+1] = 0x43;
  1661. pAggregatedPacket[i+2] = 0x4d;
  1662. pAggregatedPacket[i+3] = 0x48;
  1663. i += 4;
  1664. //header length
  1665. pAggregatedPacket[i] = 0x0c;
  1666. pAggregatedPacket[i+1] = 0x00;
  1667. i += 2;
  1668. //sequence number
  1669. pAggregatedPacket[i] = 0x00;
  1670. pAggregatedPacket[i+1] = 0x00;
  1671. i += 2;
  1672. //aggregated packet length
  1673. pAggregatedPacket[i] = nAggregatedPacketSize & 0x00FF;
  1674. pAggregatedPacket[i+1] = nAggregatedPacketSize >> 8;
  1675. i += 2;
  1676. //NDP index
  1677. for (int j = 0; j < nNumPackets; j++)
  1678. nNdpIndex += pPacketsSizes[j];
  1679. nNdpIndex += i + 2;
  1680. while (0 != nNdpIndex % 4)
  1681. nNdpIndex++;
  1682. pAggregatedPacket[i] = nNdpIndex & 0x00FF;
  1683. pAggregatedPacket[i+1] = nNdpIndex >> 8;
  1684. i += 2;
  1685. //packets
  1686. for (int j = 0; j < nNumPackets; j++)
  1687. {
  1688. pDatagramIndexes[j] = i;
  1689. for (int k = 0; k < pPacketsSizes[j]; k++)
  1690. {
  1691. pAggregatedPacket[i] = pPackets[j][k];
  1692. i++;
  1693. }
  1694. }
  1695. while (i < nNdpIndex)
  1696. {
  1697. pAggregatedPacket[i] = 0x00;
  1698. i++;
  1699. }
  1700. //NDP16 signature
  1701. pAggregatedPacket[i] = 0x49;
  1702. pAggregatedPacket[i+1] = 0x50;
  1703. pAggregatedPacket[i+2] = 0x53;
  1704. pAggregatedPacket[i+3] = 0x00;
  1705. i += 4;
  1706. //NDP length
  1707. nNdpLen = 4*nNumPackets + 8 + 2;
  1708. while (nNdpLen % 4 != 0)
  1709. nNdpLen += 2;
  1710. pAggregatedPacket[i] = nNdpLen & 0x00FF;
  1711. pAggregatedPacket[i+1] = nNdpLen >> 8;
  1712. i += 2;
  1713. //next NDP
  1714. pAggregatedPacket[i] = 0x00;
  1715. pAggregatedPacket[i+1] = 0x00;
  1716. i += 2;
  1717. for (int j = 0; j < nNumPackets; j++)
  1718. {
  1719. //datagram index
  1720. pAggregatedPacket[i] = pDatagramIndexes[j] & 0x00FF;
  1721. pAggregatedPacket[i+1] = pDatagramIndexes[j] >> 8;
  1722. i += 2;
  1723. //datagram length
  1724. pAggregatedPacket[i] = pPacketsSizes[j] & 0x00FF;
  1725. pAggregatedPacket[i+1] = pPacketsSizes[j] >> 8;
  1726. i += 2;
  1727. }
  1728. //zeros in the end of NDP
  1729. while (i < nAggregatedPacketSize)
  1730. {
  1731. pAggregatedPacket[i] = 0x00;
  1732. i++;
  1733. }
  1734. }
  1735. /////////////////////////////////////////////////////////////////////////////////
  1736. void MBIMAggregationScenarios::AggregatePacketsWithStreamId(
  1737. Byte pAggregatedPacket[MAX_PACKET_SIZE]/*ouput*/,
  1738. Byte pPackets[NUM_PACKETS][MAX_PACKET_SIZE],
  1739. int pPacketsSizes[NUM_PACKETS], int nNumPackets, int nAggregatedPacketSize,
  1740. Byte pPacketsStreamId[NUM_PACKETS])
  1741. {
  1742. int i = 0;
  1743. int n = 0;
  1744. int pDatagramIndexes[NUM_PACKETS] = {0};
  1745. int nNdpIndex[NUM_PACKETS] = {0};
  1746. int nNdpLen = 0;
  1747. Byte currStreamId = pPacketsStreamId[0];
  1748. int nNdpFirstPacket[NUM_PACKETS] = {0};
  1749. int nNdpAfterLastPacket[NUM_PACKETS] = {0};
  1750. int nNumNDPs = 0;
  1751. for (n = 0; n < nNumPackets; n++)
  1752. {
  1753. if (currStreamId != pPacketsStreamId[n])
  1754. {
  1755. nNdpAfterLastPacket[nNumNDPs] = n;
  1756. nNumNDPs++;
  1757. nNdpFirstPacket[nNumNDPs] = n;
  1758. currStreamId = pPacketsStreamId[n];
  1759. }
  1760. }
  1761. nNdpAfterLastPacket[nNumNDPs] = n;
  1762. nNumNDPs++;
  1763. //calculate NDP indexes
  1764. nNdpIndex[0] += 12; //adding the header
  1765. for (int j = 0; j < nNumNDPs; j++)
  1766. {
  1767. for (n = nNdpFirstPacket[j]; n < nNdpAfterLastPacket[j]; n++)
  1768. nNdpIndex[j] += pPacketsSizes[n]; //adding the packets
  1769. while (0 != nNdpIndex[j] % 4)
  1770. nNdpIndex[j]++;
  1771. if (j < nNumNDPs - 1)
  1772. nNdpIndex[j+1] += nNdpIndex[j] + 12 + 4*(nNdpAfterLastPacket[j] -
  1773. nNdpFirstPacket[j]); //adding the location after the current NDP to the next NDP
  1774. }
  1775. //start building the aggregated packet
  1776. //NTH16 signature
  1777. pAggregatedPacket[i] = 0x4e;
  1778. pAggregatedPacket[i+1] = 0x43;
  1779. pAggregatedPacket[i+2] = 0x4d;
  1780. pAggregatedPacket[i+3] = 0x48;
  1781. i += 4;
  1782. //header length
  1783. pAggregatedPacket[i] = 0x0c;
  1784. pAggregatedPacket[i+1] = 0x00;
  1785. i += 2;
  1786. //sequence number
  1787. pAggregatedPacket[i] = 0x00;
  1788. pAggregatedPacket[i+1] = 0x00;
  1789. i += 2;
  1790. //aggregated packet length
  1791. pAggregatedPacket[i] = nAggregatedPacketSize & 0x00FF;
  1792. pAggregatedPacket[i+1] = nAggregatedPacketSize >> 8;;
  1793. i += 2;
  1794. //first NDP index
  1795. pAggregatedPacket[i] = nNdpIndex[0] & 0x00FF;
  1796. pAggregatedPacket[i+1] = nNdpIndex[0] >> 8;
  1797. i += 2;
  1798. for (n = 0; n < nNumNDPs; n++)
  1799. {
  1800. //packets
  1801. for (int j = nNdpFirstPacket[n]; j < nNdpAfterLastPacket[n]; j++)
  1802. {
  1803. pDatagramIndexes[j] = i;
  1804. for (int k = 0; k < pPacketsSizes[j]; k++)
  1805. {
  1806. pAggregatedPacket[i] = pPackets[j][k];
  1807. i++;
  1808. }
  1809. }
  1810. while (i < nNdpIndex[n])
  1811. {
  1812. pAggregatedPacket[i] = 0x00;
  1813. i++;
  1814. }
  1815. //NDP signature
  1816. pAggregatedPacket[i] = 0x49;
  1817. pAggregatedPacket[i+1] = 0x50;
  1818. pAggregatedPacket[i+2] = 0x53;
  1819. pAggregatedPacket[i+3] = pPacketsStreamId[nNdpFirstPacket[n]];
  1820. i += 4;
  1821. //NDP length
  1822. nNdpLen = 4*(nNdpAfterLastPacket[n] - nNdpFirstPacket[n]) + 8 + 2;
  1823. while (nNdpLen % 4 != 0)
  1824. nNdpLen += 2;
  1825. pAggregatedPacket[i] = nNdpLen & 0x00FF;
  1826. pAggregatedPacket[i+1] = nNdpLen >> 8;
  1827. i += 2;
  1828. //next NDP
  1829. pAggregatedPacket[i] = nNdpIndex[n+1] & 0x00FF;
  1830. pAggregatedPacket[i+1] = nNdpIndex[n+1] >> 8;
  1831. i += 2;
  1832. for (int j = nNdpFirstPacket[n]; j < nNdpAfterLastPacket[n]; j++)
  1833. {
  1834. //datagram index
  1835. pAggregatedPacket[i] = pDatagramIndexes[j] & 0x00FF;
  1836. pAggregatedPacket[i+1] = pDatagramIndexes[j] >> 8;
  1837. i += 2;
  1838. //datagram length
  1839. pAggregatedPacket[i] = pPacketsSizes[j] & 0x00FF;
  1840. pAggregatedPacket[i+1] = pPacketsSizes[j] >> 8;
  1841. i += 2;
  1842. }
  1843. //zeros in the end of NDP
  1844. while (i < nNdpIndex[n] + nNdpLen)
  1845. {
  1846. pAggregatedPacket[i] = 0x00;
  1847. i++;
  1848. }
  1849. }
  1850. }
  1851. /////////////////////////////////////////////////////////////////////////////////
  1852. bool MBIMAggregationScenarios::DeaggragateAndCompareOnePacket(
  1853. Byte pAggregatedPacket[MAX_PACKET_SIZE],
  1854. Byte pExpectedPacket[MAX_PACKET_SIZE], int nPacketsSize,
  1855. int nAggregatedPacketSize)
  1856. {
  1857. int nPacketNum = 0;
  1858. int i = 0;
  1859. int nNdpStart = 0;
  1860. Byte pNdpIndex[2] = {0};
  1861. Byte pNdpLen[2] = {0};
  1862. if (0x4e != pAggregatedPacket[i] || 0x43 != pAggregatedPacket[i+1] ||
  1863. 0x4d != pAggregatedPacket[i+2]|| 0x48 != pAggregatedPacket[i+3])
  1864. {
  1865. LOG_MSG_DEBUG("Error: Wrong NTH16 signature: 0x%02x 0x%02x 0x%02x "
  1866. "0x%02x(should be 0x4e, 0x43, 0x4d, 0x48)\n",
  1867. pAggregatedPacket[i], pAggregatedPacket[i+1],
  1868. pAggregatedPacket[i+2], pAggregatedPacket[i+3]);
  1869. return false;
  1870. }
  1871. i += 4;
  1872. if (0x0c != pAggregatedPacket[i] || 0x00 != pAggregatedPacket[i+1])
  1873. {
  1874. LOG_MSG_DEBUG("Error: Wrong header length: 0x%02x 0x%02x(should be 0x0c,"
  1875. " 0x00)\n", pAggregatedPacket[i], pAggregatedPacket[i+1]);
  1876. return false;
  1877. }
  1878. i += 4; //ignoring sequence number
  1879. if ((nAggregatedPacketSize & 0x00FF) != pAggregatedPacket[i] ||
  1880. (nAggregatedPacketSize >> 8) != pAggregatedPacket[i+1])
  1881. {
  1882. LOG_MSG_DEBUG("Error: Wrong aggregated packet length: 0x%02x 0x%02x"
  1883. "(should be 0x%02x, 0x%02x)\n",
  1884. pAggregatedPacket[i], pAggregatedPacket[i+1],
  1885. nAggregatedPacketSize & 0x00FF, nAggregatedPacketSize >> 8);
  1886. return false;
  1887. }
  1888. i += 2;
  1889. pNdpIndex[0] = pAggregatedPacket[i]; //least significant byte
  1890. pNdpIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  1891. //reading the NDP
  1892. while (0x00 != pNdpIndex[0] || 0x00 != pNdpIndex[1])
  1893. {
  1894. i = pNdpIndex[0] + 256*pNdpIndex[1]; //NDP should begin here
  1895. nNdpStart = i;
  1896. if (0x49 != pAggregatedPacket[i] || 0x50 != pAggregatedPacket[i+1] ||
  1897. 0x53 != pAggregatedPacket[i+2] || 0x00 != pAggregatedPacket[i+3])
  1898. {
  1899. LOG_MSG_DEBUG("Error: Wrong NDP16 signature: 0x%02x 0x%02x "
  1900. "0x%02x 0x%02x(should be 0x49, 0x50, 0x53, 0x00)\n",
  1901. pAggregatedPacket[i], pAggregatedPacket[i+1],
  1902. pAggregatedPacket[i+2], pAggregatedPacket[i+3]);
  1903. return false;
  1904. }
  1905. i += 4;
  1906. pNdpLen[0] = pAggregatedPacket[i]; //least significant byte
  1907. pNdpLen[1] = pAggregatedPacket[i+1]; //most significant byte
  1908. if (0x00 != pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2] ||
  1909. 0x00 != pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] -1])
  1910. {
  1911. LOG_MSG_DEBUG("Error: Wrong end of NDP: 0x%02x 0x%02x(should be "
  1912. "0x00, 0x00)\n",
  1913. pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2],
  1914. pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 1]);
  1915. return false;
  1916. }
  1917. i += 2;
  1918. pNdpIndex[0] = pAggregatedPacket[i]; //least significant byte
  1919. pNdpIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  1920. i += 2;
  1921. while (i <= nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2)
  1922. { //going over all the datagrams in this NDP
  1923. Byte pDatagramIndex[2] = {0};
  1924. Byte pDatagramLen[2] = {0};
  1925. int packetIndex = 0;
  1926. pDatagramIndex[0] = pAggregatedPacket[i]; //least significant byte
  1927. pDatagramIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  1928. i += 2;
  1929. if (0x00 == pDatagramIndex[0] && 0x00 == pDatagramIndex[1])
  1930. break; //zero padding after all datagrams
  1931. if (nPacketNum > 1)
  1932. {
  1933. LOG_MSG_DEBUG("Error: wrong number of packets: %d(should be %d)\n",
  1934. nPacketNum, 1);
  1935. return false;
  1936. }
  1937. pDatagramLen[0] = pAggregatedPacket[i]; //least significant byte
  1938. pDatagramLen[1] = pAggregatedPacket[i+1]; //most significant byte
  1939. i += 2;
  1940. packetIndex = pDatagramIndex[0] + 256*pDatagramIndex[1];
  1941. if (pDatagramLen[0] + 256*pDatagramLen[1] != nPacketsSize)
  1942. {
  1943. LOG_MSG_DEBUG("Error: Wrong packet %d length: 0x%02x 0x%02x"
  1944. "(should be %d)\n", nPacketNum, pDatagramLen[0],
  1945. pDatagramLen[1], nPacketsSize);
  1946. return false;
  1947. }
  1948. if (0 != memcmp(pExpectedPacket, &pAggregatedPacket[packetIndex],
  1949. nPacketsSize))
  1950. {
  1951. LOG_MSG_DEBUG("Error: Comparison of packet %d failed!\n",
  1952. nPacketNum);
  1953. return false;
  1954. }
  1955. nPacketNum++;
  1956. }
  1957. }
  1958. return true;
  1959. }
  1960. /////////////////////////////////////////////////////////////////////////////////
  1961. bool MBIMAggregationScenarios::DeaggragateAndComparePacketsWithStreamId(
  1962. Byte pAggregatedPacket[MAX_PACKET_SIZE],
  1963. Byte pExpectedPackets[][MAX_PACKET_SIZE], int pPacketsSizes[],
  1964. int nNumPackets, int nAggregatedPacketSize,
  1965. Byte pPacketsStreamId[NUM_PACKETS])
  1966. {
  1967. int nPacketNum = 0;
  1968. int i = 0;
  1969. int nNdpStart = 0;
  1970. Byte pNdpIndex[2] = {0};
  1971. Byte pNdpLen[2] = {0};
  1972. if (0x4e != pAggregatedPacket[i] || 0x43 != pAggregatedPacket[i+1] ||
  1973. 0x4d != pAggregatedPacket[i+2]|| 0x48 != pAggregatedPacket[i+3])
  1974. {
  1975. LOG_MSG_DEBUG("Error: Wrong NTH16 signature: 0x%02x 0x%02x 0x%02x "
  1976. "0x%02x(should be 0x4e, 0x43, 0x4d, 0x48)\n",
  1977. pAggregatedPacket[i], pAggregatedPacket[i+1],
  1978. pAggregatedPacket[i+2], pAggregatedPacket[i+3]);
  1979. return false;
  1980. }
  1981. i += 4;
  1982. if (0x0c != pAggregatedPacket[i] || 0x00 != pAggregatedPacket[i+1])
  1983. {
  1984. LOG_MSG_DEBUG("Error: Wrong header length: 0x%02x 0x%02x(should be "
  1985. "0x0c, 0x00)\n",pAggregatedPacket[i], pAggregatedPacket[i+1]);
  1986. return false;
  1987. }
  1988. i += 4; //ignoring sequence number
  1989. if ((nAggregatedPacketSize & 0x00FF) != pAggregatedPacket[i] ||
  1990. (nAggregatedPacketSize >> 8) != pAggregatedPacket[i+1])
  1991. {
  1992. LOG_MSG_DEBUG("Error: Wrong aggregated packet length: 0x%02x 0x%02x"
  1993. "(should be 0x%02x, 0x%02x)\n", pAggregatedPacket[i],
  1994. pAggregatedPacket[i+1], nAggregatedPacketSize & 0x00FF,
  1995. nAggregatedPacketSize >> 8);
  1996. return false;
  1997. }
  1998. i += 2;
  1999. pNdpIndex[0] = pAggregatedPacket[i]; //least significant byte
  2000. pNdpIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  2001. //reading the NDP
  2002. while (0x00 != pNdpIndex[0] || 0x00 != pNdpIndex[1])
  2003. {
  2004. i = pNdpIndex[0] + 256*pNdpIndex[1]; //NDP should begin here
  2005. nNdpStart = i;
  2006. if (0x49 != pAggregatedPacket[i] || 0x50 != pAggregatedPacket[i+1] ||
  2007. 0x53 != pAggregatedPacket[i+2])
  2008. {
  2009. LOG_MSG_DEBUG("Error: Wrong NDP16 signature: 0x%02x 0x%02x 0x%02x"
  2010. "(should be 0x49, 0x50, 0x53)\n", pAggregatedPacket[i],
  2011. pAggregatedPacket[i+1], pAggregatedPacket[i+2]);
  2012. return false;
  2013. }
  2014. if (pPacketsStreamId[nPacketNum] != pAggregatedPacket[i+3])
  2015. {
  2016. LOG_MSG_DEBUG("Error: Wrong NDP stream id: 0x%02x(should be 0x%02x)\n",
  2017. pAggregatedPacket[i+3], pPacketsStreamId[nPacketNum]);
  2018. return false;
  2019. }
  2020. i += 4;
  2021. pNdpLen[0] = pAggregatedPacket[i]; //least significant byte
  2022. pNdpLen[1] = pAggregatedPacket[i+1]; //most significant byte
  2023. if (0x00 != pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2] ||
  2024. 0x00 != pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] -1])
  2025. {
  2026. LOG_MSG_DEBUG("Error: Wrong end of NDP: 0x%02x 0x%02x(should be 0x00, "
  2027. "0x00)\n",
  2028. pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2],
  2029. pAggregatedPacket[nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 1]);
  2030. return false;
  2031. }
  2032. i += 2;
  2033. pNdpIndex[0] = pAggregatedPacket[i]; //least significant byte
  2034. pNdpIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  2035. i += 2;
  2036. while (i <= nNdpStart + pNdpLen[0] + 256*pNdpLen[1] - 2)
  2037. { //going over all the datagrams in this NDP
  2038. Byte pDatagramIndex[2] = {0};
  2039. Byte pDatagramLen[2] = {0};
  2040. int packetIndex = 0;
  2041. pDatagramIndex[0] = pAggregatedPacket[i]; //least significant byte
  2042. pDatagramIndex[1] = pAggregatedPacket[i+1]; //most significant byte
  2043. i += 2;
  2044. if (0x00 == pDatagramIndex[0] && 0x00 == pDatagramIndex[1])
  2045. break; //zero padding after all datagrams
  2046. if (nPacketNum >= nNumPackets)
  2047. {
  2048. LOG_MSG_DEBUG("Error: wrong number of packets: %d(should be %d)\n",
  2049. nPacketNum, nNumPackets);
  2050. return false;
  2051. }
  2052. pDatagramLen[0] = pAggregatedPacket[i]; //least significant byte
  2053. pDatagramLen[1] = pAggregatedPacket[i+1]; //most significant byte
  2054. i += 2;
  2055. packetIndex = pDatagramIndex[0] + 256*pDatagramIndex[1];
  2056. if (pDatagramLen[0] + 256*pDatagramLen[1] != (int)pPacketsSizes[nPacketNum])
  2057. {
  2058. LOG_MSG_DEBUG("Error: Wrong packet %d length: 0x%02x 0x%02x"
  2059. "(should be %d)\n", nPacketNum, pDatagramLen[0],
  2060. pDatagramLen[1], pPacketsSizes[nPacketNum]);
  2061. return false;
  2062. }
  2063. if (0 != memcmp(pExpectedPackets[nPacketNum],
  2064. &pAggregatedPacket[packetIndex], pPacketsSizes[nPacketNum]))
  2065. {
  2066. LOG_MSG_DEBUG("Error: Comparison of packet %d failed!\n",
  2067. nPacketNum);
  2068. return false;
  2069. }
  2070. nPacketNum++;
  2071. }
  2072. }
  2073. return true;
  2074. }
  2075. class MBIMAggregationTest: public MBIMAggregationTestFixtureConf11 {
  2076. public:
  2077. /////////////////////////////////////////////////////////////////////////////////
  2078. MBIMAggregationTest(bool generic_agg) :
  2079. MBIMAggregationTestFixtureConf11(generic_agg)
  2080. {
  2081. if (generic_agg)
  2082. m_name = "GenMBIMAggregationTest";
  2083. else
  2084. m_name = "MBIMAggregationTest";
  2085. m_description = "MBIM Aggregation test - sends 5 packets and receives 1 "
  2086. "aggregated packet";
  2087. }
  2088. /////////////////////////////////////////////////////////////////////////////////
  2089. virtual bool AddRules()
  2090. {
  2091. return AddRules1HeaderAggregation();
  2092. } // AddRules()
  2093. /////////////////////////////////////////////////////////////////////////////////
  2094. bool TestLogic()
  2095. {
  2096. return MBIMAggregationScenarios::MBIMAggregationTest(&m_UsbToIpaPipe,
  2097. &m_IpaToUsbPipeAgg, m_eIP);
  2098. }
  2099. /////////////////////////////////////////////////////////////////////////////////
  2100. };
  2101. /////////////////////////////////////////////////////////////////////////////////
  2102. /////////////////////////////////////////////////////////////////////////////////
  2103. /////////////////////////////////////////////////////////////////////////////////
  2104. class MBIMDeaggregationTest: public MBIMAggregationTestFixtureConf11 {
  2105. public:
  2106. /////////////////////////////////////////////////////////////////////////////////
  2107. MBIMDeaggregationTest(bool generic_agg) :
  2108. MBIMAggregationTestFixtureConf11(generic_agg)
  2109. {
  2110. if (generic_agg)
  2111. m_name = "GenMBIMDeaggregationTest";
  2112. else
  2113. m_name = "MBIMDeaggregationTest";
  2114. m_description = "MBIM Deaggregation test - sends an aggregated packet made from"
  2115. "5 packets and receives 5 packets";
  2116. }
  2117. /////////////////////////////////////////////////////////////////////////////////
  2118. virtual bool AddRules()
  2119. {
  2120. return AddRulesDeaggregation();
  2121. } // AddRules()
  2122. /////////////////////////////////////////////////////////////////////////////////
  2123. bool TestLogic()
  2124. {
  2125. return MBIMAggregationScenarios::MBIMDeaggregationTest(&m_UsbToIpaPipeDeagg, &m_IpaToUsbPipe, m_eIP);
  2126. }
  2127. /////////////////////////////////////////////////////////////////////////////////
  2128. };
  2129. class MBIMDeaggregationOnePacketTest: public MBIMAggregationTestFixtureConf11 {
  2130. public:
  2131. /////////////////////////////////////////////////////////////////////////////////
  2132. MBIMDeaggregationOnePacketTest(bool generic_agg) :
  2133. MBIMAggregationTestFixtureConf11(generic_agg)
  2134. {
  2135. if (generic_agg)
  2136. m_name = "GenMBIMDeaggregationOnePacketTest";
  2137. else
  2138. m_name = "MBIMDeaggregationOnePacketTest";
  2139. m_description = "MBIM Deaggregation one packet test - sends an aggregated packet made"
  2140. "of 1 packet and receives 1 packet";
  2141. }
  2142. /////////////////////////////////////////////////////////////////////////////////
  2143. virtual bool AddRules()
  2144. {
  2145. return AddRulesDeaggregation();
  2146. } // AddRules()
  2147. /////////////////////////////////////////////////////////////////////////////////
  2148. bool TestLogic()
  2149. {
  2150. return MBIMAggregationScenarios::MBIMDeaggregationOnePacketTest(&m_UsbToIpaPipeDeagg, &m_IpaToUsbPipe, m_eIP);
  2151. }
  2152. /////////////////////////////////////////////////////////////////////////////////
  2153. };
  2154. /////////////////////////////////////////////////////////////////////////////////
  2155. /////////////////////////////////////////////////////////////////////////////////
  2156. /////////////////////////////////////////////////////////////////////////////////
  2157. class MBIMDeaggregationAndAggregationTest: public MBIMAggregationTestFixtureConf11 {
  2158. public:
  2159. /////////////////////////////////////////////////////////////////////////////////
  2160. MBIMDeaggregationAndAggregationTest(bool generic_agg)
  2161. : MBIMAggregationTestFixtureConf11(generic_agg)
  2162. {
  2163. if (generic_agg)
  2164. m_name = "GenMBIMDeaggregationAndAggregationTest";
  2165. else
  2166. m_name = "MBIMDeaggregationAndAggregationTest";
  2167. m_description = "MBIM Deaggregation and Aggregation test - sends an aggregated "
  2168. "packet made from 5 packets and receives the same aggregated packet";
  2169. }
  2170. /////////////////////////////////////////////////////////////////////////////////
  2171. virtual bool AddRules()
  2172. {
  2173. return AddRules1HeaderAggregation();
  2174. } // AddRules()
  2175. /////////////////////////////////////////////////////////////////////////////////
  2176. bool TestLogic()
  2177. {
  2178. return MBIMAggregationScenarios::MBIMDeaggregationAndAggregationTest(
  2179. &m_UsbToIpaPipeDeagg, &m_IpaToUsbPipeAgg, m_eIP);
  2180. }
  2181. /////////////////////////////////////////////////////////////////////////////////
  2182. };
  2183. /////////////////////////////////////////////////////////////////////////////////
  2184. /////////////////////////////////////////////////////////////////////////////////
  2185. /////////////////////////////////////////////////////////////////////////////////
  2186. class MBIMMultipleDeaggregationAndAggregationTest:
  2187. public MBIMAggregationTestFixtureConf11 {
  2188. public:
  2189. /////////////////////////////////////////////////////////////////////////////////
  2190. MBIMMultipleDeaggregationAndAggregationTest(bool generic_agg) :
  2191. MBIMAggregationTestFixtureConf11(generic_agg)
  2192. {
  2193. if (generic_agg)
  2194. m_name = "GenMBIMMultipleDeaggregationAndAggregationTest";
  2195. else
  2196. m_name = "MBIMMultipleDeaggregationAndAggregationTest";
  2197. m_description = "MBIM Multiple Deaggregation and Aggregation test - sends 5 aggregated "
  2198. "packets each one made of 1 packet and receives an aggregated packet made of the"
  2199. "5 packets";
  2200. }
  2201. /////////////////////////////////////////////////////////////////////////////////
  2202. virtual bool AddRules()
  2203. {
  2204. return AddRules1HeaderAggregation();
  2205. } // AddRules()
  2206. /////////////////////////////////////////////////////////////////////////////////
  2207. bool TestLogic()
  2208. {
  2209. return MBIMAggregationScenarios::MBIMMultipleDeaggregationAndAggregationTest(
  2210. &m_UsbToIpaPipeDeagg, &m_IpaToUsbPipeAgg, m_eIP);
  2211. }
  2212. /////////////////////////////////////////////////////////////////////////////////
  2213. };
  2214. /////////////////////////////////////////////////////////////////////////////////
  2215. /////////////////////////////////////////////////////////////////////////////////
  2216. /////////////////////////////////////////////////////////////////////////////////
  2217. class MBIMAggregationLoopTest: public MBIMAggregationTestFixtureConf11 {
  2218. public:
  2219. /////////////////////////////////////////////////////////////////////////////////
  2220. MBIMAggregationLoopTest(bool generic_agg)
  2221. : MBIMAggregationTestFixtureConf11(generic_agg)
  2222. {
  2223. if (generic_agg)
  2224. m_name = "GenMBIMggregationLoopTest";
  2225. else
  2226. m_name = "MBIMggregationLoopTest";
  2227. m_description = "MBIM Aggregation Loop test - sends 5 packets and expects to"
  2228. "receives 1 aggregated packet a few times";
  2229. }
  2230. /////////////////////////////////////////////////////////////////////////////////
  2231. virtual bool AddRules()
  2232. {
  2233. return AddRules1HeaderAggregation();
  2234. } // AddRules()
  2235. /////////////////////////////////////////////////////////////////////////////////
  2236. bool TestLogic()
  2237. {
  2238. return MBIMAggregationScenarios::MBIMAggregationLoopTest(
  2239. &m_UsbToIpaPipe, &m_IpaToUsbPipeAgg, m_eIP);
  2240. }
  2241. /////////////////////////////////////////////////////////////////////////////////
  2242. };
  2243. /////////////////////////////////////////////////////////////////////////////////
  2244. /////////////////////////////////////////////////////////////////////////////////
  2245. /////////////////////////////////////////////////////////////////////////////////
  2246. class MBIMAggregationTimeLimitTest: public MBIMAggregationTestFixtureConf11 {
  2247. public:
  2248. /////////////////////////////////////////////////////////////////////////////////
  2249. MBIMAggregationTimeLimitTest(bool generic_agg)
  2250. : MBIMAggregationTestFixtureConf11(generic_agg)
  2251. {
  2252. if (generic_agg)
  2253. m_name = "GenMBIMAggregationTimeLimitTest";
  2254. else
  2255. m_name = "MBIMAggregationTimeLimitTest";
  2256. m_description = "MBIM Aggregation time limit test - sends 1 small packet "
  2257. "smaller than the byte limit and receives 1 aggregated packet";
  2258. }
  2259. /////////////////////////////////////////////////////////////////////////////////
  2260. virtual bool AddRules()
  2261. {
  2262. return AddRules1HeaderAggregationTime();
  2263. } // AddRules()
  2264. /////////////////////////////////////////////////////////////////////////////////
  2265. bool TestLogic()
  2266. {
  2267. return MBIMAggregationScenarios::MBIMAggregationTimeLimitTest(
  2268. &m_UsbToIpaPipe, &m_IpaToUsbPipeAggTime, m_eIP);
  2269. }
  2270. /////////////////////////////////////////////////////////////////////////////////
  2271. };
  2272. /////////////////////////////////////////////////////////////////////////////////
  2273. /////////////////////////////////////////////////////////////////////////////////
  2274. /////////////////////////////////////////////////////////////////////////////////
  2275. class MBIMAggregationByteLimitTest: public MBIMAggregationTestFixtureConf11 {
  2276. public:
  2277. /////////////////////////////////////////////////////////////////////////////////
  2278. MBIMAggregationByteLimitTest(bool generic_agg)
  2279. : MBIMAggregationTestFixtureConf11(generic_agg)
  2280. {
  2281. if (generic_agg)
  2282. m_name = "GenMBIMAggregationByteLimitTest";
  2283. else
  2284. m_name = "MBIMAggregationByteLimitTest";
  2285. m_description = "MBIM Aggregation byte limit test - sends 2 packets that together "
  2286. "are larger than the byte limit ";
  2287. }
  2288. /////////////////////////////////////////////////////////////////////////////////
  2289. virtual bool AddRules()
  2290. {
  2291. return AddRules1HeaderAggregation();
  2292. } // AddRules()
  2293. /////////////////////////////////////////////////////////////////////////////////
  2294. bool TestLogic()
  2295. {
  2296. return MBIMAggregationScenarios::MBIMAggregationByteLimitTest(
  2297. &m_UsbToIpaPipe, &m_IpaToUsbPipeAgg, m_eIP);
  2298. }
  2299. /////////////////////////////////////////////////////////////////////////////////
  2300. };
  2301. /////////////////////////////////////////////////////////////////////////////////
  2302. /////////////////////////////////////////////////////////////////////////////////
  2303. /////////////////////////////////////////////////////////////////////////////////
  2304. class MBIMAggregationByteLimitTestFC: public MBIMAggregationTestFixtureConf11 {
  2305. public:
  2306. /////////////////////////////////////////////////////////////////////////////////
  2307. MBIMAggregationByteLimitTestFC(bool generic_agg)
  2308. : MBIMAggregationTestFixtureConf11(generic_agg) {
  2309. if (generic_agg)
  2310. m_name = "GenMBIMAggregationByteLimitTestFC";
  2311. else
  2312. m_name = "MBIMAggregationByteLimitTestFC";
  2313. m_description = "MBIMAggregationByteLimitTestFC - Send 4 IP packet with FC"
  2314. "and expect 4 aggregated MBIM packets.";
  2315. }
  2316. /////////////////////////////////////////////////////////////////////////////////
  2317. virtual bool AddRules() {
  2318. return AddRules1HeaderAggregation(true);
  2319. } // AddRules()
  2320. /////////////////////////////////////////////////////////////////////////////////
  2321. bool TestLogic()
  2322. {
  2323. return MBIMAggregationScenarios::MBIMAggregationByteLimitTestFC(
  2324. &m_UsbToIpaPipe, &m_IpaToUsbPipeAgg, m_eIP);
  2325. }
  2326. };
  2327. class MBIMAggregationDualDpTestFC : public MBIMAggregationTestFixtureConf11
  2328. {
  2329. public:
  2330. /////////////////////////////////////////////////////////////////////////////////
  2331. MBIMAggregationDualDpTestFC(bool generic_agg)
  2332. : MBIMAggregationTestFixtureConf11(generic_agg)
  2333. {
  2334. if (generic_agg) m_name = "GenMBIMAggregationDualDpTestFC";
  2335. else m_name = "MBIMAggregationDualDpTestFC";
  2336. m_description = "MBIMAggregationDualDpTestFC - Send IP packets "
  2337. "on two datapathes: one with FC and one without. "
  2338. "Expect 2 aggregated MBIM packets on pipe with FC. "
  2339. "Expect one aggregated MBIM packet on pipe without FC. ";
  2340. }
  2341. /////////////////////////////////////////////////////////////////////////////////
  2342. virtual bool AddRules()
  2343. {
  2344. return AddRulesAggDualFC(&m_UsbToIpaPipe,
  2345. &m_IpaToUsbPipeAggTime,
  2346. &m_IpaToUsbPipeAgg);
  2347. }
  2348. /////////////////////////////////////////////////////////////////////////////////
  2349. bool TestLogic()
  2350. {
  2351. return MBIMAggregationScenarios::MBIMAggregationDualDpTestFC(
  2352. &m_UsbToIpaPipe, &m_IpaToUsbPipeAggTime, &m_IpaToUsbPipeAgg, m_eIP);
  2353. }
  2354. };
  2355. class MBIMAggregationDualDpTestFcRoutingBased : public MBIMAggregationTestFixtureConf11
  2356. {
  2357. public:
  2358. /////////////////////////////////////////////////////////////////////////////////
  2359. MBIMAggregationDualDpTestFcRoutingBased(bool generic_agg)
  2360. : MBIMAggregationTestFixtureConf11(generic_agg)
  2361. {
  2362. if (generic_agg) m_name = "GenMBIMAggregationDualDpTestFcRoutingBased";
  2363. else m_name = "MBIMAggregationDualDpTestFcRoutingBased";
  2364. m_description = "MBIMAggregationDualDpTestFcRoutingBased - Send IP packets "
  2365. "on two datapathes: one with RT based FC and one without. "
  2366. "Expect 2 aggregated MBIM packets on pipe with RT based FC. "
  2367. "Expect one aggregated MBIM packet on pipe without RT based FC. ";
  2368. }
  2369. /////////////////////////////////////////////////////////////////////////////////
  2370. virtual bool AddRules()
  2371. {
  2372. return AddRulesAggDualFcRoutingBased(&m_UsbToIpaPipe,
  2373. &m_IpaToUsbPipeAggTime,
  2374. &m_IpaToUsbPipeAgg);
  2375. }
  2376. /////////////////////////////////////////////////////////////////////////////////
  2377. bool TestLogic()
  2378. {
  2379. return MBIMAggregationScenarios::MBIMAggregationDualDpTestFC(
  2380. &m_UsbToIpaPipe, &m_IpaToUsbPipeAggTime, &m_IpaToUsbPipeAgg, m_eIP);
  2381. }
  2382. };
  2383. /////////////////////////////////////////////////////////////////////////////////
  2384. /////////////////////////////////////////////////////////////////////////////////
  2385. /////////////////////////////////////////////////////////////////////////////////
  2386. class MBIMDeaggregationMultipleNDPTest: public MBIMAggregationTestFixtureConf11 {
  2387. public:
  2388. /////////////////////////////////////////////////////////////////////////////////
  2389. MBIMDeaggregationMultipleNDPTest(bool generic_agg)
  2390. : MBIMAggregationTestFixtureConf11(generic_agg)
  2391. {
  2392. if (generic_agg)
  2393. m_name = "GenMBIMDeaggregationMultipleNDPTest";
  2394. else
  2395. m_name = "MBIMDeaggregationMultipleNDPTest";
  2396. m_description = "MBIM Deaggregation multiple NDP test - sends an aggregated"
  2397. "packet made from 5 packets and 2 NDPs and receives 5 packets";
  2398. }
  2399. /////////////////////////////////////////////////////////////////////////////////
  2400. virtual bool AddRules()
  2401. {
  2402. return AddRulesDeaggregation();
  2403. } // AddRules()
  2404. /////////////////////////////////////////////////////////////////////////////////
  2405. bool TestLogic()
  2406. {
  2407. return MBIMAggregationScenarios::MBIMDeaggregationMultipleNDPTest(
  2408. &m_UsbToIpaPipeDeagg, &m_IpaToUsbPipe, m_eIP);
  2409. }
  2410. /////////////////////////////////////////////////////////////////////////////////
  2411. };
  2412. /////////////////////////////////////////////////////////////////////////////////
  2413. /////////////////////////////////////////////////////////////////////////////////
  2414. /////////////////////////////////////////////////////////////////////////////////
  2415. class MBIMAggregation2PipesTest: public MBIMAggregationTestFixtureConf11 {
  2416. public:
  2417. /////////////////////////////////////////////////////////////////////////////////
  2418. MBIMAggregation2PipesTest(bool generic_agg)
  2419. : MBIMAggregationTestFixtureConf11(generic_agg)
  2420. {
  2421. if (generic_agg)
  2422. m_name = "GenMBIMAggregation2PipesTest";
  2423. else
  2424. m_name = "MBIMAggregation2PipesTest";
  2425. m_description = "MBIM Aggregation 2 pipes test - sends 3 packets from one pipe"
  2426. "and an aggregated packet made of 2 packets from another pipe and "
  2427. "receives 1 aggregated packet made of all 5 packets";
  2428. }
  2429. /////////////////////////////////////////////////////////////////////////////////
  2430. virtual bool AddRules()
  2431. {
  2432. return AddRules1HeaderAggregation();
  2433. } // AddRules()
  2434. /////////////////////////////////////////////////////////////////////////////////
  2435. bool TestLogic()
  2436. {
  2437. return MBIMAggregationScenarios::MBIMAggregation2PipesTest(
  2438. &m_UsbToIpaPipeDeagg, &m_UsbToIpaPipe, &m_IpaToUsbPipeAgg, m_eIP);
  2439. }
  2440. /////////////////////////////////////////////////////////////////////////////////
  2441. };
  2442. /////////////////////////////////////////////////////////////////////////////////
  2443. /////////////////////////////////////////////////////////////////////////////////
  2444. /////////////////////////////////////////////////////////////////////////////////
  2445. class MBIMAggregationTimeLimitLoopTest: public MBIMAggregationTestFixtureConf11 {
  2446. public:
  2447. /////////////////////////////////////////////////////////////////////////////////
  2448. MBIMAggregationTimeLimitLoopTest(bool generic_agg)
  2449. : MBIMAggregationTestFixtureConf11(generic_agg)
  2450. {
  2451. if (generic_agg)
  2452. m_name = "GenMBIMAggregationTimeLimitLoopTest";
  2453. else
  2454. m_name = "MBIMAggregationTimeLimitLoopTest";
  2455. m_description = "MBIM Aggregation time limit loop test - sends 5 small packet "
  2456. "smaller than the byte limit and receives 5 aggregated packet";
  2457. }
  2458. /////////////////////////////////////////////////////////////////////////////////
  2459. virtual bool AddRules()
  2460. {
  2461. return AddRules1HeaderAggregationTime();
  2462. } // AddRules()
  2463. /////////////////////////////////////////////////////////////////////////////////
  2464. bool TestLogic()
  2465. {
  2466. return MBIMAggregationScenarios::MBIMAggregationTimeLimitLoopTest(
  2467. &m_UsbToIpaPipe, &m_IpaToUsbPipeAggTime, m_eIP);
  2468. }
  2469. /////////////////////////////////////////////////////////////////////////////////
  2470. };
  2471. /////////////////////////////////////////////////////////////////////////////////
  2472. /////////////////////////////////////////////////////////////////////////////////
  2473. /////////////////////////////////////////////////////////////////////////////////
  2474. class MBIMAggregationMultiplePacketsTest: public MBIMAggregationTestFixtureConf11 {
  2475. public:
  2476. /////////////////////////////////////////////////////////////////////////////////
  2477. MBIMAggregationMultiplePacketsTest(bool generic_agg)
  2478. : MBIMAggregationTestFixtureConf11(generic_agg)
  2479. {
  2480. if (generic_agg)
  2481. m_name = "GenMBIMAggregationMultiplePacketsTest";
  2482. else
  2483. m_name = "MBIMAggregationMultiplePacketsTest";
  2484. m_description = "MBIM Aggregation multiple packets test - sends 9 packets "
  2485. "with same stream ID and receives 1 aggregated packet with 2 NDPs";
  2486. this->m_runInRegression = false;
  2487. }
  2488. /////////////////////////////////////////////////////////////////////////////////
  2489. virtual bool AddRules()
  2490. {
  2491. return AddRules1HeaderAggregation();
  2492. } // AddRules()
  2493. /////////////////////////////////////////////////////////////////////////////////
  2494. bool TestLogic()
  2495. {
  2496. return MBIMAggregationScenarios::MBIMAggregationMultiplePacketsTest(
  2497. &m_UsbToIpaPipe, &m_IpaToUsbPipeAgg, m_eIP);
  2498. }
  2499. /////////////////////////////////////////////////////////////////////////////////
  2500. };
  2501. /////////////////////////////////////////////////////////////////////////////////
  2502. /////////////////////////////////////////////////////////////////////////////////
  2503. /////////////////////////////////////////////////////////////////////////////////
  2504. class MBIMAggregation0LimitsTest: public MBIMAggregationTestFixtureConf11 {
  2505. public:
  2506. /////////////////////////////////////////////////////////////////////////////////
  2507. MBIMAggregation0LimitsTest(bool generic_agg)
  2508. : MBIMAggregationTestFixtureConf11(generic_agg)
  2509. {
  2510. if (generic_agg)
  2511. m_name = "GenMBIMAggregation0LimitsTest";
  2512. else
  2513. m_name = "MBIMAggregation0LimitsTest";
  2514. m_description = "MBIM Aggregation 0 limits test - sends 5 packets and expects"
  2515. "to get each packet back aggregated (both size and time limits are 0)";
  2516. }
  2517. /////////////////////////////////////////////////////////////////////////////////
  2518. virtual bool AddRules()
  2519. {
  2520. return AddRules1HeaderAggregation0Limits();
  2521. } // AddRules()
  2522. /////////////////////////////////////////////////////////////////////////////////
  2523. bool TestLogic()
  2524. {
  2525. return MBIMAggregationScenarios::MBIMAggregation0LimitsTest(
  2526. &m_UsbToIpaPipe, &m_IpaToUsbPipeAgg0Limits, m_eIP);
  2527. }
  2528. /////////////////////////////////////////////////////////////////////////////////
  2529. };
  2530. /////////////////////////////////////////////////////////////////////////////////
  2531. /////////////////////////////////////////////////////////////////////////////////
  2532. /////////////////////////////////////////////////////////////////////////////////
  2533. class MBIMAggregationDifferentStreamIdsTest:
  2534. public MBIMAggregationTestFixtureConf11 {
  2535. public:
  2536. /////////////////////////////////////////////////////////////////////////////////
  2537. MBIMAggregationDifferentStreamIdsTest(bool generic_agg)
  2538. : MBIMAggregationTestFixtureConf11(generic_agg)
  2539. {
  2540. if (generic_agg)
  2541. m_name = "GenMBIMAggregationDifferentStreamIdsTest";
  2542. else
  2543. m_name = "MBIMAggregationDifferentStreamIdsTest";
  2544. m_description = "MBIM Aggregation different stream IDs test - sends 5 packets"
  2545. "with different stream IDs and receives 1 aggregated packet made of 5"
  2546. "NDPs";
  2547. }
  2548. /////////////////////////////////////////////////////////////////////////////////
  2549. virtual bool AddRules()
  2550. {
  2551. m_eIP = IPA_IP_v4;
  2552. const char aBypass[NUM_PACKETS][20] = {{"Bypass1"}, {"Bypass2"}, {"Bypass3"},
  2553. {"Bypass4"}, {"Bypass5"}};
  2554. uint32_t nTableHdl[NUM_PACKETS];
  2555. bool bRetVal = true;
  2556. IPAFilteringTable cFilterTable0;
  2557. struct ipa_flt_rule_add sFilterRuleEntry;
  2558. struct ipa_ioc_get_hdr sGetHeader[NUM_PACKETS];
  2559. uint8_t aHeadertoAdd[NUM_PACKETS][4];
  2560. int hdrSize;
  2561. for (int i = 0; i < NUM_PACKETS; i++) {
  2562. if (mGenericAgg) {
  2563. hdrSize = 4;
  2564. aHeadertoAdd[i][0] = 0x49;
  2565. aHeadertoAdd[i][1] = 0x50;
  2566. aHeadertoAdd[i][2] = 0x53;
  2567. aHeadertoAdd[i][3] = (uint8_t)i;
  2568. } else {
  2569. hdrSize = 1;
  2570. aHeadertoAdd[i][0] = (uint8_t)i;
  2571. }
  2572. }
  2573. LOG_MSG_STACK("Entering Function");
  2574. memset(&sFilterRuleEntry, 0, sizeof(sFilterRuleEntry));
  2575. for (int i = 0; i < NUM_PACKETS; i++)
  2576. memset(&sGetHeader[i], 0, sizeof(sGetHeader[i]));
  2577. // Create Header:
  2578. // Allocate Memory, populate it, and add in to the Header Insertion.
  2579. struct ipa_ioc_add_hdr * pHeaderDescriptor = NULL;
  2580. pHeaderDescriptor = (struct ipa_ioc_add_hdr *) calloc(1,
  2581. sizeof(struct ipa_ioc_add_hdr)
  2582. + NUM_PACKETS * sizeof(struct ipa_hdr_add));
  2583. if (!pHeaderDescriptor)
  2584. {
  2585. LOG_MSG_ERROR("calloc failed to allocate pHeaderDescriptor");
  2586. bRetVal = false;
  2587. goto bail;
  2588. }
  2589. pHeaderDescriptor->commit = true;
  2590. pHeaderDescriptor->num_hdrs = NUM_PACKETS;
  2591. // Adding Header No1.
  2592. strlcpy(pHeaderDescriptor->hdr[0].name, "StreamId0", sizeof(pHeaderDescriptor->hdr[0].name)); // Header's Name
  2593. memcpy(pHeaderDescriptor->hdr[0].hdr, (void*)&aHeadertoAdd[0],
  2594. hdrSize); //Header's Data
  2595. pHeaderDescriptor->hdr[0].hdr_len = hdrSize;
  2596. pHeaderDescriptor->hdr[0].hdr_hdl = -1; //Return Value
  2597. pHeaderDescriptor->hdr[0].is_partial = false;
  2598. pHeaderDescriptor->hdr[0].status = -1; // Return Parameter
  2599. // Adding Header No2.
  2600. strlcpy(pHeaderDescriptor->hdr[1].name, "StreamId1", sizeof(pHeaderDescriptor->hdr[1].name)); // Header's Name
  2601. memcpy(pHeaderDescriptor->hdr[1].hdr, (void*)&aHeadertoAdd[1],
  2602. hdrSize); //Header's Data
  2603. pHeaderDescriptor->hdr[1].hdr_len = hdrSize;
  2604. pHeaderDescriptor->hdr[1].hdr_hdl = -1; //Return Value
  2605. pHeaderDescriptor->hdr[1].is_partial = false;
  2606. pHeaderDescriptor->hdr[1].status = -1; // Return Parameter
  2607. // Adding Header No3.
  2608. strlcpy(pHeaderDescriptor->hdr[2].name, "StreamId2", sizeof(pHeaderDescriptor->hdr[2].name)); // Header's Name
  2609. memcpy(pHeaderDescriptor->hdr[2].hdr, (void*)&aHeadertoAdd[2],
  2610. hdrSize); //Header's Data
  2611. pHeaderDescriptor->hdr[2].hdr_len = hdrSize;
  2612. pHeaderDescriptor->hdr[2].hdr_hdl = -1; //Return Value
  2613. pHeaderDescriptor->hdr[2].is_partial = false;
  2614. pHeaderDescriptor->hdr[2].status = -1; // Return Parameter
  2615. // Adding Header No4.
  2616. strlcpy(pHeaderDescriptor->hdr[3].name, "StreamId3", sizeof(pHeaderDescriptor->hdr[3].name)); // Header's Name
  2617. memcpy(pHeaderDescriptor->hdr[3].hdr, (void*)&aHeadertoAdd[3],
  2618. hdrSize); //Header's Data
  2619. pHeaderDescriptor->hdr[3].hdr_len = hdrSize;
  2620. pHeaderDescriptor->hdr[3].hdr_hdl = -1; //Return Value
  2621. pHeaderDescriptor->hdr[3].is_partial = false;
  2622. pHeaderDescriptor->hdr[3].status = -1; // Return Parameter
  2623. // Adding Header No5.
  2624. strlcpy(pHeaderDescriptor->hdr[4].name, "StreamId4", sizeof(pHeaderDescriptor->hdr[4].name)); // Header's Name
  2625. memcpy(pHeaderDescriptor->hdr[4].hdr, (void*)&aHeadertoAdd[4],
  2626. hdrSize); //Header's Data
  2627. pHeaderDescriptor->hdr[4].hdr_len = hdrSize;
  2628. pHeaderDescriptor->hdr[4].hdr_hdl = -1; //Return Value
  2629. pHeaderDescriptor->hdr[4].is_partial = false;
  2630. pHeaderDescriptor->hdr[4].status = -1; // Return Parameter
  2631. for (int i = 0; i < NUM_PACKETS; i++)
  2632. strlcpy(sGetHeader[i].name, pHeaderDescriptor->hdr[i].name, sizeof(sGetHeader[i].name));
  2633. if (!m_HeaderInsertion.AddHeader(pHeaderDescriptor))
  2634. {
  2635. LOG_MSG_ERROR("m_HeaderInsertion.AddHeader(pHeaderDescriptor) Failed.");
  2636. bRetVal = false;
  2637. goto bail;
  2638. }
  2639. for (int i = 0; i < NUM_PACKETS; i++)
  2640. {
  2641. if (!m_HeaderInsertion.GetHeaderHandle(&sGetHeader[i]))
  2642. {
  2643. LOG_MSG_ERROR(" Failed");
  2644. bRetVal = false;
  2645. goto bail;
  2646. }
  2647. LOG_MSG_DEBUG("Received Header %d Handle = 0x%x", i, sGetHeader[i].hdl);
  2648. }
  2649. for (int i = 0; i < NUM_PACKETS; i++)
  2650. {
  2651. if (!CreateBypassRoutingTable(&m_Routing, m_eIP, aBypass[i],
  2652. IPA_CLIENT_TEST2_CONS, sGetHeader[i].hdl,&nTableHdl[i]))
  2653. {
  2654. LOG_MSG_ERROR("CreateBypassRoutingTable Failed\n");
  2655. bRetVal = false;
  2656. goto bail;
  2657. }
  2658. }
  2659. LOG_MSG_INFO("Creation of 5 bypass routing tables completed successfully");
  2660. // Creating Filtering Rules
  2661. cFilterTable0.Init(m_eIP,IPA_CLIENT_TEST_PROD, false, NUM_PACKETS);
  2662. LOG_MSG_INFO("Creation of filtering table completed successfully");
  2663. // Configuring Filtering Rule No.1
  2664. cFilterTable0.GeneratePresetRule(1,sFilterRuleEntry);
  2665. sFilterRuleEntry.at_rear = true;
  2666. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  2667. sFilterRuleEntry.status = -1; // return value
  2668. sFilterRuleEntry.rule.action=IPA_PASS_TO_ROUTING;
  2669. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl[0]; //put here the handle corresponding to Routing Rule 1
  2670. sFilterRuleEntry.rule.attrib.attrib_mask = IPA_FLT_DST_ADDR; // Destination IP Based Filtering
  2671. sFilterRuleEntry.rule.attrib.u.v4.dst_addr_mask = 0xFF0000FF; // Mask
  2672. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0x7F000001; // Filter DST_IP == 127.0.0.1.
  2673. if (
  2674. ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry)) ||
  2675. !m_Filtering.AddFilteringRule(cFilterTable0.GetFilteringTable())
  2676. )
  2677. {
  2678. LOG_MSG_ERROR ("Adding Rule (0) to Filtering block Failed.");
  2679. bRetVal = false;
  2680. goto bail;
  2681. }
  2682. else
  2683. {
  2684. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n",
  2685. cFilterTable0.ReadRuleFromTable(0)->flt_rule_hdl,
  2686. cFilterTable0.ReadRuleFromTable(0)->status);
  2687. }
  2688. // Configuring Filtering Rule No.2
  2689. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  2690. sFilterRuleEntry.status = -1; // return Value
  2691. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl[1]; //put here the handle corresponding to Routing Rule 2
  2692. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0xC0A80101; // Filter DST_IP == 192.168.1.1.
  2693. if (
  2694. ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry)) ||
  2695. !m_Filtering.AddFilteringRule(cFilterTable0.GetFilteringTable())
  2696. )
  2697. {
  2698. LOG_MSG_ERROR ("Adding Rule(1) to Filtering block Failed.");
  2699. bRetVal = false;
  2700. goto bail;
  2701. }
  2702. else
  2703. {
  2704. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n",
  2705. cFilterTable0.ReadRuleFromTable(1)->flt_rule_hdl,
  2706. cFilterTable0.ReadRuleFromTable(1)->status);
  2707. }
  2708. // Configuring Filtering Rule No.3
  2709. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  2710. sFilterRuleEntry.status = -1; // return value
  2711. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl[2]; //put here the handle corresponding to Routing Rule 2
  2712. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0xC0A80102; // Filter DST_IP == 192.168.1.2.
  2713. if (
  2714. ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry)) ||
  2715. !m_Filtering.AddFilteringRule(cFilterTable0.GetFilteringTable())
  2716. )
  2717. {
  2718. LOG_MSG_ERROR ("Adding Rule(2) to Filtering block Failed.");
  2719. bRetVal = false;
  2720. goto bail;
  2721. }
  2722. else
  2723. {
  2724. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n",
  2725. cFilterTable0.ReadRuleFromTable(2)->flt_rule_hdl,
  2726. cFilterTable0.ReadRuleFromTable(2)->status);
  2727. }
  2728. // Configuring Filtering Rule No.4
  2729. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  2730. sFilterRuleEntry.status = -1; // return value
  2731. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl[3]; //put here the handle corresponding to Routing Rule 2
  2732. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0xC0A80103; // Filter DST_IP == 192.168.1.3.
  2733. if (
  2734. ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry)) ||
  2735. !m_Filtering.AddFilteringRule(cFilterTable0.GetFilteringTable())
  2736. )
  2737. {
  2738. LOG_MSG_ERROR ("Adding Rule(3) to Filtering block Failed.");
  2739. bRetVal = false;
  2740. goto bail;
  2741. }
  2742. else
  2743. {
  2744. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n",
  2745. cFilterTable0.ReadRuleFromTable(2)->flt_rule_hdl,
  2746. cFilterTable0.ReadRuleFromTable(2)->status);
  2747. }
  2748. // Configuring Filtering Rule No.5
  2749. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  2750. sFilterRuleEntry.status = -1; // return value
  2751. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl[4]; //put here the handle corresponding to Routing Rule 2
  2752. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0xC0A80104; // Filter DST_IP == 192.168.1.4.
  2753. if (
  2754. ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry)) ||
  2755. !m_Filtering.AddFilteringRule(cFilterTable0.GetFilteringTable())
  2756. )
  2757. {
  2758. LOG_MSG_ERROR ("Adding Rule(4) to Filtering block Failed.");
  2759. bRetVal = false;
  2760. goto bail;
  2761. }
  2762. else
  2763. {
  2764. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n",
  2765. cFilterTable0.ReadRuleFromTable(2)->flt_rule_hdl,
  2766. cFilterTable0.ReadRuleFromTable(2)->status);
  2767. }
  2768. bail:
  2769. Free(pHeaderDescriptor);
  2770. LOG_MSG_STACK(
  2771. "Leaving Function (Returning %s)", bRetVal?"True":"False");
  2772. return bRetVal;
  2773. } // AddRules()
  2774. /////////////////////////////////////////////////////////////////////////////////
  2775. bool TestLogic()
  2776. {
  2777. return MBIMAggregationScenarios::MBIMAggregationDifferentStreamIdsTest(
  2778. &m_UsbToIpaPipe, &m_IpaToUsbPipeAgg, m_eIP);
  2779. }
  2780. /////////////////////////////////////////////////////////////////////////////////
  2781. };
  2782. /////////////////////////////////////////////////////////////////////////////////
  2783. /////////////////////////////////////////////////////////////////////////////////
  2784. /////////////////////////////////////////////////////////////////////////////////
  2785. class MBIMAggregationNoInterleavingStreamIdsTest:
  2786. public MBIMAggregationTestFixtureConf11 {
  2787. public:
  2788. /////////////////////////////////////////////////////////////////////////////////
  2789. MBIMAggregationNoInterleavingStreamIdsTest(bool generic_agg)
  2790. : MBIMAggregationTestFixtureConf11(generic_agg)
  2791. {
  2792. if (generic_agg)
  2793. m_name = "GenMBIMAggregationNoInterleavingStreamIdsTest";
  2794. else
  2795. m_name = "MBIMAggregationNoInterleavingStreamIdsTest";
  2796. m_description = "MBIM Aggregation no interleaving stream IDs test - sends 5 packets"
  2797. "with interleaving stream IDs (0, 1, 0, 1, 0) and receives 1 aggregated "
  2798. "packet made of 5 NDPs";
  2799. }
  2800. /////////////////////////////////////////////////////////////////////////////////
  2801. virtual bool AddRules()
  2802. {
  2803. m_eIP = IPA_IP_v4;
  2804. const char aBypass[2][20] = {{"Bypass1"}, {"Bypass2"}};
  2805. uint32_t nTableHdl[2];
  2806. bool bRetVal = true;
  2807. IPAFilteringTable cFilterTable0;
  2808. struct ipa_flt_rule_add sFilterRuleEntry;
  2809. struct ipa_ioc_get_hdr sGetHeader[2];
  2810. uint8_t aHeadertoAdd[2][4];
  2811. int hdrSize;
  2812. for (int i = 0; i < 2; i++) {
  2813. if (mGenericAgg) {
  2814. hdrSize = 4;
  2815. aHeadertoAdd[i][0] = 0x49;
  2816. aHeadertoAdd[i][1] = 0x50;
  2817. aHeadertoAdd[i][2] = 0x53;
  2818. aHeadertoAdd[i][3] = (uint8_t)i;
  2819. }
  2820. else {
  2821. hdrSize = 1;
  2822. aHeadertoAdd[i][0] = (uint8_t)i;
  2823. }
  2824. }
  2825. LOG_MSG_STACK("Entering Function");
  2826. memset(&sFilterRuleEntry, 0, sizeof(sFilterRuleEntry));
  2827. for (int i = 0; i < 2; i++)
  2828. memset(&sGetHeader[i], 0, sizeof(sGetHeader[i]));
  2829. // Create Header:
  2830. // Allocate Memory, populate it, and add in to the Header Insertion.
  2831. struct ipa_ioc_add_hdr * pHeaderDescriptor = NULL;
  2832. pHeaderDescriptor = (struct ipa_ioc_add_hdr *) calloc(1,
  2833. sizeof(struct ipa_ioc_add_hdr)
  2834. + 2 * sizeof(struct ipa_hdr_add));
  2835. if (!pHeaderDescriptor)
  2836. {
  2837. LOG_MSG_ERROR("calloc failed to allocate pHeaderDescriptor");
  2838. bRetVal = false;
  2839. goto bail;
  2840. }
  2841. pHeaderDescriptor->commit = true;
  2842. pHeaderDescriptor->num_hdrs = 2;
  2843. // Adding Header No1.
  2844. strlcpy(pHeaderDescriptor->hdr[0].name, "StreamId0", sizeof(pHeaderDescriptor->hdr[0].name)); // Header's Name
  2845. memcpy(pHeaderDescriptor->hdr[0].hdr, (void*)&aHeadertoAdd[0],
  2846. hdrSize); //Header's Data
  2847. pHeaderDescriptor->hdr[0].hdr_len = hdrSize;
  2848. pHeaderDescriptor->hdr[0].hdr_hdl = -1; //Return Value
  2849. pHeaderDescriptor->hdr[0].is_partial = false;
  2850. pHeaderDescriptor->hdr[0].status = -1; // Return Parameter
  2851. // Adding Header No2.
  2852. strlcpy(pHeaderDescriptor->hdr[1].name, "StreamId1", sizeof(pHeaderDescriptor->hdr[1].name)); // Header's Name
  2853. memcpy(pHeaderDescriptor->hdr[1].hdr, (void*)&aHeadertoAdd[1],
  2854. hdrSize); //Header's Data
  2855. pHeaderDescriptor->hdr[1].hdr_len = hdrSize;
  2856. pHeaderDescriptor->hdr[1].hdr_hdl = -1; //Return Value
  2857. pHeaderDescriptor->hdr[1].is_partial = false;
  2858. pHeaderDescriptor->hdr[1].status = -1; // Return Parameter
  2859. for (int i = 0; i < 2; i++)
  2860. strlcpy(sGetHeader[i].name, pHeaderDescriptor->hdr[i].name, sizeof(sGetHeader[i].name));
  2861. if (!m_HeaderInsertion.AddHeader(pHeaderDescriptor))
  2862. {
  2863. LOG_MSG_ERROR("m_HeaderInsertion.AddHeader(pHeaderDescriptor) Failed.");
  2864. bRetVal = false;
  2865. goto bail;
  2866. }
  2867. for (int i = 0; i < 2; i++)
  2868. {
  2869. if (!m_HeaderInsertion.GetHeaderHandle(&sGetHeader[i]))
  2870. {
  2871. LOG_MSG_ERROR(" Failed");
  2872. bRetVal = false;
  2873. goto bail;
  2874. }
  2875. LOG_MSG_DEBUG("Received Header %d Handle = 0x%x", i, sGetHeader[i].hdl);
  2876. }
  2877. for (int i = 0; i < 2; i++)
  2878. {
  2879. if (!CreateBypassRoutingTable(&m_Routing, m_eIP, aBypass[i],
  2880. IPA_CLIENT_TEST2_CONS, sGetHeader[i].hdl,&nTableHdl[i]))
  2881. {
  2882. LOG_MSG_ERROR("CreateBypassRoutingTable Failed\n");
  2883. bRetVal = false;
  2884. goto bail;
  2885. }
  2886. }
  2887. LOG_MSG_INFO("Creation of 2 bypass routing tables completed successfully");
  2888. // Creating Filtering Rules
  2889. cFilterTable0.Init(m_eIP,IPA_CLIENT_TEST_PROD, false, 2);
  2890. LOG_MSG_INFO("Creation of filtering table completed successfully");
  2891. // Configuring Filtering Rule No.1
  2892. cFilterTable0.GeneratePresetRule(1,sFilterRuleEntry);
  2893. sFilterRuleEntry.at_rear = true;
  2894. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  2895. sFilterRuleEntry.status = -1; // return value
  2896. sFilterRuleEntry.rule.action=IPA_PASS_TO_ROUTING;
  2897. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl[0]; //put here the handle corresponding to Routing Rule 1
  2898. sFilterRuleEntry.rule.attrib.attrib_mask = IPA_FLT_DST_ADDR; // Destination IP Based Filtering
  2899. sFilterRuleEntry.rule.attrib.u.v4.dst_addr_mask = 0xFF0000FF; // Mask
  2900. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0x7F000001; // Filter DST_IP == 127.0.0.1.
  2901. if (
  2902. ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry)) ||
  2903. !m_Filtering.AddFilteringRule(cFilterTable0.GetFilteringTable())
  2904. )
  2905. {
  2906. LOG_MSG_ERROR ("Adding Rule (0) to Filtering block Failed.");
  2907. bRetVal = false;
  2908. goto bail;
  2909. }
  2910. else
  2911. {
  2912. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n",
  2913. cFilterTable0.ReadRuleFromTable(0)->flt_rule_hdl,
  2914. cFilterTable0.ReadRuleFromTable(0)->status);
  2915. }
  2916. // Configuring Filtering Rule No.2
  2917. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  2918. sFilterRuleEntry.status = -1; // return Value
  2919. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl[1]; //put here the handle corresponding to Routing Rule 2
  2920. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0xC0A80101; // Filter DST_IP == 192.168.1.1.
  2921. if (
  2922. ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry)) ||
  2923. !m_Filtering.AddFilteringRule(cFilterTable0.GetFilteringTable())
  2924. )
  2925. {
  2926. LOG_MSG_ERROR ("Adding Rule(1) to Filtering block Failed.");
  2927. bRetVal = false;
  2928. goto bail;
  2929. }
  2930. else
  2931. {
  2932. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n",
  2933. cFilterTable0.ReadRuleFromTable(1)->flt_rule_hdl,
  2934. cFilterTable0.ReadRuleFromTable(1)->status);
  2935. }
  2936. bail:
  2937. Free(pHeaderDescriptor);
  2938. LOG_MSG_STACK(
  2939. "Leaving Function (Returning %s)", bRetVal?"True":"False");
  2940. return bRetVal;
  2941. } // AddRules()
  2942. /////////////////////////////////////////////////////////////////////////////////
  2943. bool TestLogic()
  2944. {
  2945. return MBIMAggregationScenarios::MBIMAggregationNoInterleavingStreamIdsTest(
  2946. &m_UsbToIpaPipe, &m_IpaToUsbPipeAgg, m_eIP);
  2947. }
  2948. /////////////////////////////////////////////////////////////////////////////////
  2949. };
  2950. /////////////////////////////////////////////////////////////////////////////////
  2951. /////////////////////////////////////////////////////////////////////////////////
  2952. /////////////////////////////////////////////////////////////////////////////////
  2953. /* Legacy MBIM tests */
  2954. static MBIMAggregationTest mbimAggregationTest(false);
  2955. static MBIMDeaggregationTest mbimDeaggregationTest(false);
  2956. static MBIMDeaggregationOnePacketTest mbimDeaggregationOnePacketTest(false);
  2957. static MBIMDeaggregationAndAggregationTest mbimDeaggregationAndAggregationTest(false);
  2958. static MBIMMultipleDeaggregationAndAggregationTest
  2959. mbimMultipleDeaggregationAndAggregationTest(false);
  2960. static MBIMAggregationLoopTest mbimAggregationLoopTest(false);
  2961. static MBIMDeaggregationMultipleNDPTest mbimDeaggregationMultipleNDPTest(false);
  2962. static MBIMAggregationMultiplePacketsTest mbimAggregationMultiplePacketsTest(false);
  2963. static MBIMAggregation2PipesTest mbimAggregation2PipesTest(false);
  2964. static MBIMAggregationNoInterleavingStreamIdsTest
  2965. mbimAggregationNoInterleavingStreamIdsTest(false);
  2966. static MBIMAggregationDifferentStreamIdsTest mbimAggregationDifferentStreamIdsTest(false);
  2967. static MBIMAggregationTimeLimitTest mbimAggregationTimeLimitTest(false);
  2968. static MBIMAggregationByteLimitTest mbimAggregationByteLimitTest(false);
  2969. static MBIMAggregationTimeLimitLoopTest mbimAggregationTimeLimitLoopTest(false);
  2970. static MBIMAggregation0LimitsTest mbimAggregation0LimitsTest(false);
  2971. /* Generic Aggregation MBIM tests */
  2972. static MBIMAggregationTest genMbimAggregationTest(true);
  2973. static MBIMDeaggregationTest genMbimDeaggregationTest(true);
  2974. static MBIMDeaggregationOnePacketTest genMbimDeaggregationOnePacketTest(true);
  2975. static MBIMDeaggregationAndAggregationTest genMbimDeaggregationAndAggregationTest(true);
  2976. static MBIMMultipleDeaggregationAndAggregationTest genMbimMultipleDeaggregationAndAggregationTest(true);
  2977. static MBIMAggregationLoopTest genMbimAggregationLoopTest(true);
  2978. static MBIMDeaggregationMultipleNDPTest genMbimDeaggregationMultipleNDPTest(true);
  2979. static MBIMAggregationMultiplePacketsTest genMbimAggregationMultiplePacketsTest(true);
  2980. static MBIMAggregation2PipesTest genMbimAggregation2PipesTest(true);
  2981. static MBIMAggregationNoInterleavingStreamIdsTest genMbimAggregationNoInterleavingStreamIdsTest(true);
  2982. static MBIMAggregationDifferentStreamIdsTest genMbimAggregationDifferentStreamIdsTest(true);
  2983. static MBIMAggregationTimeLimitTest genMbimAggregationTimeLimitTest(true);
  2984. static MBIMAggregationByteLimitTest genMbimAggregationByteLimitTest(true);
  2985. static MBIMAggregationByteLimitTestFC genMbimAggregationByteLimitTestFC(true);
  2986. static MBIMAggregationDualDpTestFC genMBIMAggregationDualDpTestFC(true);
  2987. static MBIMAggregationDualDpTestFcRoutingBased genMBIMAggregationDualDpTestFcRoutingBased(true);
  2988. static MBIMAggregationTimeLimitLoopTest genMbimAggregationTimeLimitLoopTest(true);
  2989. static MBIMAggregation0LimitsTest genMbimAggregation0LimitsTest(true);
  2990. /////////////////////////////////////////////////////////////////////////////////
  2991. // EOF ////
  2992. /////////////////////////////////////////////////////////////////////////////////