VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp@ 61

Last change on this file since 61 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.1 KB
Line 
1/** @file
2 *
3 * VBox - Testcase for the Ring-0 part of internal networking.
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#define IN_INTNET_TESTCASE
27#define IN_INTNET_R3
28#include <VBox/cdefs.h>
29#undef INTNETR0DECL
30#define INTNETR0DECL INTNETR3DECL
31#include <VBox/intnet.h>
32#include <VBox/sup.h>
33#include <VBox/err.h>
34#include <iprt/stream.h>
35#include <iprt/alloc.h>
36#include <iprt/runtime.h>
37#include <iprt/thread.h>
38#include <iprt/time.h>
39#include <iprt/asm.h>
40
41
42/*******************************************************************************
43* Structures and Typedefs *
44*******************************************************************************/
45/**
46 * Security objectype.
47 */
48typedef enum SUPDRVOBJTYPE
49{
50 /** The usual invalid object. */
51 SUPDRVOBJTYPE_INVALID = 0,
52 /** Internal network. */
53 SUPDRVOBJTYPE_INTERNAL_NETWORK,
54 /** Internal network interface. */
55 SUPDRVOBJTYPE_INTERNAL_NETWORK_INTERFACE,
56 /** The first invalid object type in this end. */
57 SUPDRVOBJTYPE_END,
58 /** The usual 32-bit type size hack. */
59 SUPDRVOBJTYPE_32_BIT_HACK = 0x7ffffff
60} SUPDRVOBJTYPE;
61
62/**
63 * Object destructor callback.
64 * This is called for reference counted objectes when the count reaches 0.
65 *
66 * @param pvObj The object pointer.
67 * @param pvUser1 The first user argument.
68 * @param pvUser2 The second user argument.
69 */
70typedef DECLCALLBACK(void) FNSUPDRVDESTRUCTOR(void *pvObj, void *pvUser1, void *pvUser2);
71/** Pointer to a FNSUPDRVDESTRUCTOR(). */
72typedef FNSUPDRVDESTRUCTOR *PFNSUPDRVDESTRUCTOR;
73
74
75/**
76 * Dummy
77 */
78typedef struct OBJREF
79{
80 PFNSUPDRVDESTRUCTOR pfnDestructor;
81 void *pvUser1;
82 void *pvUser2;
83 uint32_t volatile cRefs;
84} OBJREF, *POBJREF;
85
86/*******************************************************************************
87* Global Variables *
88*******************************************************************************/
89/** The error count. */
90unsigned g_cErrors = 0;
91
92/** Fake session handle. */
93const PSUPDRVSESSION g_pSession = (PSUPDRVSESSION)0xdeadface;
94
95/** Testframe 0 */
96struct TESTFRAME
97{
98 uint16_t au16[6];
99} g_TestFrame0 = { { /* dst:*/ 0xffff, 0xffff, 0xffff, /*src:*/0x8086, 0, 0} },
100 g_TestFrame1 = { { /* dst:*/0, 0, 0, /*src:*/0x8086, 0, 1} };
101
102
103INTNETR3DECL(void *) SUPR0ObjRegister(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2)
104{
105 if (pSession != g_pSession)
106 {
107 RTPrintf("tstIntNetR0: Invalid session pointer %p, %s!\n", pSession, __FUNCTION__);
108 g_cErrors++;
109 return NULL;
110 }
111 POBJREF pRef = (POBJREF)RTMemAlloc(sizeof(OBJREF));
112 if (!pRef)
113 return NULL;
114 pRef->cRefs = 1;
115 pRef->pfnDestructor = pfnDestructor;
116 pRef->pvUser1 = pvUser1;
117 pRef->pvUser2 = pvUser2;
118 return pRef;
119}
120
121INTNETR3DECL(int) SUPR0ObjAddRef(void *pvObj, PSUPDRVSESSION pSession)
122{
123 if (pSession != g_pSession)
124 {
125 RTPrintf("tstIntNetR0: Invalid session pointer %p, %s!\n", pSession, __FUNCTION__);
126 g_cErrors++;
127 return VERR_INVALID_PARAMETER;
128 }
129 POBJREF pRef = (POBJREF)pvObj;
130 ASMAtomicIncU32(&pRef->cRefs);
131 return VINF_SUCCESS;
132}
133
134INTNETR3DECL(int) SUPR0ObjRelease(void *pvObj, PSUPDRVSESSION pSession)
135{
136 if (pSession != g_pSession)
137 {
138 RTPrintf("tstIntNetR0: Invalid session pointer %p, %s!\n", pSession, __FUNCTION__);
139 g_cErrors++;
140 return VERR_INVALID_PARAMETER;
141 }
142 POBJREF pRef = (POBJREF)pvObj;
143 if (!ASMAtomicDecU32(&pRef->cRefs))
144 {
145 pRef->pfnDestructor(pRef, pRef->pvUser1, pRef->pvUser2);
146 RTMemFree(pRef);
147 }
148 return VINF_SUCCESS;
149}
150
151INTNETR3DECL(int) SUPR0ObjVerifyAccess(void *pvObj, PSUPDRVSESSION pSession, const char *pszObjName)
152{
153 if (pSession != g_pSession)
154 {
155 RTPrintf("tstIntNetR0: Invalid session pointer %p, %s!\n", pSession, __FUNCTION__);
156 g_cErrors++;
157 return VERR_INVALID_PARAMETER;
158 }
159 return VINF_SUCCESS;
160}
161
162INTNETR3DECL(int) SUPR0MemAlloc(PSUPDRVSESSION pSession, unsigned cb, void **ppvR0, void **ppvR3)
163{
164 if (pSession != g_pSession)
165 {
166 RTPrintf("tstIntNetR0: Invalid session pointer %p, %s!\n", pSession, __FUNCTION__);
167 g_cErrors++;
168 return VERR_INVALID_PARAMETER;
169 }
170 void *pv = RTMemAlloc(cb);
171 if (!pv)
172 return VERR_NO_MEMORY;
173 *ppvR0 = pv;
174 if (ppvR3)
175 *ppvR3 = pv;
176 return VINF_SUCCESS;
177}
178
179INTNETR3DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, void *pv)
180{
181 if (pSession != g_pSession)
182 {
183 RTPrintf("tstIntNetR0: Invalid session pointer %p, %s!\n", pSession, __FUNCTION__);
184 g_cErrors++;
185 return VERR_INVALID_PARAMETER;
186 }
187 RTMemFree(pv);
188 return VINF_SUCCESS;
189}
190
191
192
193/* ugly but necessary for making R0 code compilable for R3. */
194#include "../SrvIntNetR0.cpp"
195
196typedef struct ARGS
197{
198 PINTNET pIntNet;
199 PINTNETBUF pBuf;
200 INTNETIFHANDLE hIf;
201 PDMMAC Mac;
202 uint64_t u64Start;
203 uint64_t u64End;
204} ARGS, *PARGS;
205
206
207#define TEST_TRANSFER_SIZE (_1M*128)
208
209/**
210 * Send thread.
211 * This is constantly broadcasting frames to the network.
212 */
213DECLCALLBACK(int) SendThread(RTTHREAD Thread, void *pvArg)
214{
215 PARGS pArgs = (PARGS)pvArg;
216
217 /*
218 * Send 64 MB of data.
219 */
220 uint8_t abBuf[4096] = {0};
221 PPDMMAC pMacSrc = (PPDMMAC)&abBuf[0];
222 PPDMMAC pMacDst = pMacSrc + 1;
223 *pMacSrc = pArgs->Mac;
224 *pMacDst = pArgs->Mac;
225 pMacDst->au16[2] = pArgs->Mac.au16[2] ? 0 : 1;
226 unsigned *puFrame = (unsigned *)(pMacDst + 1);
227 unsigned iFrame = 0;
228 unsigned cbSent = 0;
229 pArgs->u64Start = RTTimeNanoTS();
230 for (; cbSent < TEST_TRANSFER_SIZE; iFrame++)
231 {
232 const unsigned cb = iFrame % 1519 + 12 + sizeof(unsigned);
233 *puFrame = iFrame;
234 int rc = INTNETR0IfSend(pArgs->pIntNet, pArgs->hIf, abBuf, cb);
235 if (VBOX_FAILURE(rc))
236 {
237 g_cErrors++;
238 RTPrintf("tstIntNetR0: Failed sending %d bytes, rc=%Vrc\n", cb, rc);
239 }
240 cbSent += cb;
241 }
242
243 /*
244 * Termination frames.
245 */
246 puFrame[0] = 0xffffdead;
247 puFrame[1] = 0xffffdead;
248 puFrame[2] = 0xffffdead;
249 puFrame[3] = 0xffffdead;
250 for (unsigned c = 0; c < 20; c++)
251 {
252 int rc = INTNETR0IfSend(pArgs->pIntNet, pArgs->hIf, abBuf, sizeof(PDMMAC) * 2 + sizeof(unsigned) * 4);
253 if (VBOX_FAILURE(rc))
254 {
255 g_cErrors++;
256 RTPrintf("tstIntNetR0: send failed, rc=%Vrc\n", rc);
257 }
258 RTThreadSleep(1);
259 }
260
261 RTPrintf("tstIntNetR0: sender thread %.6Rhxs terminating. iFrame=%d cbSent=%d\n", &pArgs->Mac, iFrame, cbSent);
262 return 0;
263}
264
265
266/** Ignore lost frames. It only makes things worse to bitch about it. */
267#define IGNORE_LOST_FRAMES
268
269/**
270 * Receive thread.
271 * This is reading stuff from the network.
272 */
273DECLCALLBACK(int) ReceiveThread(RTTHREAD Thread, void *pvArg)
274{
275 unsigned cbReceived = 0;
276 unsigned cLostFrames = 0;
277 unsigned iFrame = ~0;
278 PARGS pArgs = (PARGS)pvArg;
279 for (;;)
280 {
281 /*
282 * Wait for data.
283 */
284 int rc = INTNETR0IfWait(pArgs->pIntNet, pArgs->hIf, RT_INDEFINITE_WAIT);
285 switch (rc)
286 {
287 case VERR_INTERRUPTED:
288 case VINF_SUCCESS:
289 break;
290 case VERR_SEM_DESTROYED:
291 RTPrintf("tstIntNetR0: receiver thread %.6Rhxs terminating. cbReceived=%u cLostFrames=%u iFrame=%u\n",
292 &pArgs->Mac, cbReceived, cLostFrames, iFrame);
293 return VINF_SUCCESS;
294
295 default:
296 RTPrintf("tstIntNetR0: receiver thread %.6Rhxs got odd return value %Vrc! cbReceived=%u cLostFrames=%u iFrame=%u\n",
297 &pArgs->Mac, rc, cbReceived, cLostFrames, iFrame);
298 g_cErrors++;
299 return rc;
300 }
301
302 /*
303 * Read data.
304 */
305 while (INTNETRingGetReadable(&pArgs->pBuf->Recv))
306 {
307 uint8_t abBuf[16384];
308 unsigned cb = INTNETRingReadFrame(pArgs->pBuf, &pArgs->pBuf->Recv, abBuf);
309 unsigned *puFrame = (unsigned *)&abBuf[sizeof(PDMMAC) * 2];
310
311 /* check for termination frame. */
312 if ( cb == sizeof(PDMMAC) * 2 + sizeof(unsigned) * 4
313 && puFrame[0] == 0xffffdead
314 && puFrame[1] == 0xffffdead
315 && puFrame[2] == 0xffffdead
316 && puFrame[3] == 0xffffdead)
317 {
318 RTPrintf("tstIntNetR0: receiver thread %.6Rhxs terminating. cbReceived=%u cLostFrames=%u iFrame=%u\n",
319 &pArgs->Mac, cbReceived, cLostFrames, iFrame);
320 pArgs->u64End = RTTimeNanoTS();
321 return VINF_SUCCESS;
322 }
323
324 /* validate frame header */
325 PPDMMAC pMacSrc = (PPDMMAC)&abBuf[0];
326 PPDMMAC pMacDst = pMacSrc + 1;
327 if ( pMacDst->au16[0] != 0x8086
328 || pMacDst->au16[1] != 0
329 || pMacDst->au16[2] != pArgs->Mac.au16[2]
330 || pMacSrc->au16[0] != 0x8086
331 || pMacSrc->au16[1] != 0
332 || pMacSrc->au16[2] == pArgs->Mac.au16[2])
333 {
334 RTPrintf("tstIntNetR0: receiver thread %.6Rhxs received frame header: %.16Rhxs\n",
335 &pArgs->Mac, abBuf);
336 g_cErrors++;
337 }
338
339 /* frame stuff and stats. */
340 int off = iFrame + 1 - *puFrame;
341 if (off)
342 {
343 if (off > 0)
344 {
345 RTPrintf("tstIntNetR0: receiver thread %.6Rhxs: iFrame=%d *puFrame=%d off=%d\n",
346 &pArgs->Mac, iFrame, *puFrame, off);
347 g_cErrors++;
348 cLostFrames++;
349 }
350 else
351 {
352 cLostFrames += -off;
353#ifndef IGNORE_LOST_FRAMES
354 if (off < 50)
355 {
356 RTPrintf("tstIntNetR0: receiver thread %.6Rhxs: iFrame=%d *puFrame=%d off=%d\n",
357 &pArgs->Mac, iFrame, *puFrame, off);
358 g_cErrors++;
359 }
360#endif
361 }
362 }
363 iFrame = *puFrame;
364 cbReceived += cb;
365 }
366 }
367}
368
369int main()
370{
371
372 /*
373 * Init runtime and create an INTNET instance.
374 */
375 RTR3Init();
376 RTPrintf("tstIntNetR0: TESTING...\n");
377 PINTNET pIntNet;
378 int rc = INTNETR0Create(&pIntNet);
379 if (VBOX_FAILURE(rc))
380 {
381 RTPrintf("tstIntNetR0: INTNETR0Create failed, rc=%Vrc\n");
382 return 1;
383 }
384
385 /*
386 * Create two interfaces.
387 */
388 INTNETIFHANDLE hIf0 = INTNET_HANDLE_INVALID;
389 rc = INTNETR0Open(pIntNet, g_pSession, "test", 1536, 0x8000, &hIf0);
390 if (VBOX_SUCCESS(rc))
391 {
392 if (hIf0 != INTNET_HANDLE_INVALID)
393 {
394 INTNETIFHANDLE hIf1 = INTNET_HANDLE_INVALID;
395 rc = INTNETR0Open(pIntNet, g_pSession, "test", 1536, 0x8000, &hIf1);
396 if (VBOX_SUCCESS(rc))
397 {
398 if (hIf1 != INTNET_HANDLE_INVALID)
399 {
400 PINTNETBUF pBuf0;
401 rc = INTNETR0IfGetRing0Buffer(pIntNet, hIf0, &pBuf0);
402 if (VBOX_FAILURE(rc) || !pBuf0)
403 {
404 RTPrintf("tstIntNetR0: INTNETIfGetRing0Buffer failed! pBuf0=%p rc=%Vrc\n", pBuf0, rc);
405 g_cErrors++;
406 }
407 PINTNETBUF pBuf1;
408 rc = INTNETR0IfGetRing0Buffer(pIntNet, hIf1, &pBuf1);
409 if (VBOX_FAILURE(rc))
410 {
411 RTPrintf("tstIntNetR0: INTNETIfGetRing0Buffer failed! pBuf1=%p rc=%Vrc\n", pBuf1, rc);
412 g_cErrors++;
413 }
414
415 /*
416 * Test basic waiting.
417 */
418 rc = INTNETR0IfWait(pIntNet, hIf0, 1);
419 if (rc != VERR_TIMEOUT)
420 {
421 RTPrintf("tstIntNetR0: INTNETIfWait returned %Vrc expected VERR_TIMEOUT (hIf0)\n", rc);
422 g_cErrors++;
423 }
424 rc = INTNETR0IfWait(pIntNet, hIf1, 0);
425 if (rc != VERR_TIMEOUT)
426 {
427 RTPrintf("tstIntNetR0: INTNETIfWait returned %Vrc expected VERR_TIMEOUT (hIf1)\n", rc);
428 g_cErrors++;
429 }
430
431 /*
432 * Send and receive.
433 */
434 rc = INTNETR0IfSend(pIntNet, hIf0, &g_TestFrame0, sizeof(g_TestFrame0));
435 if (VBOX_SUCCESS(rc))
436 {
437 rc = INTNETR0IfWait(pIntNet, hIf0, 1);
438 if (rc != VERR_TIMEOUT)
439 {
440 RTPrintf("tstIntNetR0: INTNETIfWait returned %Vrc expected VERR_TIMEOUT (hIf0, 2nd)\n", rc);
441 g_cErrors++;
442 }
443 rc = INTNETR0IfWait(pIntNet, hIf1, 0);
444 if (rc == VINF_SUCCESS)
445 {
446 /* receive it */
447 uint8_t abBuf[sizeof(g_TestFrame0)];
448 const unsigned cbExpect = RT_ALIGN(sizeof(g_TestFrame0) + sizeof(INTNETHDR), sizeof(INTNETHDR));
449 if (INTNETRingGetReadable(&pBuf1->Recv) != cbExpect)
450 {
451 RTPrintf("tstIntNetR0: %d readable bytes, expected %d!\n", INTNETRingGetReadable(&pBuf1->Recv), cbExpect);
452 g_cErrors++;
453 }
454 unsigned cb = INTNETRingReadFrame(pBuf1, &pBuf1->Recv, abBuf);
455 if (cb != sizeof(g_TestFrame0))
456 {
457 RTPrintf("tstIntNetR0: read %d frame bytes, expected %d!\n", cb, sizeof(g_TestFrame0));
458 g_cErrors++;
459 }
460 else if (memcmp(abBuf, &g_TestFrame0, sizeof(g_TestFrame0)))
461 {
462 RTPrintf("tstIntNetR0: Got invalid data!\n"
463 "received: %.*Rhxs\n"
464 "expected: %.*Rhxs\n",
465 cb, abBuf, sizeof(g_TestFrame0), &g_TestFrame0);
466 g_cErrors++;
467 }
468
469 /*
470 * Send a packet from If1 just to set its MAC address.
471 */
472 rc = INTNETR0IfSend(pIntNet, hIf1, &g_TestFrame1, sizeof(g_TestFrame1));
473 if (VBOX_FAILURE(rc))
474 {
475 RTPrintf("tstIntNetR0: INTNETIfSend returned %Vrc! (hIf1)\n", rc);
476 g_cErrors++;
477 }
478
479
480 /*
481 * Start threaded testcase.
482 */
483 if (!g_cErrors)
484 {
485 ARGS Args0 = {0};
486 Args0.hIf = hIf0;
487 Args0.pBuf = pBuf0;
488 Args0.pIntNet = pIntNet;
489 Args0.Mac.au16[0] = 0x8086;
490 Args0.Mac.au16[1] = 0;
491 Args0.Mac.au16[2] = 0;
492
493 ARGS Args1 = {0};
494 Args1.hIf = hIf1;
495 Args1.pBuf = pBuf1;
496 Args1.pIntNet = pIntNet;
497 Args1.Mac.au16[0] = 0x8086;
498 Args1.Mac.au16[1] = 0;
499 Args1.Mac.au16[2] = 1;
500
501 RTTHREAD ThreadRecv0 = NIL_RTTHREAD;
502 RTTHREAD ThreadRecv1 = NIL_RTTHREAD;
503 RTTHREAD ThreadSend0 = NIL_RTTHREAD;
504 RTTHREAD ThreadSend1 = NIL_RTTHREAD;
505 rc = RTThreadCreate(&ThreadRecv0, ReceiveThread, &Args0, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "RECV0");
506 if (VBOX_SUCCESS(rc))
507 rc = RTThreadCreate(&ThreadRecv1, ReceiveThread, &Args1, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "RECV1");
508 if (VBOX_SUCCESS(rc))
509 rc = RTThreadCreate(&ThreadSend0, SendThread, &Args0, 0, RTTHREADTYPE_EMULATION, RTTHREADFLAGS_WAITABLE, "SEND0");
510 if (VBOX_SUCCESS(rc))
511 rc = RTThreadCreate(&ThreadSend1, SendThread, &Args1, 0, RTTHREADTYPE_EMULATION, RTTHREADFLAGS_WAITABLE, "SEND1");
512 if (VBOX_SUCCESS(rc))
513 {
514 int rc2 = VINF_SUCCESS;
515 rc = RTThreadWait(ThreadSend0, 30000, &rc2);
516 if ( VBOX_SUCCESS(rc)
517 && VBOX_SUCCESS(rc2))
518 rc = RTThreadWait(ThreadSend1, 30000, &rc2);
519 if ( VBOX_SUCCESS(rc)
520 && VBOX_SUCCESS(rc2))
521 {
522 /*
523 * Wait a bit for the receivers to finish up.
524 */
525 unsigned cYields = 100000;
526 while ( ( INTNETRingGetReadable(&pBuf0->Recv)
527 || INTNETRingGetReadable(&pBuf1->Recv))
528 && cYields-- > 0)
529 RTThreadYield();
530
531 uint64_t u64Elapsed = RT_MAX(Args0.u64End, Args1.u64End) - RT_MIN(Args0.u64Start, Args1.u64Start);
532 uint64_t u64Speed = (uint64_t)((2 * TEST_TRANSFER_SIZE / 1024) / (u64Elapsed / 1000000000.0));
533 RTPrintf("tstIntNetR0: transfered %d bytes in %RU64 ns (%RU64 KB/s)\n",
534 2 * TEST_TRANSFER_SIZE, u64Elapsed, u64Speed);
535
536 /*
537 * Closing time...
538 */
539 rc = INTNETR0IfClose(pIntNet, hIf0);
540 if (VBOX_SUCCESS(rc))
541 {
542 hIf0 = INTNET_HANDLE_INVALID;
543 pBuf0 = NULL;
544 }
545 else
546 {
547 RTPrintf("tstIntNetR0: INTNETIfClose failed, rc=%Vrc! (hIf0)\n", rc);
548 g_cErrors++;
549 }
550 rc = INTNETR0IfClose(pIntNet, hIf1);
551 if (VBOX_SUCCESS(rc))
552 {
553 hIf1 = INTNET_HANDLE_INVALID;
554 pBuf1 = NULL;
555 }
556 else
557 {
558 RTPrintf("tstIntNetR0: INTNETIfClose failed, rc=%Vrc! (hIf1)\n", rc);
559 g_cErrors++;
560 }
561
562 rc = RTThreadWait(ThreadRecv0, 5000, &rc2);
563 if (VBOX_FAILURE(rc) || VBOX_FAILURE(rc2))
564 {
565 RTPrintf("tstIntNetR0: Failed waiting on receiver thread 0, rc=%Vrc, rc2=%Vrc\n", rc, rc2);
566 g_cErrors++;
567 }
568
569 rc = RTThreadWait(ThreadRecv1, 5000, &rc2);
570 if (VBOX_FAILURE(rc) || VBOX_FAILURE(rc2))
571 {
572 RTPrintf("tstIntNetR0: Failed waiting on receiver thread 1, rc=%Vrc, rc2=%Vrc\n", rc, rc2);
573 g_cErrors++;
574 }
575
576 /* check if the network still exist... */
577 if (pIntNet->pNetworks)
578 {
579 RTPrintf("tstIntNetR0: The network wasn't deleted! (g_cErrors=%d)\n", g_cErrors);
580 g_cErrors++;
581 }
582 }
583 else
584 {
585 RTPrintf("tstIntNetR0: Waiting on senders failed, rc=%Vrc, rc2=%Vrc\n", rc, rc2);
586 g_cErrors++;
587 }
588 }
589 else
590 {
591 RTPrintf("tstIntNetR0: Failed to create threads, rc=%Vrc\n", rc);
592 g_cErrors++;
593 }
594 }
595 }
596 else
597 {
598 RTPrintf("tstIntNetR0: INTNETIfWait returned %Vrc expected VINF_SUCCESS (hIf1)\n", rc);
599 g_cErrors++;
600 }
601 }
602 else
603 {
604 RTPrintf("tstIntNetR0: INTNETIfSend returned %Vrc! (hIf0)\n", rc);
605 g_cErrors++;
606 }
607 }
608 else
609 {
610 RTPrintf("tstIntNetR0: INTNETOpen returned invalid handle on success! (hIf1)\n");
611 g_cErrors++;
612 }
613 }
614 else
615 {
616 RTPrintf("tstIntNetR0: INTNETOpen failed for the 2nd interface! rc=%Vrc\n", rc);
617 g_cErrors++;
618 }
619 }
620 else
621 {
622 RTPrintf("tstIntNetR0: INTNETOpen returned invalid handle on success! (hIf0)\n");
623 g_cErrors++;
624 }
625 }
626 else
627 {
628 RTPrintf("tstIntNetR0: INTNETOpen failed for the 1st interface! rc=%Vrc\n", rc);
629 g_cErrors++;
630 }
631
632 /*
633 * Destroy the service.
634 */
635 INTNETR0Destroy(pIntNet);
636
637 /*
638 * Summary.
639 */
640 if (!g_cErrors)
641 RTPrintf("tstIntNetR0: SUCCESS\n");
642 else
643 RTPrintf("tstIntNetR0: FAILURE - %d errors\n", g_cErrors);
644
645 return !!g_cErrors;
646}
647
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette