Changeset 39498 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Dec 1, 2011 7:59:21 PM (13 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 3 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, -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r39471 r39498 622 622 QSOCKET_LOCK_CREATE(tcb); 623 623 QSOCKET_LOCK_CREATE(udb); 624 rc = RTReq CreateQueue(&pData->pReqQueue);624 rc = RTReqQueueCreate(&pData->pReqQueue); 625 625 AssertReleaseRC(rc); 626 626 #endif … … 1950 1950 void slirp_process_queue(PNATState pData) 1951 1951 { 1952 RTReq Process(pData->pReqQueue, RT_INDEFINITE_WAIT);1952 RTReqQueueProcess(pData->pReqQueue, RT_INDEFINITE_WAIT); 1953 1953 } 1954 1954 void *slirp_get_queue(PNATState pData) -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r39287 r39498 136 136 int soMaxConn; 137 137 #ifdef VBOX_WITH_SLIRP_MT 138 PRTREQQUEUE pReqQueue;138 RTREQQUEUE hReqQueue; 139 139 #endif 140 140 #ifdef RT_OS_WINDOWS … … 474 474 PRTREQ pReq; \ 475 475 int rc; \ 476 rc = RTReq CallVoid((data)->pReqQueue, &pReq, 0 /*cMillies*/,\477 (PFNRT)tcp_output 2, data, sotcb);\476 rc = RTReqQueueCallVoid((data)->hReqQueue, &pReq, 0 /*cMillies*/, \ 477 (PFNRT)tcp_output 2, data, sotcb); \ 478 478 if (RT_LIKELY(rc == VERR_TIMEOUT)) \ 479 479 { \ … … 491 491 do { \ 492 492 int rc; \ 493 rc = RTReq CallEx((data)->pReqQueue, NULL, 0 /*cMillies*/,\494 RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT,\495 (PFNRT)tcp_input, 4, data, mbuf, size, so);\493 rc = RTReqQueueCallEx((data)->hReqQueue, NULL, 0 /*cMillies*/, \ 494 RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT, \ 495 (PFNRT)tcp_input, 4, data, mbuf, size, so); \ 496 496 AssertReleaseRC(rc); \ 497 497 } while(0) … … 501 501 PRTREQ pReq; \ 502 502 int rc; \ 503 rc = RTReq CallVoid((data)->pReqQueue, &pReq, 0 /*cMillies*/,\504 (PFNRT)tcp_connect, 2, data, so);\503 rc = RTReqQueueCallVoid((data)->hReqQueue, &pReq, 0 /*cMillies*/, \ 504 (PFNRT)tcp_connect, 2, data, so); \ 505 505 if (RT_LIKELY(rc == VERR_TIMEOUT)) \ 506 506 { \ … … 519 519 PRTREQ pReq; \ 520 520 int rc; \ 521 rc = RTReq CallVoid((data)->pReqQueue, &pReq, 0 /*cMillies*/,\522 (PFNRT)soread_queue, 4,\523 data, so, ifclose, &(ret));\521 rc = RTReqQueueCallVoid((data)->hReqQueue, &pReq, 0 /*cMillies*/, \ 522 (PFNRT)soread_queue, 4, \ 523 data, so, ifclose, &(ret)); \ 524 524 if (RT_LIKELY(rc == VERR_TIMEOUT)) \ 525 525 { \ … … 538 538 PRTREQ pReq; \ 539 539 int rc; \ 540 rc = RTReq Call((data)->pReqQueue, &pReq, 0 /*cMillies*/,\541 (PFNRT)sowrite, 2, data, so);\540 rc = RTReqQueueCall((data)->hReqQueue, &pReq, 0 /*cMillies*/, \ 541 (PFNRT)sowrite, 2, data, so); \ 542 542 if (RT_LIKELY(rc == VERR_TIMEOUT)) \ 543 543 { \ … … 556 556 PRTREQ pReq; \ 557 557 int rc; \ 558 rc = RTReq CallVoid((data)->pReqQueue, &pReq, 0 /*cMillies */,\559 (PFNRT)sorecvfrom, 2, data, so);\558 rc = RTReqQueueCallVoid((data)->hReqQueue, &pReq, 0 /*cMillies */, \ 559 (PFNRT)sorecvfrom, 2, data, so); \ 560 560 if (RT_LIKELY(rc == VERR_TIMEOUT)) \ 561 561 { \ … … 574 574 PRTREQ pReq; \ 575 575 int rc; \ 576 rc = RTReq CallVoid((data)->pReqQueue, &pReq, 0 /* cMillies*/,\577 (PFNRT)udp_detach, 2, data, so);\576 rc = RTReqQueueCallVoid((data)->hReqQueue, &pReq, 0 /* cMillies*/, \ 577 (PFNRT)udp_detach, 2, data, so); \ 578 578 if (RT_LIKELY(rc == VERR_TIMEOUT)) \ 579 579 { \
Note:
See TracChangeset
for help on using the changeset viewer.