VirtualBox

Ignore:
Timestamp:
Apr 9, 2010 7:58:35 AM (15 years ago)
Author:
vboxsync
Message:

DevE1000: TX thread wakeup experiment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevE1000.cpp

    r28102 r28121  
    4747//#define E1K_INT_STATS
    4848//#define E1K_REL_STATS
     49//#define E1K_USE_SUPLIB_SEMEVENT
    4950
    5051#include <iprt/crc32.h>
     
    956957#endif
    957958    /** Transmit thread blocker. */
     959#ifdef E1K_USE_SUPLIB_SEMEVENT
     960    SUPSEMEVENT hTxSem;
     961#else
    958962    RTSEMEVENT  hTxSem;
     963#endif
    959964    /** Base address of memory-mapped registers. */
    960965    RTGCPHYS    addrMMReg;
     
    28542859
    28552860    /* 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) ))
    28572862    {
    28582863        E1kLog(("e1kSetupGsoCtx: IPCSO=%#x IPCSS=%#x\n", pCtx->ip.u8CSO, pCtx->ip.u8CSS));
     
    28622867    /* TCP/UDP checksum offsets. */
    28632868    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) ) ))
    28662871    {
    28672872        E1kLog(("e1kSetupGsoCtx: TUCSO=%#x TUCSS=%#x TCP=%d\n", pCtx->ip.u8CSO, pCtx->ip.u8CSS, pCtx->dw2.fTCP));
     
    37343739{
    37353740    E1KSTATE *pState = PDMINS_2_DATA(pDevIns, E1KSTATE *);
     3741#ifdef E1K_USE_SUPLIB_SEMEVENT
     3742    int rc = SUPSemEventSignal(PDMDevHlpGetVM(pDevIns)->pSession, pState->hTxSem);
     3743#else
    37363744    int rc = RTSemEventSignal(pState->hTxSem);
     3745#endif
    37373746    AssertRC(rc);
    37383747    return VINF_SUCCESS;
     
    37533762    while (pThread->enmState == PDMTHREADSTATE_RUNNING)
    37543763    {
    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;
    37563771        AssertRCReturn(rc, rc);
    37573772        if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING))
     
    38073822    E1KSTATE *pState = PDMINS_2_DATA(pDevIns, E1KSTATE *);
    38083823    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
    38093827    int rc = RTSemEventSignal(pState->hTxSem);
     3828#endif
    38103829    AssertRC(rc);
    38113830    return true;
     
    38523871        E1kLog(("%s e1kRegWriteTDT: %d descriptors to process, waking up E1000_TX thread\n",
    38533872                 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)
    38553877        rc = RTSemEventSignal(pState->hTxSem);
    38563878        AssertRC(rc);
     
    54075429            pState->hEventMoreRxDescAvail = NIL_RTSEMEVENT;
    54085430        }
     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
    54095438        if (pState->hTxSem != NIL_RTSEMEVENT)
    54105439        {
     
    54125441            pState->hTxSem = NIL_RTSEMEVENT;
    54135442        }
     5443#endif
    54145444#ifndef E1K_GLOBAL_MUTEX
    54155445        PDMR3CritSectDelete(&pState->csRx);
     
    55385568    RTStrPrintf(pState->szInstance, sizeof(pState->szInstance), "E1000#%d", iInstance);
    55395569    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
    55405573    pState->hTxSem = NIL_RTSEMEVENT;
     5574#endif
    55415575    pState->hEventMoreRxDescAvail = NIL_RTSEMEVENT;
    55425576
     
    57715805        return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN"));
    57725806
     5807#ifdef E1K_USE_SUPLIB_SEMEVENT
     5808    rc = SUPSemEventCreate(PDMDevHlpGetVM(pDevIns)->pSession, &pState->hTxSem);
     5809#else
    57735810    rc = RTSemEventCreate(&pState->hTxSem);
     5811#endif
    57745812    if (RT_FAILURE(rc))
    57755813        return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette