Changeset 81417 in vbox
- Timestamp:
- Oct 21, 2019 3:22:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r81414 r81417 1048 1048 /** Transmit task. */ 1049 1049 PDMTASKHANDLE hTxTask; 1050 /** Rx wakeup signaller. */1051 PDMTASKHANDLE hCanRxTask;1052 1050 1053 1051 /** Critical section - what is it protecting? */ … … 1110 1108 bool volatile fMaybeOutOfSpace; 1111 1109 /** EMT: Gets signalled when more RX descriptors become available. */ 1112 RTSEMEVENThEventMoreRxDescAvail;1110 SUPSEMEVENT hEventMoreRxDescAvail; 1113 1111 #ifdef E1K_WITH_RXD_CACHE 1114 1112 /** RX: Fetched RX descriptors. */ … … 1209 1207 STAMPROFILE StatTransmitSendR3; 1210 1208 STAMPROFILE StatRxOverflow; 1211 STAMCOUNTER StatRxOverflowWakeup; 1209 STAMCOUNTER StatRxOverflowWakeupRZ; 1210 STAMCOUNTER StatRxOverflowWakeupR3; 1212 1211 STAMCOUNTER StatTxDescCtxNormal; 1213 1212 STAMCOUNTER StatTxDescCtxTSE; … … 1671 1670 #endif /* E1K_WITH_TX_CS */ 1672 1671 1672 1673 /** 1674 * Wakeup the RX thread. 1675 */ 1676 static void e1kWakeupReceive(PPDMDEVINS pDevIns, PE1KSTATE pThis) 1677 { 1678 if ( pThis->fMaybeOutOfSpace 1679 && pThis->hEventMoreRxDescAvail != NIL_SUPSEMEVENT) 1680 { 1681 STAM_COUNTER_INC(&pThis->CTX_SUFF_Z(StatRxOverflowWakeup)); 1682 E1kLog(("%s Waking up Out-of-RX-space semaphore\n", pThis->szPrf)); 1683 int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEventMoreRxDescAvail); 1684 AssertRC(rc); 1685 } 1686 } 1687 1673 1688 #ifdef IN_RING3 1674 1675 /**1676 * Wakeup the RX thread.1677 */1678 static void e1kWakeupReceive(PPDMDEVINS pDevIns)1679 {1680 PE1KSTATE pThis = PDMINS_2_DATA(pDevIns, PE1KSTATE);1681 if ( pThis->fMaybeOutOfSpace1682 && pThis->hEventMoreRxDescAvail != NIL_RTSEMEVENT)1683 {1684 STAM_COUNTER_INC(&pThis->StatRxOverflowWakeup);1685 E1kLog(("%s Waking up Out-of-RX-space semaphore\n", pThis->szPrf));1686 RTSemEventSignal(pThis->hEventMoreRxDescAvail);1687 }1688 }1689 1689 1690 1690 /** … … 3339 3339 if (RT_SUCCESS(rc)) 3340 3340 { 3341 /** @todo bird: Use SUPSem* for this so we can signal it in ring-0 as well3342 * without requiring any context switches. We should also check the3343 * wait condition before bothering to queue the item as we're currently3344 * queuing thousands of items per second here in a normal transmit3345 * scenario. Expect performance changes when fixing this! */3346 #ifdef IN_RING33347 3341 /* Signal that we have more receive descriptors available. */ 3348 e1kWakeupReceive(pDevIns); 3349 #else 3350 PDMDevHlpTaskTrigger(pDevIns, pThis->hCanRxTask); 3351 #endif 3342 e1kWakeupReceive(pDevIns, pThis); 3352 3343 } 3353 3344 } … … 5619 5610 { 5620 5611 RT_NOREF(pvUser); 5621 e1kWakeupReceive(pDevIns );5612 e1kWakeupReceive(pDevIns, PDMINS_2_DATA(pDevIns, PE1KSTATE)); 5622 5613 } 5623 5614 … … 6498 6489 E1kLogRel(("E1000: e1kR3NetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", cMillies)); 6499 6490 E1kLog(("%s: e1kR3NetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", pThis->szPrf, cMillies)); 6500 RTSemEventWait(pThis->hEventMoreRxDescAvail, cMillies);6491 PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pThis->hEventMoreRxDescAvail, cMillies); 6501 6492 } 6502 6493 STAM_PROFILE_STOP(&pThis->StatRxOverflow, a); … … 7548 7539 { 7549 7540 /* Poke thread waiting for buffer space. */ 7550 e1kWakeupReceive(pDevIns );7541 e1kWakeupReceive(pDevIns, PDMINS_2_DATA(pDevIns, PE1KSTATE)); 7551 7542 } 7552 7543 … … 7580 7571 { 7581 7572 /* Poke thread waiting for buffer space. */ 7582 e1kWakeupReceive(pDevIns );7573 e1kWakeupReceive(pDevIns, PDMINS_2_DATA(pDevIns, PE1KSTATE)); 7583 7574 } 7584 7575 … … 7625 7616 if (PDMCritSectIsInitialized(&pThis->cs)) 7626 7617 { 7627 if (pThis->hEventMoreRxDescAvail != NIL_RTSEMEVENT) 7628 { 7629 RTSemEventSignal(pThis->hEventMoreRxDescAvail); 7630 RTSemEventDestroy(pThis->hEventMoreRxDescAvail); 7631 pThis->hEventMoreRxDescAvail = NIL_RTSEMEVENT; 7618 if (pThis->hEventMoreRxDescAvail != NIL_SUPSEMEVENT) 7619 { 7620 PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEventMoreRxDescAvail); 7621 RTThreadYield(); 7622 PDMDevHlpSUPSemEventClose(pDevIns, pThis->hEventMoreRxDescAvail); 7623 pThis->hEventMoreRxDescAvail = NIL_SUPSEMEVENT; 7632 7624 } 7633 7625 #ifdef E1K_WITH_TX_CS … … 7730 7722 RTStrPrintf(pThis->szPrf, sizeof(pThis->szPrf), "E1000#%d", iInstance); 7731 7723 E1kLog(("%s Constructing new instance sizeof(E1KRXDESC)=%d\n", pThis->szPrf, sizeof(E1KRXDESC))); 7732 pThis->hEventMoreRxDescAvail = NIL_ RTSEMEVENT;7724 pThis->hEventMoreRxDescAvail = NIL_SUPSEMEVENT; 7733 7725 pThis->u16TxPktLen = 0; 7734 7726 pThis->fIPcsum = false; … … 7926 7918 AssertRCReturn(rc, rc); 7927 7919 7928 /* Create the RX notifier signaller. */7929 rc = PDMDevHlpTaskCreate(pDevIns, PDMTASK_F_RZ, "E1000-Rcv", e1kCanRxTaskCallback, NULL, &pThis->hCanRxTask);7930 AssertRCReturn(rc, rc);7931 7932 7920 #ifdef E1K_TX_DELAY 7933 7921 /* Create Transmit Delay Timer */ … … 8014 8002 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN")); 8015 8003 8016 rc = RTSemEventCreate(&pThis->hEventMoreRxDescAvail);8004 rc = PDMDevHlpSUPSemEventCreate(pDevIns, &pThis->hEventMoreRxDescAvail); 8017 8005 AssertRCReturn(rc, rc); 8018 8006 … … 8048 8036 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatReceiveStore, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive storing", "/Devices/E1k%d/Receive/Store", iInstance); 8049 8037 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatRxOverflow, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, "Profiling RX overflows", "/Devices/E1k%d/RxOverflow", iInstance); 8050 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatRxOverflowWakeup, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Nr of RX overflow wakeups", "/Devices/E1k%d/RxOverflowWakeup", iInstance); 8038 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatRxOverflowWakeupRZ, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Nr of RX overflow wakeups in RZ", "/Devices/E1k%d/RxOverflowWakeupRZ", iInstance); 8039 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatRxOverflowWakeupR3, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Nr of RX overflow wakeups in R3", "/Devices/E1k%d/RxOverflowWakeupR3", iInstance); 8051 8040 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitRZ, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling transmits in RZ", "/Devices/E1k%d/Transmit/TotalRZ", iInstance); 8052 8041 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitR3, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling transmits in R3", "/Devices/E1k%d/Transmit/TotalR3", iInstance);
Note:
See TracChangeset
for help on using the changeset viewer.