Changeset 28121 in vbox for trunk/src/VBox/Devices/Network/DevE1000.cpp
- Timestamp:
- Apr 9, 2010 7:58:35 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r28102 r28121 47 47 //#define E1K_INT_STATS 48 48 //#define E1K_REL_STATS 49 //#define E1K_USE_SUPLIB_SEMEVENT 49 50 50 51 #include <iprt/crc32.h> … … 956 957 #endif 957 958 /** Transmit thread blocker. */ 959 #ifdef E1K_USE_SUPLIB_SEMEVENT 960 SUPSEMEVENT hTxSem; 961 #else 958 962 RTSEMEVENT hTxSem; 963 #endif 959 964 /** Base address of memory-mapped registers. */ 960 965 RTGCPHYS addrMMReg; … … 2854 2859 2855 2860 /* IPv4 checksum offset. */ 2856 if (RT_UNLIKELY( pCtx->dw2.fIP && pCtx->ip.u8CSO - pCtx->ip.u8CSS != RT_ OFFSETOF(RTNETIPV4, ip_sum) ))2861 if (RT_UNLIKELY( pCtx->dw2.fIP && pCtx->ip.u8CSO - pCtx->ip.u8CSS != RT_UOFFSETOF(RTNETIPV4, ip_sum) )) 2857 2862 { 2858 2863 E1kLog(("e1kSetupGsoCtx: IPCSO=%#x IPCSS=%#x\n", pCtx->ip.u8CSO, pCtx->ip.u8CSS)); … … 2862 2867 /* TCP/UDP checksum offsets. */ 2863 2868 if (RT_UNLIKELY( pCtx->tu.u8CSO - pCtx->tu.u8CSS != ( pCtx->dw2.fTCP 2864 ? RT_ OFFSETOF(RTNETTCP, th_sum)2865 : RT_ OFFSETOF(RTNETUDP, uh_sum) ) ))2869 ? RT_UOFFSETOF(RTNETTCP, th_sum) 2870 : RT_UOFFSETOF(RTNETUDP, uh_sum) ) )) 2866 2871 { 2867 2872 E1kLog(("e1kSetupGsoCtx: TUCSO=%#x TUCSS=%#x TCP=%d\n", pCtx->ip.u8CSO, pCtx->ip.u8CSS, pCtx->dw2.fTCP)); … … 3734 3739 { 3735 3740 E1KSTATE *pState = PDMINS_2_DATA(pDevIns, E1KSTATE *); 3741 #ifdef E1K_USE_SUPLIB_SEMEVENT 3742 int rc = SUPSemEventSignal(PDMDevHlpGetVM(pDevIns)->pSession, pState->hTxSem); 3743 #else 3736 3744 int rc = RTSemEventSignal(pState->hTxSem); 3745 #endif 3737 3746 AssertRC(rc); 3738 3747 return VINF_SUCCESS; … … 3753 3762 while (pThread->enmState == PDMTHREADSTATE_RUNNING) 3754 3763 { 3755 int rc = RTSemEventWait(pState->hTxSem, RT_INDEFINITE_WAIT); 3764 #ifdef E1K_USE_SUPLIB_SEMEVENT 3765 int rc = SUPSemEventWaitNoResume(PDMDevHlpGetVM(pDevIns)->pSession, pState->hTxSem, RT_INDEFINITE_WAIT); 3766 #else 3767 int rc = RTSemEventWaitNoResume(pState->hTxSem, RT_INDEFINITE_WAIT); 3768 #endif 3769 if (rc == VERR_INTERRUPTED) 3770 continue; 3756 3771 AssertRCReturn(rc, rc); 3757 3772 if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING)) … … 3807 3822 E1KSTATE *pState = PDMINS_2_DATA(pDevIns, E1KSTATE *); 3808 3823 E1kLog2(("%s e1kTxQueueConsumer: Waking up TX thread...\n", INSTANCE(pState))); 3824 #ifdef E1K_USE_SUPLIB_SEMEVENT 3825 int rc = SUPSemEventSignal(PDMDevHlpGetVM(pDevIns)->pSession, pState->hTxSem); 3826 #else 3809 3827 int rc = RTSemEventSignal(pState->hTxSem); 3828 #endif 3810 3829 AssertRC(rc); 3811 3830 return true; … … 3852 3871 E1kLog(("%s e1kRegWriteTDT: %d descriptors to process, waking up E1000_TX thread\n", 3853 3872 INSTANCE(pState), e1kGetTxLen(pState))); 3854 #ifdef IN_RING3 3873 #if (defined(IN_RING3) || defined(IN_RING0)) && defined(E1K_USE_SUPLIB_SEMEVENT) 3874 rc = SUPSemEventSignal(PDMDevHlpGetVM(pState->CTX_SUFF(pDevIns))->pSession, pState->hTxSem); 3875 AssertRC(rc); 3876 #elif defined(IN_RING3) 3855 3877 rc = RTSemEventSignal(pState->hTxSem); 3856 3878 AssertRC(rc); … … 5407 5429 pState->hEventMoreRxDescAvail = NIL_RTSEMEVENT; 5408 5430 } 5431 #ifdef E1K_USE_SUPLIB_SEMEVENT 5432 if (pState->hTxSem != NIL_SUPSEMEVENT) 5433 { 5434 SUPSemEventClose(PDMDevHlpGetVM(pDevIns)->pSession, pState->hTxSem); 5435 pState->hTxSem = NIL_SUPSEMEVENT; 5436 } 5437 #else 5409 5438 if (pState->hTxSem != NIL_RTSEMEVENT) 5410 5439 { … … 5412 5441 pState->hTxSem = NIL_RTSEMEVENT; 5413 5442 } 5443 #endif 5414 5444 #ifndef E1K_GLOBAL_MUTEX 5415 5445 PDMR3CritSectDelete(&pState->csRx); … … 5538 5568 RTStrPrintf(pState->szInstance, sizeof(pState->szInstance), "E1000#%d", iInstance); 5539 5569 E1kLog(("%s Constructing new instance sizeof(E1KRXDESC)=%d\n", INSTANCE(pState), sizeof(E1KRXDESC))); 5570 #ifdef E1K_USE_SUPLIB_SEMEVENT 5571 pState->hTxSem = NIL_SUPSEMEVENT; 5572 #else 5540 5573 pState->hTxSem = NIL_RTSEMEVENT; 5574 #endif 5541 5575 pState->hEventMoreRxDescAvail = NIL_RTSEMEVENT; 5542 5576 … … 5771 5805 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN")); 5772 5806 5807 #ifdef E1K_USE_SUPLIB_SEMEVENT 5808 rc = SUPSemEventCreate(PDMDevHlpGetVM(pDevIns)->pSession, &pState->hTxSem); 5809 #else 5773 5810 rc = RTSemEventCreate(&pState->hTxSem); 5811 #endif 5774 5812 if (RT_FAILURE(rc)) 5775 5813 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.