blob: 08c3a6de6c975284a458fadcb1102f6926173883 [file] [log] [blame]
Ilia Linf1c1fb32021-05-04 15:55:34 +03001/*
2 * Copyright (c) 2017-2019 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
30#include "HeaderProcessingContextTestFixture.h"
31#include "TestsUtils.h"
32
33const Byte IpaHdrProcCtxTestFixture::WLAN_ETH2_HDR[WLAN_ETH2_HDR_SIZE] =
34{
35 // WLAN hdr - 4 bytes
36 0xa1, 0xb2, 0xc3, 0xd4,
37
38 // ETH2 - 14 bytes
39 0x00, 0x00, 0x00, 0x00,
40 0x00, 0x00, 0x00, 0x00,
41 0x00, 0x00, 0x00, 0x00,
42 0x00, 0x00
43};
44
45const Byte IpaHdrProcCtxTestFixture::ETH2_HDR[ETH_HLEN] =
46{
47 // ETH2 - 14 bytes
48 0x00, 0x00, 0x00, 0x00,
49 0x00, 0x00, 0x00, 0x00,
50 0x00, 0x00, 0x00, 0x00,
51 0x00, 0x00
52};
53
54const Byte IpaHdrProcCtxTestFixture::ETH2_8021Q_HDR[ETH8021Q_HEADER_LEN] =
55{
56 // 802_1Q - 18 bytes
57 // src and dst MAC - 6 + 6 bytes
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60
61 // 802_1Q tag - VLAN ID 3
62 0x81, 0x00, 0x00, 0x03,
63 // ethertype
64 0x00, 0x00
65};
66
67const Byte IpaHdrProcCtxTestFixture::WLAN_802_3_HDR[WLAN_802_3_HDR_SIZE] =
68{
69 // WLAN hdr - 4 bytes
70 0x0a, 0x0b, 0x0c, 0x0d,
71
72 // 802_3 - 26 bytes
73 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x00,
76 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00,
78 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00
80};
81
82IpaHdrProcCtxTestFixture::IpaHdrProcCtxTestFixture():
83 m_procCtxHandleId(PROC_CTX_HANDLE_ID_MAX),
84 m_pCurrentProducer(NULL),
85 m_pCurrentConsumer(NULL),
86 m_sendSize1 (m_BUFF_MAX_SIZE),
87 m_sendSize2 (m_BUFF_MAX_SIZE),
88 m_expectedBufferSize1(0),
89 m_IpaIPType(IPA_IP_v4)
90{
91 memset(m_headerHandles, 0, sizeof(m_headerHandles));
92 memset(m_procCtxHHandles, 0, sizeof(m_procCtxHHandles));
93 memset(m_sendBuffer1, 0, sizeof(m_sendBuffer1));
94 memset(m_sendBuffer2, 0, sizeof(m_sendBuffer2));
95 memset(m_expectedBuffer1, 0, sizeof(m_expectedBuffer1));
96 m_testSuiteName.push_back("HdrProcCtx");
97}
98
99bool IpaHdrProcCtxTestFixture::Setup()
100{
101 ConfigureScenario(PHASE_TWENTY_TEST_CONFIGURATION);
102
103 // init producers
104 m_rndisEth2Producer.Open(INTERFACE0_TO_IPA_DATA_PATH,
105 INTERFACE0_FROM_IPA_DATA_PATH);
106 m_wlanEth2producer.Open(INTERFACE4_TO_IPA_DATA_PATH,
107 INTERFACE4_FROM_IPA_DATA_PATH);
108 m_eth2Producer.Open(INTERFACE5_TO_IPA_DATA_PATH,
109 INTERFACE5_FROM_IPA_DATA_PATH);
110
111 // init consumers
112 m_defaultConsumer.Open(INTERFACE1_TO_IPA_DATA_PATH,
113 INTERFACE1_FROM_IPA_DATA_PATH);
114 m_rndisEth2Consumer.Open(INTERFACE2_TO_IPA_DATA_PATH,
115 INTERFACE2_FROM_IPA_DATA_PATH);
116
117 if (!m_headerInsertion.DeviceNodeIsOpened())
118 {
119 LOG_MSG_ERROR("HeaderInsertion block is not ready "
120 "for immediate commands!\n");
121 return false;
122 }
123
124 if (!m_routing.DeviceNodeIsOpened())
125 {
126 LOG_MSG_ERROR("Routing block is not ready "
127 "for immediate commands!\n");
128 return false;
129 }
130
131 if (!m_filtering.DeviceNodeIsOpened())
132 {
133 LOG_MSG_ERROR("Filtering block is not ready "
134 "for immediate commands!\n");
135 return false;
136 }
137
138 // resetting this component will reset
139 // both Routing and Filtering tables
140 m_headerInsertion.Reset();
141
142 return true;
143} // Setup()
144
145bool IpaHdrProcCtxTestFixture::Teardown()
146{
147 m_rndisEth2Producer.Close();
148 m_wlanEth2producer.Close();
149 m_eth2Producer.Close();
150 m_defaultConsumer.Close();
151 m_rndisEth2Consumer.Close();
152 return true;
153} // Teardown()
154
155void IpaHdrProcCtxTestFixture::AddAllHeaders()
156{
157 for (int i = 0; i < HEADER_HANDLE_ID_MAX; i++) {
158 AddHeader(static_cast<HeaderHandleId>(i));
159 }
160}
161
162// Insert a single header
163void IpaHdrProcCtxTestFixture::AddHeader(HeaderHandleId handleId)
164{
165 static const int NUM_OF_HEADERS = 1;
166 struct ipa_ioc_add_hdr *hdrTable = NULL;
167 struct ipa_hdr_add *hdr = NULL;
168
169 // init hdr table
170 hdrTable = (struct ipa_ioc_add_hdr *) calloc(1,
171 sizeof(struct ipa_ioc_add_hdr)
172 + NUM_OF_HEADERS * sizeof(struct ipa_hdr_add));
173 if (!hdrTable)
174 {
175 LOG_MSG_ERROR(
176 "calloc failed to allocate pHeaderDescriptor");
177 return;
178 }
179 hdrTable->commit = true;
180 hdrTable->num_hdrs = NUM_OF_HEADERS;
181
182 // init the hdr common fields
183 hdr = &hdrTable->hdr[0];
184 hdr->hdr_hdl = -1; //Return Value
185 hdr->is_partial = false;
186 hdr->status = -1; // Return Parameter
187
188 // init hdr specific fields
189 switch (handleId)
190 {
191 case HEADER_HANDLE_ID_WLAN_ETH2:
192 memcpy(hdr->hdr, WLAN_ETH2_HDR, WLAN_ETH2_HDR_SIZE);
193 hdr->hdr_len = WLAN_ETH2_HDR_SIZE;
194
195 strlcpy(hdr->name, "WLAN_ETH2", sizeof(hdr->name));
196 hdr->type = IPA_HDR_L2_ETHERNET_II;
197 break;
198
199 case HEADER_HANDLE_ID_RNDIS_ETH2:
200 if (!RNDISAggregationHelper::LoadRNDISEth2IP4Header(
201 hdr->hdr,
202 IPA_HDR_MAX_SIZE,
203 0,
204 (size_t*)&hdr->hdr_len))
205 return;
206
207 strlcpy(hdr->name, "RNDIS_ETH2", sizeof(hdr->name));
208 hdr->type = IPA_HDR_L2_ETHERNET_II;
209 break;
210
211 case HEADER_HANDLE_ID_ETH2:
212 strlcpy(hdr->name, "ETH2", sizeof(hdr->name));
213 memcpy(hdr->hdr, ETH2_HDR, ETH_HLEN);
214 hdr->type = IPA_HDR_L2_ETHERNET_II;
215 hdr->hdr_len = ETH_HLEN;
216
217 break;
218
219 case HEADER_HANDLE_ID_WLAN_802_3:
220 strlcpy(hdr->name, "WLAN_802_3", sizeof(hdr->name));
221 memcpy(hdr->hdr, WLAN_802_3_HDR, WLAN_802_3_HDR_SIZE);
222 hdr->type = IPA_HDR_L2_802_3;
223 hdr->hdr_len = WLAN_802_3_HDR_SIZE;
224
225 LOG_MSG_DEBUG(
226 "HEADER_HANDLE_ID_WLAN_802_3 NOT supported for now");
227 return;
228
229 break;
230 case HEADER_HANDLE_ID_VLAN_802_1Q:
231 strlcpy(hdr->name, "VLAN_8021Q", sizeof(hdr->name));
232 memcpy(hdr->hdr, ETH2_8021Q_HDR, ETH8021Q_HEADER_LEN);
233 hdr->type = IPA_HDR_L2_802_1Q;
234 hdr->hdr_len = ETH8021Q_HEADER_LEN;
235 break;
236
237 default:
238 LOG_MSG_ERROR("header handleId not supported.");
239 return;
240 }
241
242 // commit header to HW
243 if (!m_headerInsertion.AddHeader(hdrTable))
244 {
245 LOG_MSG_ERROR("m_headerInsertion.AddHeader() failed.");
246 return;
247 }
248
249 // save header handle
250 m_headerHandles[handleId] = hdr->hdr_hdl;
251}
252
253void IpaHdrProcCtxTestFixture::AddAllProcCtx()
254{
255 for (int i = 0; i <PROC_CTX_HANDLE_ID_MAX; i++)
256 {
257 AddProcCtx(static_cast<ProcCtxHandleId>(i));
258 }
259}
260
261// Insert a single proc_ctx
262void IpaHdrProcCtxTestFixture::AddProcCtx(ProcCtxHandleId handleId)
263{
264 static const int NUM_OF_PROC_CTX = 1;
265 struct ipa_ioc_add_hdr_proc_ctx *procCtxTable = NULL;
266 struct ipa_hdr_proc_ctx_add *procCtx = NULL;
267
268 // init proc ctx table
269 procCtxTable = (struct ipa_ioc_add_hdr_proc_ctx *)calloc(1,
270 sizeof(struct ipa_ioc_add_hdr_proc_ctx)
271 + NUM_OF_PROC_CTX *
272 sizeof(struct ipa_hdr_proc_ctx_add));
273 if (!procCtxTable)
274 {
275 LOG_MSG_ERROR("calloc failed to allocate procCtxTable");
276 return;
277 }
278
279 procCtxTable->commit = true;
280 procCtxTable->num_proc_ctxs = NUM_OF_PROC_CTX;
281
282 // init proc_ctx common fields
283 procCtx = &procCtxTable->proc_ctx[0];
284 procCtx->proc_ctx_hdl = -1; // return value
285 procCtx->status = -1; // Return parameter
286
287 // init proc_ctx specific fields
288 switch (handleId)
289 {
290 case PROC_CTX_HANDLE_ID_ETH2_2_WLAN_ETH2:
291 procCtx->type = IPA_HDR_PROC_ETHII_TO_ETHII;
292 procCtx->hdr_hdl =
293 m_headerHandles[HEADER_HANDLE_ID_WLAN_ETH2];
294 break;
295
296 case PROC_CTX_HANDLE_ID_ETH2_2_RNDIS_ETH2:
297 procCtx->type = IPA_HDR_PROC_ETHII_TO_ETHII;
298 procCtx->hdr_hdl =
299 m_headerHandles[HEADER_HANDLE_ID_RNDIS_ETH2];
300 break;
301
302 case PROC_CTX_HANDLE_ID_ETH2_ETH2_2_ETH2:
303 procCtx->type = IPA_HDR_PROC_ETHII_TO_ETHII;
304 procCtx->hdr_hdl =
305 m_headerHandles[HEADER_HANDLE_ID_ETH2];
306 break;
307
308 case PROC_CTX_HANDLE_ID_WLAN_ETH2_2_802_3:
309 procCtx->type = IPA_HDR_PROC_ETHII_TO_802_3;
310 procCtx->hdr_hdl =
311 m_headerHandles[HEADER_HANDLE_ID_WLAN_802_3];
312 break;
313
314 case PROC_CTX_HANDLE_ID_RNDIS_802_3_2_ETH2:
315 procCtx->type = IPA_HDR_PROC_802_3_TO_ETHII;
316 procCtx->hdr_hdl =
317 m_headerHandles[HEADER_HANDLE_ID_RNDIS_ETH2];
318 break;
319
320 case PROC_CTX_HANDLE_ID_WLAN_802_3_2_ETH2:
321 procCtx->type = IPA_HDR_PROC_802_3_TO_802_3;
322 procCtx->hdr_hdl =
323 m_headerHandles[HEADER_HANDLE_ID_WLAN_802_3];
324 break;
325 case PROC_CTX_HANDLE_ID_802_1Q_2_802_1Q:
326 procCtx->type = IPA_HDR_PROC_ETHII_TO_ETHII_EX;
327 procCtx->hdr_hdl =
328 m_headerHandles[HEADER_HANDLE_ID_VLAN_802_1Q];
329 procCtx->generic_params.input_ethhdr_negative_offset = 18;
330 procCtx->generic_params.output_ethhdr_negative_offset = 18;
331 break;
332 case PROC_CTX_HANDLE_ID_802_1Q_2_ETH2:
333 procCtx->type = IPA_HDR_PROC_ETHII_TO_ETHII_EX;
334 procCtx->hdr_hdl =
335 m_headerHandles[HEADER_HANDLE_ID_ETH2];
336 procCtx->generic_params.input_ethhdr_negative_offset = 18;
337 procCtx->generic_params.output_ethhdr_negative_offset = 14;
338 break;
339 case PROC_CTX_HANDLE_ID_ETH2_2_802_1Q:
340 procCtx->type = IPA_HDR_PROC_ETHII_TO_ETHII_EX;
341 procCtx->hdr_hdl =
342 m_headerHandles[HEADER_HANDLE_ID_VLAN_802_1Q];
343 procCtx->generic_params.input_ethhdr_negative_offset = 14;
344 procCtx->generic_params.output_ethhdr_negative_offset = 18;
345 break;
346 case PROC_CTX_HANDLE_ID_ETH2_ETH2_2_ETH2_EX:
347 procCtx->type = IPA_HDR_PROC_ETHII_TO_ETHII_EX;
348 procCtx->hdr_hdl =
349 m_headerHandles[HEADER_HANDLE_ID_ETH2];
350 procCtx->generic_params.input_ethhdr_negative_offset = 14;
351 procCtx->generic_params.output_ethhdr_negative_offset = 14;
352 break;
353
354 default:
355 LOG_MSG_ERROR("proc ctx handleId %d not supported.", handleId);
356 return;
357 }
358
359 if (!m_headerInsertion.AddProcCtx(procCtxTable))
360 {
361 LOG_MSG_ERROR("m_headerInsertion.AddProcCtx(procCtxTable) failed.");
362 return;
363 }
364
365 // save proc_ctx handle
366 m_procCtxHHandles[handleId] = procCtx->proc_ctx_hdl;
367}
368
369void IpaHdrProcCtxTestFixture::AddRtBypassRule(uint32_t hdrHdl, uint32_t procCtxHdl)
370{
371 static const char bypass0[] = "bypass0";
372 struct ipa_ioc_get_rt_tbl routing_table0;
373
374 if (!CreateIPv4BypassRoutingTable (
375 bypass0,
376 hdrHdl,
377 procCtxHdl))
378 {
379 LOG_MSG_ERROR("CreateIPv4BypassRoutingTable Failed\n");
380 return;
381 }
382
383 routing_table0.ip = IPA_IP_v4;
384 strlcpy(routing_table0.name, bypass0, sizeof(routing_table0.name));
385 if (!m_routing.GetRoutingTable(&routing_table0))
386 {
387 LOG_MSG_ERROR("m_routing.GetRoutingTable() Failed.");
388 return;
389 }
390
391 m_routingTableHdl = routing_table0.hdl;
392}
393
394void IpaHdrProcCtxTestFixture::AddFltBypassRule()
395{
396 IPAFilteringTable FilterTable0;
397 struct ipa_flt_rule_add flt_rule_entry;
398
399 FilterTable0.Init(IPA_IP_v4,m_currProducerClient,false,1);
400 printf("FilterTable*.Init Completed Successfully..\n");
401
402 // Configuring Filtering Rule No.0
403 FilterTable0.GeneratePresetRule(1,flt_rule_entry);
404 flt_rule_entry.at_rear = true;
405 flt_rule_entry.flt_rule_hdl=-1; // return Value
406 flt_rule_entry.status = -1; // return value
407 flt_rule_entry.rule.action=IPA_PASS_TO_ROUTING;
408 flt_rule_entry.rule.rt_tbl_hdl=m_routingTableHdl;
409 flt_rule_entry.rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
410 flt_rule_entry.rule.attrib.u.v4.dst_addr_mask = 0x00000000; // Mask - Bypass rule
411 flt_rule_entry.rule.attrib.u.v4.dst_addr = 0x12345678; // Filter is irrelevant.
412 if (((uint8_t)-1 == FilterTable0.AddRuleToTable(flt_rule_entry)) ||
413 !m_filtering.AddFilteringRule(
414 FilterTable0.GetFilteringTable()))
415 {
416 LOG_MSG_ERROR(
417 "%s::m_filtering.AddFilteringRule() failed",
418 __FUNCTION__);
419 return;
420 }
421 else
422 {
423 printf("flt rule hdl0=0x%x, status=0x%x\n",
424 FilterTable0.ReadRuleFromTable(0)->flt_rule_hdl,
425 FilterTable0.ReadRuleFromTable(0)->status);
426 }
427}
428
429bool IpaHdrProcCtxTestFixture::ReceivePacketsAndCompare()
430{
431 size_t receivedBufferSize1 = 0;
432 bool isSuccess = true;
433
434 // Receive results
435 Byte *receivedBuffer1 = new Byte[m_BUFF_MAX_SIZE];
436
437 if (NULL == receivedBuffer1)
438 {
439 printf("Memory allocation error.\n");
440 return false;
441 }
442
443 receivedBufferSize1 = m_pCurrentConsumer->ReceiveData(
444 receivedBuffer1,
445 m_BUFF_MAX_SIZE);
446 printf("Received %zu bytes on %s.\n",
447 receivedBufferSize1,
448 m_pCurrentConsumer->m_fromChannelName.c_str());
449
450 // Compare results
451 if (!CompareResultVsGolden(
452 m_expectedBuffer1,
453 m_expectedBufferSize1,
454 receivedBuffer1,
455 receivedBufferSize1))
456 {
457 printf("Comparison of Buffer Failed!\n");
458 isSuccess = false;
459 }
460
461 printf("Expected buffer 1 - %zu bytes\n", m_expectedBufferSize1);
462 print_buff(m_expectedBuffer1, m_expectedBufferSize1);
463
464 printf("Received buffer 1 - %zu bytes\n", receivedBufferSize1);
465 print_buff(receivedBuffer1, receivedBufferSize1);
466
467 delete[] receivedBuffer1;
468
469 return isSuccess;
470}
471
472// Create 1 IPv4 bypass routing entry and commits it
473bool IpaHdrProcCtxTestFixture::CreateIPv4BypassRoutingTable (
474 const char *name,
475 uint32_t hdrHdl,
476 uint32_t procCtxHdl)
477{
478 printf("Entering %s, %s()\n",__FUNCTION__, __FILE__);
479 struct ipa_ioc_add_rt_rule *rt_table = 0;
480 struct ipa_rt_rule_add *rt_rule_entry = NULL;
481
482 // Verify that only one is nonzero
483 if ((hdrHdl == 0 && procCtxHdl == 0) ||
484 (hdrHdl != 0 && procCtxHdl != 0))
485 {
486 LOG_MSG_ERROR("Error: hdrHdl = %u, procCtxHdl = %u\n");
487 return false;
488 }
489
490 rt_table = (struct ipa_ioc_add_rt_rule *)
491 calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
492 1*sizeof(struct ipa_rt_rule_add));
493 if(!rt_table) {
494 LOG_MSG_ERROR("calloc failed to allocate rt_table\n");
495 return false;
496 }
497
498 rt_table->num_rules = 1;
499 rt_table->ip = IPA_IP_v4;
500 rt_table->commit = true;
501 strlcpy(rt_table->rt_tbl_name, name, sizeof(rt_table->rt_tbl_name));
502
503 rt_rule_entry = &rt_table->rules[0];
504 rt_rule_entry->at_rear = 0;
505 rt_rule_entry->rule.dst = m_currConsumerPipeNum;
506 rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
507 rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xaabbccdd;
508
509 // All Packets will get a "Hit"
510 rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0x00000000;
511 rt_rule_entry->rule.hdr_hdl = hdrHdl;
512 rt_rule_entry->rule.hdr_proc_ctx_hdl = procCtxHdl;
513 if (false == m_routing.AddRoutingRule(rt_table))
514 {
515 printf("Routing rule addition(rt_table) failed!\n");
516 Free (rt_table);
517 return false;
518 }
519
520 Free (rt_table);
521 printf("Leaving %s, %s()\n",__FUNCTION__, __FILE__);
522 return true;
523}
524
525bool IpaHdrProcCtxTestFixture::AddRules()
526{
527 printf("Entering %s, %s()\n",__FUNCTION__, __FILE__);
528
529 if (m_procCtxHandleId == PROC_CTX_HANDLE_ID_MAX)
530 {
531 LOG_MSG_ERROR("Test developer didn't implement "
532 "AddRules() or didn't set m_procCtxHandleId");
533 return false;
534 }
535
536 AddAllHeaders();
537
538 AddAllProcCtx();
539
540 AddRtBypassRule(0, m_procCtxHHandles[m_procCtxHandleId]);
541
542 AddFltBypassRule();
543
544 printf("Leaving %s, %s()\n",__FUNCTION__, __FILE__);
545 return true;
546
547}// AddRules()
548
549bool IpaHdrProcCtxTestFixture::SendPackets()
550{
551
552 bool isSuccess = false;
553
554 // Send first packet
555 isSuccess = m_pCurrentProducer->SendData(
556 m_sendBuffer1,
557 m_sendSize1);
558 if (false == isSuccess)
559 {
560 LOG_MSG_ERROR("SendPackets Buffer1 failed on client %d\n", m_currProducerClient);
561 return false;
562 }
563
564 return true;
565}
566
567bool IpaHdrProcCtxTestFixture::Run()
568{
569 bool res = false;
570 bool isSuccess = false;
571
572 printf("Entering %s, %s()\n",__FUNCTION__, __FILE__);
573
574 res = AddRules();
575 if (false == res) {
576 printf("Failed adding filtering rules.\n");
577 return false;
578 }
579
580 // Load input data - IP packets
581 res = LoadPackets(m_IpaIPType);
582 if (false == res) {
583 printf("Failed loading packets.\n");
584 return false;
585 }
586
587 res = GenerateExpectedPackets();
588 if (false == res) {
589 printf("GenerateExpectedPackets failed\n");
590 return false;
591 }
592
593 res = SendPackets();
594 if (false == res) {
595 printf("SendPackets failed\n");
596 return false;
597 }
598
599 // Receive packets from the channels and compare results
600 isSuccess = ReceivePacketsAndCompare();
601
602 printf("Leaving %s, %s(), Returning %d\n",
603 __FUNCTION__,
604 __FILE__,
605 isSuccess);
606
607 return isSuccess;
608} // Run()
609
610IpaHdrProcCtxTestFixture::~IpaHdrProcCtxTestFixture()
611{
612 m_sendSize1 = 0;
613}
614
615RoutingDriverWrapper IpaHdrProcCtxTestFixture::m_routing;
616Filtering IpaHdrProcCtxTestFixture::m_filtering;
617HeaderInsertion IpaHdrProcCtxTestFixture::m_headerInsertion;
618