diff options
Diffstat (limited to 'src/VBox/Devices/Network/DrvIntNet.cpp')
| -rw-r--r-- | src/VBox/Devices/Network/DrvIntNet.cpp | 84 |
1 files changed, 48 insertions, 36 deletions
diff --git a/src/VBox/Devices/Network/DrvIntNet.cpp b/src/VBox/Devices/Network/DrvIntNet.cpp index ae3afe4ba..29d66c4db 100644 --- a/src/VBox/Devices/Network/DrvIntNet.cpp +++ b/src/VBox/Devices/Network/DrvIntNet.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvIntNet.cpp 29598 2010-05-18 08:32:49Z vboxsync $ */ +/* $Id: DrvIntNet.cpp 29669 2010-05-19 17:42:48Z vboxsync $ */ /** @file * DrvIntNet - Internal network transport driver. */ @@ -1102,34 +1102,31 @@ static DECLCALLBACK(void) drvR3IntNetDestruct(PPDMDRVINS pDrvIns) PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); /* - * Indicate to the thread that it's time to quit. + * Indicate to the receive thread that it's time to quit. */ ASMAtomicXchgSize(&pThis->enmRecvState, RECVSTATE_TERMINATE); ASMAtomicXchgSize(&pThis->fLinkDown, true); RTSEMEVENT hRecvEvt = pThis->hRecvEvt; pThis->hRecvEvt = NIL_RTSEMEVENT; - /* - * Close the interface - */ + if (hRecvEvt != NIL_RTSEMEVENT) + RTSemEventSignal(hRecvEvt); + if (pThis->hIf != INTNET_HANDLE_INVALID) { - INTNETIFCLOSEREQ CloseReq; - CloseReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; - CloseReq.Hdr.cbReq = sizeof(CloseReq); - CloseReq.pSession = NIL_RTR0PTR; - CloseReq.hIf = pThis->hIf; - pThis->hIf = INTNET_HANDLE_INVALID; - int rc = PDMDrvHlpSUPCallVMMR0Ex(pDrvIns, VMMR0_DO_INTNET_IF_CLOSE, &CloseReq, sizeof(CloseReq)); + INTNETIFABORTWAITREQ AbortWaitReq; + AbortWaitReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; + AbortWaitReq.Hdr.cbReq = sizeof(AbortWaitReq); + AbortWaitReq.pSession = NIL_RTR0PTR; + AbortWaitReq.hIf = pThis->hIf; + AbortWaitReq.fNoMoreWaits = true; + int rc = PDMDrvHlpSUPCallVMMR0Ex(pDrvIns, VMMR0_DO_INTNET_IF_ABORT_WAIT, &AbortWaitReq, sizeof(AbortWaitReq)); AssertRC(rc); } /* - * Wait for the thread to terminate. + * Wait for the threads to terminate. */ - if (hRecvEvt != NIL_RTSEMEVENT) - RTSemEventSignal(hRecvEvt); - if (pThis->pXmitThread) { int rc = PDMR3ThreadDestroy(pThis->pXmitThread, NULL); @@ -1144,30 +1141,11 @@ static DECLCALLBACK(void) drvR3IntNetDestruct(PPDMDRVINS pDrvIns) pThis->hRecvThread = NIL_RTTHREAD; } - /* - * Destroy the semaphores, S/G cache and xmit lock. + * Deregister statistics in case we're being detached. */ - if (hRecvEvt != NIL_RTSEMEVENT) - RTSemEventDestroy(hRecvEvt); - - if (pThis->hXmitEvt != NIL_SUPSEMEVENT) - { - SUPSemEventClose(pThis->pSupDrvSession, pThis->hXmitEvt); - pThis->hXmitEvt = NIL_SUPSEMEVENT; - } - - RTMemCacheDestroy(pThis->hSgCache); - pThis->hSgCache = NIL_RTMEMCACHE; - - if (PDMCritSectIsInitialized(&pThis->XmitLock)) - PDMR3CritSectDelete(&pThis->XmitLock); - if (pThis->pBufR3) { - /* - * Deregister statistics in case we're being detached. - */ PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->Recv.cStatFrames); PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->Recv.cbStatWritten); PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->Recv.cOverflows); @@ -1185,6 +1163,40 @@ static DECLCALLBACK(void) drvR3IntNetDestruct(PPDMDRVINS pDrvIns) PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatTransmit); #endif } + + /* + * Close the interface + */ + if (pThis->hIf != INTNET_HANDLE_INVALID) + { + INTNETIFCLOSEREQ CloseReq; + CloseReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; + CloseReq.Hdr.cbReq = sizeof(CloseReq); + CloseReq.pSession = NIL_RTR0PTR; + CloseReq.hIf = pThis->hIf; + pThis->hIf = INTNET_HANDLE_INVALID; + int rc = PDMDrvHlpSUPCallVMMR0Ex(pDrvIns, VMMR0_DO_INTNET_IF_CLOSE, &CloseReq, sizeof(CloseReq)); + AssertRC(rc); + } + + + /* + * Destroy the semaphores, S/G cache and xmit lock. + */ + if (hRecvEvt != NIL_RTSEMEVENT) + RTSemEventDestroy(hRecvEvt); + + if (pThis->hXmitEvt != NIL_SUPSEMEVENT) + { + SUPSemEventClose(pThis->pSupDrvSession, pThis->hXmitEvt); + pThis->hXmitEvt = NIL_SUPSEMEVENT; + } + + RTMemCacheDestroy(pThis->hSgCache); + pThis->hSgCache = NIL_RTMEMCACHE; + + if (PDMCritSectIsInitialized(&pThis->XmitLock)) + PDMR3CritSectDelete(&pThis->XmitLock); } |
