- Timestamp:
- Nov 23, 2019 11:18:35 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r82134 r82135 316 316 /** Transmit signaller - R3. */ 317 317 R3PTRTYPE(PPDMQUEUE) pXmitQueueR3; 318 /** Receive signaller - R3. */319 R3PTRTYPE(PPDMQUEUE) pCanRxQueueR3;320 318 /** Pointer to the connector of the attached network driver - R3. */ 321 319 PPDMINETWORKUPR3 pDrvR3; … … 331 329 /** Pointer to the device instance - R0. */ 332 330 PPDMDEVINSR0 pDevInsR0; 333 /** Receive signaller - R0. */334 R0PTRTYPE(PPDMQUEUE) pCanRxQueueR0;335 331 /** Transmit signaller - R0. */ 336 332 R0PTRTYPE(PPDMQUEUE) pXmitQueueR0; … … 340 336 /** Pointer to the device instance - RC. */ 341 337 PPDMDEVINSRC pDevInsRC; 342 /** Receive signaller - RC. */343 RCPTRTYPE(PPDMQUEUE) pCanRxQueueRC;344 338 /** Transmit signaller - RC. */ 345 339 RCPTRTYPE(PPDMQUEUE) pXmitQueueRC; 346 340 /** Pointer to the connector of the attached network driver - RC. */ 347 341 PPDMINETWORKUPRC pDrvRC; 342 RTRCPTR RCPtrAlignment; 348 343 349 344 /** Software Interrupt timer - R3. */ … … 421 416 PDMCRITSECT CritSect; 422 417 /** Event semaphore for blocking on receive. */ 423 RTSEMEVENThEventOutOfRxSpace;418 SUPSEMEVENT hEventOutOfRxSpace; 424 419 /** We are waiting/about to start waiting for more receive buffers. */ 425 420 bool volatile fMaybeOutOfSpace; … … 1633 1628 } 1634 1629 1635 #ifdef IN_RING3 1636 1637 static DECLCALLBACK(void) pcnetWakeupReceive(PPDMDEVINS pDevIns) 1630 /** 1631 * Wakes up a receive thread stuck waiting for buffers. 1632 */ 1633 static void pcnetWakeupReceive(PPDMDEVINS pDevIns) 1638 1634 { 1639 1635 PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE); 1640 1636 STAM_COUNTER_INC(&pThis->StatRxOverflowWakeup); 1641 if (pThis->hEventOutOfRxSpace != NIL_RTSEMEVENT) 1642 RTSemEventSignal(pThis->hEventOutOfRxSpace); 1643 } 1637 if (pThis->hEventOutOfRxSpace != NIL_SUPSEMEVENT) 1638 { 1639 int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEventOutOfRxSpace); 1640 AssertRC(rc); 1641 } 1642 } 1643 1644 #ifdef IN_RING3 1644 1645 1645 1646 static DECLCALLBACK(bool) pcnetCanRxQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem) … … 1695 1696 CSR_CRST(pThis) = ((uint32_t *)&rmd)[1] >> 16; /* Receive Status */ 1696 1697 if (pThis->fMaybeOutOfSpace) 1697 {1698 #ifdef IN_RING31699 1698 pcnetWakeupReceive(PCNETSTATE_2_DEVINS(pThis)); 1700 #else1701 PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pCanRxQueue));1702 if (pItem)1703 PDMQueueInsert(pThis->CTX_SUFF(pCanRxQueue), pItem);1704 #endif1705 }1706 1699 } 1707 1700 else … … 4745 4738 #endif 4746 4739 PDMCritSectLeave(&pThis->CritSect); 4747 RTSemEventWait(pThis->hEventOutOfRxSpace, cMillies);4740 PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pThis->hEventOutOfRxSpace, cMillies); 4748 4741 } 4749 4742 STAM_PROFILE_STOP(&pThis->StatRxOverflow, a); … … 5062 5055 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 5063 5056 pThis->pXmitQueueRC = PDMQueueRCPtr(pThis->pXmitQueueR3); 5064 pThis->pCanRxQueueRC = PDMQueueRCPtr(pThis->pCanRxQueueR3);5065 5057 #ifdef PCNET_NO_POLLING 5066 5058 pThis->pfnEMInterpretInstructionRC += offDelta; … … 5077 5069 PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE); 5078 5070 5071 if (pThis->hEventOutOfRxSpace == NIL_SUPSEMEVENT) 5072 { 5073 PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEventOutOfRxSpace); 5074 PDMDevHlpSUPSemEventClose(pDevIns, pThis->hEventOutOfRxSpace); 5075 pThis->hEventOutOfRxSpace = NIL_SUPSEMEVENT; 5076 } 5077 5079 5078 if (PDMCritSectIsInitialized(&pThis->CritSect)) 5080 {5081 RTSemEventSignal(pThis->hEventOutOfRxSpace);5082 RTSemEventDestroy(pThis->hEventOutOfRxSpace);5083 pThis->hEventOutOfRxSpace = NIL_RTSEMEVENT;5084 5079 PDMR3CritSectDelete(&pThis->CritSect); 5085 }5086 5080 return VINF_SUCCESS; 5087 5081 } … … 5107 5101 * Init what's required to make the destructor safe. 5108 5102 */ 5109 pThis->hEventOutOfRxSpace = NIL_ RTSEMEVENT;5103 pThis->hEventOutOfRxSpace = NIL_SUPSEMEVENT; 5110 5104 5111 5105 /* … … 5251 5245 AssertRCReturn(rc, rc); 5252 5246 rc = PDMDevHlpSetDeviceCritSect(pDevIns, &pThis->CritSect); 5253 AssertRCReturn(rc, rc);5254 5255 rc = RTSemEventCreate(&pThis->hEventOutOfRxSpace);5256 5247 AssertRCReturn(rc, rc); 5257 5248 … … 5362 5353 5363 5354 /* 5364 * Create the RX notifier s ignaller.5355 * Create the RX notifier semaphore. 5365 5356 */ 5366 rc = PDMDevHlpQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 1, 0, 5367 pcnetCanRxQueueConsumer, true, "PCnet-Rcv", &pThis->pCanRxQueueR3); 5357 rc = PDMDevHlpSUPSemEventCreate(pDevIns, &pThis->hEventOutOfRxSpace); 5368 5358 AssertRCReturn(rc, rc); 5369 pThis->pCanRxQueueR0 = PDMQueueR0Ptr(pThis->pCanRxQueueR3);5370 pThis->pCanRxQueueRC = PDMQueueRCPtr(pThis->pCanRxQueueR3);5371 5359 5372 5360 /*
Note:
See TracChangeset
for help on using the changeset viewer.

