Changeset 39498 in vbox for trunk/src/VBox/Devices/Network/DrvNAT.cpp
- Timestamp:
- Dec 1, 2011 7:59:21 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r39465 r39498 154 154 PPDMTHREAD pSlirpThread; 155 155 /** Queue for NAT-thread-external events. */ 156 PRTREQQUEUE pSlirpReqQueue;156 RTREQQUEUE hSlirpReqQueue; 157 157 /** The guest IP for port-forwarding. */ 158 158 uint32_t GuestIP; … … 185 185 RTSEMEVENT EventUrgRecv; 186 186 /** Receive Req queue (deliver packets to the guest) */ 187 PRTREQQUEUE pRecvReqQueue;187 RTREQQUEUE hRecvReqQueue; 188 188 /** Receive Urgent Req queue (deliver packets to the guest). */ 189 PRTREQQUEUE pUrgRecvReqQueue;189 RTREQQUEUE hUrgRecvReqQueue; 190 190 191 191 /** makes access to device func RecvAvail and Recv atomical. */ … … 219 219 while (pThread->enmState == PDMTHREADSTATE_RUNNING) 220 220 { 221 RTReq Process(pThis->pRecvReqQueue, 0);221 RTReqQueueProcess(pThis->hRecvReqQueue, 0); 222 222 if (ASMAtomicReadU32(&pThis->cPkts) == 0) 223 223 RTSemEventWait(pThis->EventRecv, RT_INDEFINITE_WAIT); … … 246 246 while (pThread->enmState == PDMTHREADSTATE_RUNNING) 247 247 { 248 RTReq Process(pThis->pUrgRecvReqQueue, 0);248 RTReqQueueProcess(pThis->hUrgRecvReqQueue, 0); 249 249 if (ASMAtomicReadU32(&pThis->cUrgPkts) == 0) 250 250 { … … 535 535 536 536 #ifdef VBOX_WITH_SLIRP_MT 537 PRTREQQUEUE pQueue = (PRTREQQUEUE)slirp_get_queue(pThis->pNATState);537 RTREQQUEUE hQueue = (RTREQQUEUE)slirp_get_queue(pThis->pNATState); 538 538 #else 539 PRTREQQUEUE pQueue = pThis->pSlirpReqQueue;539 RTREQQUEUE hQueue = pThis->hSlirpReqQueue; 540 540 #endif 541 rc = RTReq CallEx(pQueue, NULL /*ppReq*/, 0 /*cMillies*/, RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT,542 (PFNRT)drvNATSendWorker, 2, pThis, pSgBuf);541 rc = RTReqQueueCallEx(hQueue, NULL /*ppReq*/, 0 /*cMillies*/, RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT, 542 (PFNRT)drvNATSendWorker, 2, pThis, pSgBuf); 543 543 if (RT_SUCCESS(rc)) 544 544 { … … 637 637 638 638 PRTREQ pReq; 639 int rc = RTReq CallEx(pThis->pSlirpReqQueue, &pReq, 0 /*cMillies*/, RTREQFLAGS_VOID,640 (PFNRT)drvNATNotifyLinkChangedWorker, 2, pThis, enmLinkState);639 int rc = RTReqQueueCallEx(pThis->hSlirpReqQueue, &pReq, 0 /*cMillies*/, RTREQFLAGS_VOID, 640 (PFNRT)drvNATNotifyLinkChangedWorker, 2, pThis, enmLinkState); 641 641 if (RT_LIKELY(rc == VERR_TIMEOUT)) 642 642 { … … 684 684 PDRVNAT pThis = RT_FROM_MEMBER(pInterface, DRVNAT, INetworkNATCfg); 685 685 PRTREQ pReq; 686 int rc = RTReq CallEx(pThis->pSlirpReqQueue, &pReq, 0 /*cMillies*/, RTREQFLAGS_VOID,687 (PFNRT)drvNATNotifyApplyPortForwardCommand, 7, pThis, fRemove,688 fUdp, pHostIp, u16HostPort, pGuestIp, u16GuestPort);686 int rc = RTReqQueueCallEx(pThis->hSlirpReqQueue, &pReq, 0 /*cMillies*/, RTREQFLAGS_VOID, 687 (PFNRT)drvNATNotifyApplyPortForwardCommand, 7, pThis, fRemove, 688 fUdp, pHostIp, u16HostPort, pGuestIp, u16GuestPort); 689 689 if (RT_LIKELY(rc == VERR_TIMEOUT)) 690 690 { … … 707 707 * dedicated thread. We take care that this thread does not become the 708 708 * bottleneck: If the guest wants to send, a request is enqueued into the 709 * pSlirpReqQueue and handled asynchronously by this thread. If this thread709 * hSlirpReqQueue and handled asynchronously by this thread. If this thread 710 710 * wants to deliver packets to the guest, it enqueues a request into 711 * pRecvReqQueue which is later handled by the Recv thread.711 * hRecvReqQueue which is later handled by the Recv thread. 712 712 */ 713 713 static DECLCALLBACK(int) drvNATAsyncIoThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread) … … 792 792 } 793 793 /* process _all_ outstanding requests but don't wait */ 794 RTReq Process(pThis->pSlirpReqQueue, 0);794 RTReqQueueProcess(pThis->hSlirpReqQueue, 0); 795 795 RTMemFree(polls); 796 796 … … 819 819 slirp_select_poll(pThis->pNATState, /* fTimeout=*/false, /* fIcmp=*/(dwEvent == WSA_WAIT_EVENT_0)); 820 820 /* process _all_ outstanding requests but don't wait */ 821 RTReq Process(pThis->pSlirpReqQueue, 0);821 RTReqQueueProcess(pThis->hSlirpReqQueue, 0); 822 822 # ifdef VBOX_NAT_DELAY_HACK 823 823 if (cBreak++ > 128) … … 903 903 904 904 ASMAtomicIncU32(&pThis->cUrgPkts); 905 int rc = RTReq CallEx(pThis->pUrgRecvReqQueue, NULL /*ppReq*/, 0 /*cMillies*/, RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT,906 (PFNRT)drvNATUrgRecvWorker, 4, pThis, pu8Buf, cb, m);905 int rc = RTReqQueueCallEx(pThis->hUrgRecvReqQueue, NULL /*ppReq*/, 0 /*cMillies*/, RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT, 906 (PFNRT)drvNATUrgRecvWorker, 4, pThis, pu8Buf, cb, m); 907 907 AssertRC(rc); 908 908 drvNATUrgRecvWakeup(pThis->pDrvIns, pThis->pUrgRecvThread); … … 937 937 938 938 ASMAtomicIncU32(&pThis->cPkts); 939 int rc = RTReq CallEx(pThis->pRecvReqQueue, NULL /*ppReq*/, 0 /*cMillies*/, RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT,940 (PFNRT)drvNATRecvWorker, 4, pThis, pu8Buf, cb, m);939 int rc = RTReqQueueCallEx(pThis->hRecvReqQueue, NULL /*ppReq*/, 0 /*cMillies*/, RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT, 940 (PFNRT)drvNATRecvWorker, 4, pThis, pu8Buf, cb, m); 941 941 AssertRC(rc); 942 942 drvNATRecvWakeup(pThis->pDrvIns, pThis->pRecvThread); … … 1119 1119 } 1120 1120 1121 RTReq DestroyQueue(pThis->pSlirpReqQueue);1122 pThis-> pSlirpReqQueue = NULL;1123 1124 RTReq DestroyQueue(pThis->pUrgRecvReqQueue);1125 pThis-> pUrgRecvReqQueue = NULL;1121 RTReqQueueDestroy(pThis->hSlirpReqQueue); 1122 pThis->hSlirpReqQueue = NIL_RTREQQUEUE; 1123 1124 RTReqQueueDestroy(pThis->hUrgRecvReqQueue); 1125 pThis->hUrgRecvReqQueue = NIL_RTREQQUEUE; 1126 1126 1127 1127 RTSemEventDestroy(pThis->EventRecv); … … 1172 1172 pThis->pszBootFile = NULL; 1173 1173 pThis->pszNextServer = NULL; 1174 pThis-> pSlirpReqQueue = NULL;1175 pThis-> pUrgRecvReqQueue = NULL;1174 pThis->hSlirpReqQueue = NIL_RTREQQUEUE; 1175 pThis->hUrgRecvReqQueue = NIL_RTREQQUEUE; 1176 1176 pThis->EventRecv = NIL_RTSEMEVENT; 1177 1177 pThis->EventUrgRecv = NIL_RTSEMEVENT; … … 1301 1301 */ 1302 1302 rc = PDMDrvHlpSSMRegisterLoadDone(pDrvIns, drvNATLoadDone); 1303 AssertRCReturn(rc, rc); 1304 1305 rc = RTReqCreateQueue(&pThis->pSlirpReqQueue); 1306 if (RT_FAILURE(rc)) 1307 { 1308 LogRel(("NAT: Can't create request queue\n")); 1309 return rc; 1310 } 1311 1312 rc = RTReqCreateQueue(&pThis->pRecvReqQueue); 1313 if (RT_FAILURE(rc)) 1314 { 1315 LogRel(("NAT: Can't create request queue\n")); 1316 return rc; 1317 } 1318 1319 rc = RTReqCreateQueue(&pThis->pUrgRecvReqQueue); 1320 if (RT_FAILURE(rc)) 1321 { 1322 LogRel(("NAT: Can't create request queue\n")); 1323 return rc; 1324 } 1303 AssertLogRelRCReturn(rc, rc); 1304 1305 rc = RTReqQueueCreate(&pThis->hSlirpReqQueue); 1306 AssertLogRelRCReturn(rc, rc); 1307 1308 rc = RTReqQueueCreate(&pThis->hRecvReqQueue); 1309 AssertLogRelRCReturn(rc, rc); 1310 1311 rc = RTReqQueueCreate(&pThis->hUrgRecvReqQueue); 1312 AssertLogRelRCReturn(rc, rc); 1325 1313 1326 1314 rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pRecvThread, pThis, drvNATRecv,
Note:
See TracChangeset
for help on using the changeset viewer.