Changeset 575 in vbox for trunk/src/VBox
- Timestamp:
- Feb 2, 2007 6:29:46 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18195
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r573 r575 69 69 #ifdef IN_RING3 70 70 #include <iprt/mem.h> 71 #include <iprt/semaphore.h> 71 72 #endif 72 73 … … 85 86 /* Enable to delay setting the TX interrupt until packets have been sent. */ 86 87 /** @note currently not technically correct (own bit) */ 87 /* #define PCNET_DELAY_INT */ 88 #define PCNET_DELAY_INT 89 90 /* Enable to send packets in a seperate thread. */ 91 /* #define PCNET_ASYNC_SEND */ 88 92 89 93 #ifdef __GNUC__ … … 227 231 /** Partner of ILeds. */ 228 232 HCPTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 233 234 #ifdef PCNET_ASYNC_SEND 235 /** Async send thread */ 236 RTSEMEVENT hEventSemSend; 237 RTTHREAD hSendThread; 238 #endif 229 239 230 240 /** Access critical section. */ … … 289 299 STAMCOUNTER StatRingWriteOutsideRangeR0; 290 300 STAMCOUNTER StatRingWriteOutsideRangeGC; 301 # endif 302 # ifdef PCNET_ASYNC_SEND 303 STAMCOUNTER StatSyncSend; 304 STAMCOUNTER StatAsyncSend; 291 305 # endif 292 306 #endif /* VBOX_WITH_STATISTICS */ … … 1790 1804 int rc; 1791 1805 1806 #ifdef PCNET_ASYNC_SEND 1807 /* If the calling threads isn't the async send thread and our queue isn't yet full, then kick off async sending. */ 1808 if ( pData->iFrame != ELEMENTS(pData->aFrames) 1809 && RTThreadSelf() != pData->hSendThread) 1810 { 1811 STAM_COUNTER_INC(&pData->StatAsyncSend); 1812 rc = RTSemEventSignal(pData->hEventSemSend); 1813 AssertRC(rc); 1814 return VINF_SUCCESS; 1815 } 1816 if (RTThreadSelf() != pData->hSendThread) 1817 STAM_COUNTER_INC(&pData->StatSyncSend); 1818 #endif /* PCNET_ASYNC_SEND */ 1819 1792 1820 STAM_PROFILE_START(&pData->StatXmitQueue, a); 1793 1821 STAM_COUNTER_INC(&pData->aStatFlushCounts[pData->iFrame]); … … 1890 1918 return true; 1891 1919 } 1920 1921 #ifdef PCNET_ASYNC_SEND 1922 /** 1923 * Async I/O thread for delayed sending of packets. 1924 */ 1925 static DECLCALLBACK(int) pcnetAsyncSend(RTTHREAD ThreadSelf, void *pvUser) 1926 { 1927 PCNetState *pData = (PCNetState *)pvUser; 1928 RTSEMEVENT hEventSemSend = pData->hEventSemSend; 1929 1930 while(1) 1931 { 1932 int rc = RTSemEventWait(pData->hEventSemSend, RT_INDEFINITE_WAIT); 1933 if (VBOX_FAILURE(rc)) 1934 break; 1935 1936 pcnetXmitQueueConsumer(PCNETSTATE_2_DEVINS(pData), NULL); 1937 } 1938 return VINF_SUCCESS; 1939 } 1940 #endif /* PCNET_ASYNC_SEND */ 1941 1892 1942 #endif /* IN_RING3 */ 1893 1943 … … 1910 1960 #endif 1911 1961 } 1962 #ifndef PCNET_ASYNC_SEND 1912 1963 pData->aFrames[0].off = 0; 1913 1964 pData->aFrames[0].cb = -1; 1914 1965 pData->aFrames[0].pvR3 = NIL_RTR3PTR; 1915 1966 pData->iFrame = 0; 1967 #endif 1916 1968 } 1917 1969 … … 4208 4260 pcnetHardReset(pData); 4209 4261 4262 #ifdef PCNET_ASYNC_SEND 4263 /* Create event semaphore for the async send thread. */ 4264 rc = RTSemEventCreate(&pData->hEventSemSend); 4265 AssertRC(rc); 4266 4267 /* Create asynchronous thread */ 4268 rc = RTThreadCreate(&pData->hSendThread, pcnetAsyncSend, (void *)pData, 128*1024, RTTHREADTYPE_IO, 0, "PCNET_SEND"); 4269 AssertRC(rc); 4270 4271 Assert(pData->hSendThread != NIL_RTTHREAD && pData->hEventSemSend != NIL_RTSEMEVENT); 4272 4273 PDMDevHlpSTAMRegisterF(pDevIns, &pData->StatAsyncSend, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Nr of async send operations", "/Devices/PCNet%d/Send/Async", iInstance); 4274 PDMDevHlpSTAMRegisterF(pDevIns, &pData->StatSyncSend, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Nr of sync send operations", "/Devices/PCNet%d/Send/Sync", iInstance); 4275 #endif 4276 4210 4277 #ifdef VBOX_WITH_STATISTICS 4211 4278 PDMDevHlpSTAMRegisterF(pDevIns, &pData->StatMMIOReadGC, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling MMIO reads in GC", "/Devices/PCNet%d/MMIO/ReadGC", iInstance); -
trunk/src/VBox/Devices/Network/DrvTAPWin32.cpp
r562 r575 613 613 614 614 #ifdef ASYNC_NETIO 615 pData->hHaltAsyncEventSem = CreateEvent(NULL, FALSE, FALSE, NULL); 616 615 617 /* Create asynchronous thread */ 616 618 rc = RTThreadCreate(&pData->hThread, drvTAPW32AsyncIo, (void *)pData, 128*1024, RTTHREADTYPE_IO, 0, "TAPWIN32"); 617 619 AssertRC(rc); 618 619 pData->hHaltAsyncEventSem = CreateEvent(NULL, FALSE, FALSE, NULL);620 620 621 621 Assert(pData->hThread != NIL_RTTHREAD && pData->hHaltAsyncEventSem != NULL);
Note:
See TracChangeset
for help on using the changeset viewer.