Changeset 7786 in vbox for trunk/src/VBox
- Timestamp:
- Apr 8, 2008 8:18:43 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvTAP.cpp
r7785 r7786 121 121 PPDMTHREAD pThread; 122 122 /** We are waiting for more receive buffers. */ 123 uint32_t volatile fOutOfSpace;123 bool volatile fMaybeOutOfSpace; 124 124 /** Event semaphore for blocking on receive. */ 125 125 RTSEMEVENT EventOutOfSpace; … … 249 249 250 250 LogFlow(("drvTAPNotifyCanReceive:\n")); 251 /** @todo r=bird: With a bit unfavorable scheduling it's possible to get here 252 * before fOutOfSpace is set by the overflow code. This will mean that, unless 253 * more receive descriptors become available, the receive thread will be stuck 254 * until it times out and cause a hickup in the network traffic. 255 * There is a simple, but not perfect, workaround for this problem in DrvTAPOs2.cpp. 256 * 257 * A better solution would be to ditch the NotifyCanReceive callback and instead 258 * change the CanReceive to do all the work. This will reduce the amount of code 259 * duplication, and would permit pcnet to avoid queuing unnecessary ring-3 tasks. 260 */ 261 262 /* ensure we wake up only once */ 263 if (ASMAtomicXchgU32(&pData->fOutOfSpace, false)) 251 /** @todo r=bird: A better solution would be to ditch the NotifyCanReceive callback 252 * and instead change the CanReceive to do all the work. This will 253 * reduce the amount of code duplication, and would permit pcnet to 254 * avoid queuing unnecessary ring-3 tasks. 255 */ 256 257 if (pData->fMaybeOutOfSpace) 264 258 RTSemEventSignal(pData->EventOutOfSpace); 265 259 #endif … … 348 342 * overflow error to allocate more receive buffers 349 343 */ 344 ASMAtomicXchgBool(&pData->fMaybeOutOfSpace, true); 350 345 size_t cbMax = pData->pPort->pfnCanReceive(pData->pPort); 351 346 if (cbMax == 0) … … 359 354 LogFlow(("drvTAPAsyncIoThread: cbMax=%d cbRead=%d waiting...\n", cbMax, cbRead)); 360 355 /* We get signalled by the network driver. 50ms is just for sanity */ 361 ASMAtomicXchgU32(&pData->fOutOfSpace, true);362 356 RTSemEventWait(pData->EventOutOfSpace, 50); 363 357 cbMax = pData->pPort->pfnCanReceive(pData->pPort); 364 358 } 365 ASMAtomicXchgU32(&pData->fOutOfSpace, false);366 359 STAM_PROFILE_STOP(&pData->StatRecvOverflows, b); 367 360 STAM_PROFILE_ADV_START(&pData->StatReceive, a); 368 if (pThread->enmState != PDMTHREADSTATE_RUNNING)369 break;370 361 } 362 ASMAtomicXchgBool(&pData->fMaybeOutOfSpace, false); 363 if (pThread->enmState != PDMTHREADSTATE_RUNNING) 364 break; 371 365 372 366 /* … … 445 439 /* Ensure that it does not spin in the CanReceive loop. 446 440 (May assert in IPRT if we're really unlucky.) */ 447 if ( ASMAtomicXchgU32(&pData->fOutOfSpace, false))441 if (pData->fMaybeOutOfSpace) 448 442 RTSemEventSignal(pData->EventOutOfSpace); 449 443
Note:
See TracChangeset
for help on using the changeset viewer.