Changeset 10740 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jul 18, 2008 10:00:56 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r10739 r10740 604 604 * Sends a frame to a specific interface. 605 605 * 606 * @param pIf The interface. 607 * @param pSG The gather buffer which data is being sent to the interface. 608 */ 609 static void intnetR0IfSend(PINTNETIF pIf, PINTNETSG pSG) 606 * @param pIf The interface. 607 * @param pIfSender The interface sending the frame. This is NULL if it's the trunk. 608 * @param pSG The gather buffer which data is being sent to the interface. 609 */ 610 static void intnetR0IfSend(PINTNETIF pIf, PINTNETIF pIfSender, PINTNETSG pSG) 610 611 { 611 612 LogFlow(("intnetR0IfSend: pIf=%p:{.hIf=%RX32}\n", pIf, pIf->hIf)); … … 620 621 } 621 622 622 /** @todo we'll have to drop this I'm afraid since it'll screw up the host networking otherwise... */ 623 #if 0 /* This is bad stuff now as we're blocking while locking down the network. 624 we really shouldn't delay the network traffic on the host just because 625 some bugger isn't responding. Will have to deal with this in a different 626 manner if required. */ 623 627 /* 624 628 * Retry a few times, yielding the CPU in between. 625 * But don't let a unresponsive VM harm performance, so give up after a short while.629 * But don't let a unresponsive VM harm performance, so give up after a couple of tries. 626 630 */ 627 631 if (pIf->cYields < 100) 628 632 { 629 633 unsigned cYields = 10; 630 do 634 #else 635 /* 636 * Scheduling hack, for unicore machines primarily. 637 */ 638 if ( pIf->cYields < 4 /* just twice */ 639 && pIfSender /* but not if it's from the trunk */) 640 { 641 unsigned cYields = 2; 642 #endif 643 while (--cYields > 0) 631 644 { 632 645 RTSemEventSignal(pIf->Event); … … 642 655 } 643 656 pIf->cYields++; 644 } while (--cYields > 0);657 } 645 658 STAM_REL_COUNTER_INC(&pIf->pIntBuf->cStatYieldsNok); 646 659 } … … 751 764 for (PINTNETIF pIf = pNetwork->pIFs; pIf; pIf = pIf->pNext) 752 765 if (pIf != pIfSender) 753 intnetR0IfSend(pIf, p SG);766 intnetR0IfSend(pIf, pIfSender, pSG); 754 767 755 768 /* … … 816 829 { 817 830 fExactIntNetRecipient |= fIt; 818 intnetR0IfSend(pIf, p SG);831 intnetR0IfSend(pIf, pIfSender, pSG); 819 832 } 820 833 } -
trunk/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp
r10733 r10740 43 43 #include <iprt/time.h> 44 44 #include <iprt/asm.h> 45 #include <iprt/getopt.h> 45 46 46 47 … … 381 382 } 382 383 383 int main() 384 { 385 384 int main(int argc, char **argv) 385 { 386 386 /* 387 * Init runtime and create an INTNET instance.387 * Init the runtime and parse arguments. 388 388 */ 389 389 RTR3Init(); 390 RTPrintf("tstIntNetR0: TESTING...\n"); 390 391 static RTOPTIONDEF const s_aOptions[] = 392 { 393 { "--recv-buffer", 'r', RTGETOPT_REQ_UINT32 }, 394 { "--send-buffer", 's', RTGETOPT_REQ_UINT32 }, 395 }; 396 397 uint32_t cbRecv = 32 * _1K; 398 uint32_t cbSend = 1536*2; 399 400 int ch; 401 int iArg = 1; 402 RTOPTIONUNION Value; 403 while ((ch = RTGetOpt(argc,argv, &s_aOptions[0], RT_ELEMENTS(s_aOptions), &iArg, &Value))) 404 switch (ch) 405 { 406 case 'r': 407 cbRecv = Value.u32; 408 break; 409 410 case 's': 411 cbSend = Value.u32; 412 break; 413 414 default: 415 RTPrintf("tstIntNetR0: invalid argument: %s\n", Value.psz); 416 return 1; 417 } 418 if (iArg < argc) 419 { 420 RTPrintf("tstIntNetR0: invalid argument: %s\n", argv[iArg]); 421 return 1; 422 } 423 424 /* 425 * Create an INTNET instance. 426 */ 427 RTPrintf("tstIntNetR0: TESTING cbSend=%d cbRecv=%d ...\n", cbSend, cbRecv); 391 428 PINTNET pIntNet; 392 429 int rc = INTNETR0Create(&pIntNet);
Note:
See TracChangeset
for help on using the changeset viewer.