VirtualBox

Changeset 28320 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Apr 14, 2010 6:26:24 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60079
Message:

Network/D*,VMM: Moving the TX threads, part 1.

Location:
trunk/src/VBox/Devices/Network
Files:
3 edited

Legend:

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

    r28277 r28320  
    3131 */
    3232
    33 #define VBOX_WITH_TX_THREAD_IN_NET_DEVICES 1 //debug, bird, remove
    3433#define LOG_GROUP LOG_GROUP_DEV_E1000
    3534
     
    907906    PDMILEDPORTS            ILeds;                               /**< LED interface */
    908907    R3PTRTYPE(PPDMIBASE)    pDrvBase;                 /**< Attached network driver. */
    909     R3PTRTYPE(PPDMINETWORKUP) pDrv;    /**< Connector of attached network driver. */
    910908    R3PTRTYPE(PPDMILEDCONNECTORS)    pLedsConnector;
    911 #if HC_ARCH_BITS == 32
    912     uint32_t                u32Padding;
    913 #endif
    914909
    915910    PPDMDEVINSR3            pDevInsR3;                   /**< Device instance - R3. */
    916911    R3PTRTYPE(PPDMQUEUE)    pTxQueueR3;                   /**< Transmit queue - R3. */
    917912    R3PTRTYPE(PPDMQUEUE)    pCanRxQueueR3;           /**< Rx wakeup signaller - R3. */
     913    PPDMINETWORKUPR3        pDrvR3;              /**< Attached network driver - R3. */
    918914    PTMTIMERR3              pRIDTimerR3;   /**< Receive Interrupt Delay Timer - R3. */
    919915    PTMTIMERR3              pRADTimerR3;    /**< Receive Absolute Delay Timer - R3. */
     
    922918    PTMTIMERR3              pIntTimerR3;            /**< Late Interrupt Timer - R3. */
    923919    PTMTIMERR3              pLUTimerR3;               /**< Link Up(/Restore) Timer. */
     920    /** The scatter / gather buffer used for the current outgoing packet - R3. */
     921    R3PTRTYPE(PPDMSCATTERGATHER) pTxSgR3;
    924922
    925923    PPDMDEVINSR0            pDevInsR0;                   /**< Device instance - R0. */
    926924    R0PTRTYPE(PPDMQUEUE)    pTxQueueR0;                   /**< Transmit queue - R0. */
    927925    R0PTRTYPE(PPDMQUEUE)    pCanRxQueueR0;           /**< Rx wakeup signaller - R0. */
     926    PPDMINETWORKUPR0        pDrvR0;              /**< Attached network driver - R0. */
    928927    PTMTIMERR0              pRIDTimerR0;   /**< Receive Interrupt Delay Timer - R0. */
    929928    PTMTIMERR0              pRADTimerR0;    /**< Receive Absolute Delay Timer - R0. */
     
    932931    PTMTIMERR0              pIntTimerR0;            /**< Late Interrupt Timer - R0. */
    933932    PTMTIMERR0              pLUTimerR0;          /**< Link Up(/Restore) Timer - R0. */
     933    /** The scatter / gather buffer used for the current outgoing packet - R0. */
     934    R0PTRTYPE(PPDMSCATTERGATHER) pTxSgR0;
    934935
    935936    PPDMDEVINSRC            pDevInsRC;                   /**< Device instance - RC. */
    936937    RCPTRTYPE(PPDMQUEUE)    pTxQueueRC;                   /**< Transmit queue - RC. */
    937938    RCPTRTYPE(PPDMQUEUE)    pCanRxQueueRC;           /**< Rx wakeup signaller - RC. */
     939    PPDMINETWORKUPRC        pDrvRC;              /**< Attached network driver - RC. */
    938940    PTMTIMERRC              pRIDTimerRC;   /**< Receive Interrupt Delay Timer - RC. */
    939941    PTMTIMERRC              pRADTimerRC;    /**< Receive Absolute Delay Timer - RC. */
     
    942944    PTMTIMERRC              pIntTimerRC;            /**< Late Interrupt Timer - RC. */
    943945    PTMTIMERRC              pLUTimerRC;          /**< Link Up(/Restore) Timer - RC. */
    944 
    945 #if HC_ARCH_BITS != 32
    946     uint32_t                u32Padding2;
    947 #endif
    948 
    949 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
    950     PPDMTHREAD  pTxThread;                                    /**< Transmit thread. */
    951 #endif
     946    /** The scatter / gather buffer used for the current outgoing packet - RC. */
     947    RCPTRTYPE(PPDMSCATTERGATHER) pTxSgRC;
     948    RTRCPTR                 RCPtrAlignment;
     949
    952950    PDMCRITSECT cs;                  /**< Critical section - what is it protecting? */
    953951#ifndef E1K_GLOBAL_MUTEX
     
    955953//    PDMCRITSECT csTx;                                     /**< TX Critical section. */
    956954#endif
     955#ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
    957956    /** Transmit thread blocker. */
    958 #ifdef E1K_USE_SUPLIB_SEMEVENT
     957# ifdef E1K_USE_SUPLIB_SEMEVENT
    959958    SUPSEMEVENT hTxSem;
    960 #else
     959# else
    961960    RTSEMEVENT  hTxSem;
     961# endif
     962#endif
     963#ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
     964    PPDMTHREAD  pTxThread;                                    /**< Transmit thread. */
    962965#endif
    963966    /** Base address of memory-mapped registers. */
     
    10161019     *  applicable to the current TSE mode. */
    10171020    PDMNETWORKGSO GsoCtx;
    1018     /** The scatter / gather buffer used for the current outgoing packet. */
    1019     R3PTRTYPE(PPDMSCATTERGATHER) pTxSgR3;
    10201021    /** Scratch space for holding the loopback / fallback scatter / gather
    10211022     *  descriptor. */
     
    11341135PDMBOTHCBDECL(int) e1kIOPortOut(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT port, uint32_t u32, unsigned cb);
    11351136RT_C_DECLS_END
     1137
     1138static int e1kXmitPending(E1KSTATE *pState, bool fOnWorkerThread);
    11361139
    11371140static int e1kRegReadUnimplemented (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value);
     
    13291332
    13301333#ifdef DEBUG
     1334
    13311335/**
    13321336 * Convert U32 value to hex string. Masked bytes are replaced with dots.
     
    13751379    return "unknown";
    13761380}
     1381
    13771382#endif /* DEBUG */
    13781383
     
    14241429
    14251430#define e1kCsRxEnter(ps, rc) VINF_SUCCESS
    1426 #define e1kCsRxLeave(ps)
     1431#define e1kCsRxLeave(ps) do { } while (0)
    14271432
    14281433#define e1kCsTxEnter(ps, rc) VINF_SUCCESS
    1429 #define e1kCsTxLeave(ps)
     1434#define e1kCsTxLeave(ps) do { } while (0)
    14301435
    14311436
     
    14621467
    14631468#define e1kCsTxEnter(ps, rc) VINF_SUCCESS
    1464 #define e1kCsTxLeave(ps)
     1469#define e1kCsTxLeave(ps) do { } while (0)
    14651470//#define e1kCsTxEnter(ps, rc) PDMCritSectEnter(&ps->csTx, rc)
    14661471//#define e1kCsTxLeave(ps) PDMCritSectLeave(&ps->csTx)
     
    15161521    }
    15171522}
     1523#endif
    15181524
    15191525/**
     
    16991705    }
    17001706}
    1701 #endif /* IN_RING3 */
    17021707
    17031708/**
     
    18101815}
    18111816
    1812 #ifdef IN_RING3
    18131817/**
    18141818 * Compute the physical address of the descriptor.
     
    21182122}
    21192123
    2120 #endif /* IN_RING3 */
    21212124
    21222125#if 0 /* unused */
     
    26222625        if (RT_SUCCESS(rc))
    26232626        {
    2624 #ifdef IN_RING3
     2627#ifdef IN_RING3 /** @todo bird: Use SUPSem* for this so we can signal it in ring-0 as well. (reduces latency) */
    26252628            /* Signal that we have more receive descriptors avalable. */
    26262629            e1kWakeupReceive(pState->CTX_SUFF(pDevIns));
     
    26742677#ifdef IN_RING3
    26752678#ifdef E1K_USE_TX_TIMERS
     2679
    26762680/**
    26772681 * Transmit Interrupt Delay Timer handler.
     
    27232727    }
    27242728}
     2729
    27252730#endif /* E1K_USE_TX_TIMERS */
    2726 
    27272731#ifdef E1K_USE_RX_TIMERS
     2732
    27282733/**
    27292734 * Receive Interrupt Delay Timer handler.
     
    27732778    }
    27742779}
     2780
    27752781#endif /* E1K_USE_RX_TIMERS */
    27762782
     
    28232829}
    28242830
    2825 
     2831#endif /* IN_RING3 */
    28262832
    28272833/**
     
    29902996static void e1kXmitFreeBuf(E1KSTATE *pState)
    29912997{
    2992     PPDMSCATTERGATHER pSg = pState->pTxSgR3;
     2998    PPDMSCATTERGATHER pSg = pState->CTX_SUFF(pTxSg);
    29932999    if (pSg)
    29943000    {
    2995         pState->pTxSgR3 = NULL;
     3001        pState->CTX_SUFF(pTxSg) = NULL;
    29963002
    29973003        if (pSg->pvAllocator != pState)
    29983004        {
    2999             PPDMINETWORKUP pDrv = pState->pDrv;
     3005            PPDMINETWORKUP pDrv = pState->CTX_SUFF(pDrv);
    30003006            if (pDrv)
    30013007                pDrv->pfnFreeBuf(pDrv, pSg);
     
    30333039
    30343040    /* Deal with existing buffer (descriptor screw up, reset, etc). */
    3035     if (RT_UNLIKELY(pState->pTxSgR3))
     3041    if (RT_UNLIKELY(pState->CTX_SUFF(pTxSg)))
    30363042        e1kXmitFreeBuf(pState);
    3037     Assert(pState->pTxSgR3 == NULL);
     3043    Assert(pState->CTX_SUFF(pTxSg) == NULL);
    30383044
    30393045    /*
     
    30433049    if (RT_LIKELY(GET_BITS(RCTL, LBM) != RCTL_LBM_TCVR))
    30443050    {
    3045         PPDMINETWORKUP pDrv = pState->pDrv;
     3051        PPDMINETWORKUP pDrv = pState->CTX_SUFF(pDrv);
    30463052        if (RT_UNLIKELY(!pDrv))
    30473053            return VERR_NET_DOWN;
     
    30653071    }
    30663072
    3067     pState->pTxSgR3 = pSg;
     3073    pState->CTX_SUFF(pTxSg) = pSg;
    30683074    return VINF_SUCCESS;
    30693075}
     
    31263132static void e1kTransmitFrame(E1KSTATE* pState, bool fOnWorkerThread)
    31273133{
    3128     PPDMSCATTERGATHER   pSg     = pState->pTxSgR3;
     3134    PPDMSCATTERGATHER   pSg     = pState->CTX_SUFF(pTxSg);
    31293135    uint32_t const      cbFrame = pSg ? (size_t)pSg->cbUsed : 0;
    31303136    Assert(!pSg || pSg->cSegs == 1);
     
    31483154    /* Update octet transmit counter */
    31493155    E1K_ADD_CNT64(GOTCL, GOTCH, cbFrame);
    3150     if (pState->pDrv)
     3156    if (pState->CTX_SUFF(pDrv))
    31513157        STAM_REL_COUNTER_ADD(&pState->StatTransmitBytes, cbFrame);
    31523158    if (cbFrame == 64)
     
    31733179        e1kPacketDump(pState, (uint8_t const *)pSg->aSegs[0].pvSeg, cbFrame, "--> Outgoing");
    31743180
    3175         pState->pTxSgR3 = NULL;
    3176         PPDMINETWORKUP pDrv = pState->pDrv;
     3181        pState->CTX_SUFF(pTxSg) = NULL;
     3182        PPDMINETWORKUP pDrv = pState->CTX_SUFF(pDrv);
    31773183        if (pDrv)
    31783184        {
     
    33423348         * we copy of the data.
    33433349         */
    3344         if (!pState->pTxSgR3)
     3350        if (!pState->CTX_SUFF(pTxSg))
    33453351            e1kXmitAllocBuf(pState, pState->u16TxPktLen, true /*fExactSize*/, false /*fGso*/);
    3346         if (pState->pTxSgR3)
     3352        if (pState->CTX_SUFF(pTxSg))
    33473353        {
    3348             Assert(pState->u16TxPktLen <= pState->pTxSgR3->cbAvailable);
    3349             Assert(pState->pTxSgR3->cSegs == 1);
    3350             if (pState->pTxSgR3->aSegs[0].pvSeg != pState->aTxPacketFallback)
    3351                 memcpy(pState->pTxSgR3->aSegs[0].pvSeg, pState->aTxPacketFallback, pState->u16TxPktLen);
    3352             pState->pTxSgR3->cbUsed         = pState->u16TxPktLen;
    3353             pState->pTxSgR3->aSegs[0].cbSeg = pState->u16TxPktLen;
     3354            Assert(pState->u16TxPktLen <= pState->CTX_SUFF(pTxSg)->cbAvailable);
     3355            Assert(pState->CTX_SUFF(pTxSg)->cSegs == 1);
     3356            if (pState->CTX_SUFF(pTxSg)->aSegs[0].pvSeg != pState->aTxPacketFallback)
     3357                memcpy(pState->CTX_SUFF(pTxSg)->aSegs[0].pvSeg, pState->aTxPacketFallback, pState->u16TxPktLen);
     3358            pState->CTX_SUFF(pTxSg)->cbUsed         = pState->u16TxPktLen;
     3359            pState->CTX_SUFF(pTxSg)->aSegs[0].cbSeg = pState->u16TxPktLen;
    33543360        }
    33553361        e1kTransmitFrame(pState, fOnWorkerThread);
     
    33803386static bool e1kFallbackAddToFrame(E1KSTATE* pState, E1KTXDESC* pDesc, uint32_t cbFragment, bool fOnWorkerThread)
    33813387{
    3382     PPDMSCATTERGATHER pTxSg = pState->pTxSgR3;
     3388    PPDMSCATTERGATHER pTxSg = pState->CTX_SUFF(pTxSg);
    33833389    Assert(e1kGetDescType(pDesc) == E1K_DTYP_DATA);
    33843390    Assert(pDesc->data.cmd.fTSE);
     
    34443450static bool e1kAddToFrame(E1KSTATE *pThis, RTGCPHYS PhysAddr, uint32_t cbFragment)
    34453451{
    3446     PPDMSCATTERGATHER   pTxSg    = pThis->pTxSgR3;
     3452    PPDMSCATTERGATHER   pTxSg    = pThis->CTX_SUFF(pTxSg);
    34473453    bool const          fGso     = e1kXmitIsGsoBuf(pTxSg);
    34483454    uint32_t const      cbNewPkt = cbFragment + pThis->u16TxPktLen;
     
    36283634             * transmit it and reset the u16TxPktLen field.
    36293635             */
    3630             if (e1kXmitIsGsoBuf(pState->pTxSgR3))
     3636            if (e1kXmitIsGsoBuf(pState->CTX_SUFF(pTxSg)))
    36313637            {
    36323638                STAM_COUNTER_INC(&pState->StatTxPathGSO);
     
    36353641                {
    36363642                    if (   fRc
    3637                         && pState->pTxSgR3
    3638                         && pState->pTxSgR3->cbUsed == (size_t)pState->contextTSE.dw3.u8HDRLEN + pState->contextTSE.dw2.u20PAYLEN)
     3643                        && pState->CTX_SUFF(pTxSg)
     3644                        && pState->CTX_SUFF(pTxSg)->cbUsed == (size_t)pState->contextTSE.dw3.u8HDRLEN + pState->contextTSE.dw2.u20PAYLEN)
    36393645                    {
    36403646                        e1kTransmitFrame(pState, fOnWorkerThread);
     
    36453651                        if (fRc)
    36463652                           E1kLog(("%s bad GSO/TSE %p or %u < %u\n" , INSTANCE(pState),
    3647                                    pState->pTxSgR3, pState->pTxSgR3 ? pState->pTxSgR3->cbUsed : 0,
     3653                                   pState->CTX_SUFF(pTxSg), pState->CTX_SUFF(pTxSg) ? pState->CTX_SUFF(pTxSg)->cbUsed : 0,
    36483654                                   pState->contextTSE.dw3.u8HDRLEN + pState->contextTSE.dw2.u20PAYLEN));
    36493655                        e1kXmitFreeBuf(pState);
     
    36593665                if (pDesc->data.cmd.fEOP)
    36603666                {
    3661                     if (fRc && pState->pTxSgR3)
     3667                    if (fRc && pState->CTX_SUFF(pTxSg))
    36623668                    {
    3663                         Assert(pState->pTxSgR3->cSegs == 1);
     3669                        Assert(pState->CTX_SUFF(pTxSg)->cSegs == 1);
    36643670                        if (pState->fIPcsum)
    3665                             e1kInsertChecksum(pState, (uint8_t *)pState->pTxSgR3->aSegs[0].pvSeg, pState->u16TxPktLen,
     3671                            e1kInsertChecksum(pState, (uint8_t *)pState->CTX_SUFF(pTxSg)->aSegs[0].pvSeg, pState->u16TxPktLen,
    36663672                                              pState->contextNormal.ip.u8CSO,
    36673673                                              pState->contextNormal.ip.u8CSS,
    36683674                                              pState->contextNormal.ip.u16CSE);
    36693675                        if (pState->fTCPcsum)
    3670                             e1kInsertChecksum(pState, (uint8_t *)pState->pTxSgR3->aSegs[0].pvSeg, pState->u16TxPktLen,
     3676                            e1kInsertChecksum(pState, (uint8_t *)pState->CTX_SUFF(pTxSg)->aSegs[0].pvSeg, pState->u16TxPktLen,
    36713677                                              pState->contextNormal.tu.u8CSO,
    36723678                                              pState->contextNormal.tu.u8CSS,
     
    37543760     * Grab the xmit lock of the driver as well as the E1K device state.
    37553761     */
    3756     PPDMINETWORKUP pDrv = pState->pDrv;
     3762    PPDMINETWORKUP pDrv = pState->CTX_SUFF(pDrv);
    37573763    if (pDrv)
    37583764    {
     
    38013807    return rc;
    38023808}
     3809
     3810#ifdef IN_RING3
    38033811
    38043812/**
     
    38823890    E1KSTATE *pState = PDMINS_2_DATA(pDevIns, E1KSTATE *);
    38833891    E1kLog2(("%s e1kTxQueueConsumer: Waking up TX thread...\n", INSTANCE(pState)));
    3884 #ifdef E1K_USE_SUPLIB_SEMEVENT
     3892
     3893#ifndef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
     3894    int rc = e1kXmitPending(pState, false /*fOnWorkerThread*/);
     3895    AssertMsg(RT_SUCCESS(rc) || rc == VERR_TRY_AGAIN, ("%Rrc\n", rc));
     3896#else
     3897# ifdef E1K_USE_SUPLIB_SEMEVENT
    38853898    int rc = SUPSemEventSignal(PDMDevHlpGetVM(pDevIns)->pSession, pState->hTxSem);
    3886 #else
     3899# else
    38873900    int rc = RTSemEventSignal(pState->hTxSem);
     3901# endif
     3902    AssertRC(rc);
    38883903#endif
    3889     AssertRC(rc);
     3904
    38903905    return true;
    38913906}
     
    39143929static int e1kRegWriteTDT(E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t value)
    39153930{
    3916 #ifndef IN_RING3
    3917 //    return VINF_IOM_HC_MMIO_WRITE;
    3918 #endif
    39193931    int rc = e1kCsTxEnter(pState, VINF_IOM_HC_MMIO_WRITE);
    39203932    if (RT_UNLIKELY(rc != VINF_SUCCESS))
    39213933        return rc;
    39223934    rc = e1kRegWriteDefault(pState, offset, index, value);
     3935
    39233936    /* All descriptors starting with head and not including tail belong to us. */
    39243937    /* Process them. */
    39253938    E1kLog2(("%s e1kRegWriteTDT: TDBAL=%08x, TDBAH=%08x, TDLEN=%08x, TDH=%08x, TDT=%08x\n",
    39263939            INSTANCE(pState), TDBAL, TDBAH, TDLEN, TDH, TDT));
     3940
    39273941    /* Ignore TDT writes when the link is down. */
    39283942    if (TDH != TDT && (STATUS & STATUS_LU))
     
    39313945        E1kLog(("%s e1kRegWriteTDT: %d descriptors to process, waking up E1000_TX thread\n",
    39323946                 INSTANCE(pState), e1kGetTxLen(pState)));
    3933 #if (defined(IN_RING3) || defined(IN_RING0)) && defined(E1K_USE_SUPLIB_SEMEVENT)
     3947#ifndef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
     3948        e1kCsTxLeave(pState);
     3949
     3950        /* Transmit pending packets if possible, defere it if we cannot do it
     3951           in the current context. */
     3952# if defined(IN_RING0) || defined(IN_RC)
     3953        if (!pState->CTX_SUFF(pDrv))
     3954        {
     3955            PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pState->CTX_SUFF(pTxQueue));
     3956            if (RT_UNLIKELY(pItem))
     3957                PDMQueueInsert(pState->CTX_SUFF(pTxQueue), pItem);
     3958        }
     3959        else
     3960# endif
     3961        {
     3962            rc = e1kXmitPending(pState, false /*fOnWorkerThread*/);
     3963            if (rc == VERR_TRY_AGAIN)
     3964                rc = VINF_SUCCESS;
     3965            AssertRC(rc);
     3966        }
     3967#else
     3968# if (defined(IN_RING3) || defined(IN_RING0)) && defined(E1K_USE_SUPLIB_SEMEVENT)
    39343969        rc = SUPSemEventSignal(PDMDevHlpGetVM(pState->CTX_SUFF(pDevIns))->pSession, pState->hTxSem);
    39353970        AssertRC(rc);
    3936 #elif defined(IN_RING3)
     3971# elif defined(IN_RING3)
    39373972        rc = RTSemEventSignal(pState->hTxSem);
    39383973        AssertRC(rc);
    3939 #else
     3974# else
    39403975        PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pState->CTX_SUFF(pTxQueue));
    39413976        if (RT_UNLIKELY(pItem))
    39423977            PDMQueueInsert(pState->CTX_SUFF(pTxQueue), pItem);
    3943 #endif /* !IN_RING3 */
    3944 
    3945     }
    3946     e1kCsTxLeave(pState);
     3978# endif /* !IN_RING3 */
     3979#endif
     3980
     3981    }
     3982    else
     3983        e1kCsTxLeave(pState);
    39473984
    39483985    return rc;
     
    50245061            e1kRaiseInterrupt(pState, VERR_SEM_BUSY, ICR_LSC);
    50255062        }
    5026         if (pState->pDrv)
    5027             pState->pDrv->pfnNotifyLinkChanged(pState->pDrv, enmState);
     5063        if (pState->pDrvR3)
     5064            pState->pDrvR3->pfnNotifyLinkChanged(pState->pDrvR3, enmState);
    50285065    }
    50295066    return VINF_SUCCESS;
     
    53325369     */
    53335370    pState->pDrvBase = NULL;
    5334     pState->pDrv = NULL;
     5371    pState->pDrvR3 = NULL;
     5372    pState->pDrvR0 = NIL_RTR0PTR;
     5373    pState->pDrvRC = NIL_RTRCPTR;
    53355374
    53365375    PDMCritSectLeave(&pState->cs);
     
    53755414#endif
    53765415        }
    5377         pState->pDrv = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP);
    5378         AssertMsgStmt(pState->pDrv, ("Failed to obtain the PDMINETWORKUP interface!\n"),
     5416        pState->pDrvR3 = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP);
     5417        AssertMsgStmt(pState->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"),
    53795418                      rc = VERR_PDM_MISSING_INTERFACE_BELOW);
     5419        if (RT_SUCCESS(rc))
     5420        {
     5421            PPDMIBASER0 pBaseR0 = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASER0);
     5422            pState->pDrvR0 = pBaseR0 ? pBaseR0->pfnQueryInterface(pBaseR0, PDMINETWORKUP_IID) : NIL_RTR0PTR;
     5423
     5424            PPDMIBASERC pBaseRC = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASERC);
     5425            pState->pDrvRC = pBaseRC ? pBaseRC->pfnQueryInterface(pBaseRC, PDMINETWORKUP_IID) : NIL_RTR0PTR;
     5426        }
    53805427    }
    53815428    else if (   rc == VERR_PDM_NO_ATTACHED_DRIVER
     
    54865533            pState->hEventMoreRxDescAvail = NIL_RTSEMEVENT;
    54875534        }
    5488 #ifdef E1K_USE_SUPLIB_SEMEVENT
     5535#ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
     5536# ifdef E1K_USE_SUPLIB_SEMEVENT
    54895537        if (pState->hTxSem != NIL_SUPSEMEVENT)
    54905538        {
     
    54925540            pState->hTxSem = NIL_SUPSEMEVENT;
    54935541        }
    5494 #else
     5542# else
    54955543        if (pState->hTxSem != NIL_RTSEMEVENT)
    54965544        {
     
    54985546            pState->hTxSem = NIL_RTSEMEVENT;
    54995547        }
     5548# endif
    55005549#endif
    55015550#ifndef E1K_GLOBAL_MUTEX
     
    56255674    RTStrPrintf(pState->szInstance, sizeof(pState->szInstance), "E1000#%d", iInstance);
    56265675    E1kLog(("%s Constructing new instance sizeof(E1KRXDESC)=%d\n", INSTANCE(pState), sizeof(E1KRXDESC)));
    5627 #ifdef E1K_USE_SUPLIB_SEMEVENT
     5676#ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
     5677# ifdef E1K_USE_SUPLIB_SEMEVENT
    56285678    pState->hTxSem = NIL_SUPSEMEVENT;
    5629 #else
     5679# else
    56305680    pState->hTxSem = NIL_RTSEMEVENT;
     5681# endif
    56315682#endif
    56325683    pState->hEventMoreRxDescAvail = NIL_RTSEMEVENT;
     
    58535904                                       N_("A Domain Name Server (DNS) for NAT networking could not be determined. Ensure that your host is correctly connected to an ISP. If you ignore this warning the guest will not be able to perform nameserver lookups and it will probably observe delays if trying so"));
    58545905        }
    5855         pState->pDrv = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP);
    5856         AssertMsgReturn(pState->pDrv, ("Failed to obtain the PDMINETWORKUP interface!\n"),
     5906        pState->pDrvR3 = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP);
     5907        AssertMsgReturn(pState->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"),
    58575908                        VERR_PDM_MISSING_INTERFACE_BELOW);
     5909
     5910        pState->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASER0), PDMINETWORKUP);
     5911        pState->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASERC), PDMINETWORKUP);
    58585912    }
    58595913    else if (   rc == VERR_PDM_NO_ATTACHED_DRIVER
     
    58665920        return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN"));
    58675921
    5868 #ifdef E1K_USE_SUPLIB_SEMEVENT
     5922#ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
     5923# ifdef E1K_USE_SUPLIB_SEMEVENT
    58695924    rc = SUPSemEventCreate(PDMDevHlpGetVM(pDevIns)->pSession, &pState->hTxSem);
    5870 #else
     5925# else
    58715926    rc = RTSemEventCreate(&pState->hTxSem);
    5872 #endif
     5927# endif
    58735928    if (RT_FAILURE(rc))
    58745929        return rc;
     5930#endif
    58755931    rc = RTSemEventCreate(&pState->hEventMoreRxDescAvail);
    58765932    if (RT_FAILURE(rc))
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r28277 r28320  
    5050 * THE SOFTWARE.
    5151 */
    52 #define VBOX_WITH_TX_THREAD_IN_NET_DEVICES 1 //debug, bird, remove
     52
    5353
    5454/*******************************************************************************
     
    120120{
    121121    PCIDEVICE                           PciDev;
     122
     123    /** Pointer to the device instance - R3. */
     124    PPDMDEVINSR3                        pDevInsR3;
     125    /** Transmit signaller - R3. */
     126    R3PTRTYPE(PPDMQUEUE)                pXmitQueueR3;
     127    /** Receive signaller - R3. */
     128    R3PTRTYPE(PPDMQUEUE)                pCanRxQueueR3;
     129    /** Pointer to the connector of the attached network driver - R3. */
     130    PPDMINETWORKUPR3                    pDrvR3;
     131    /** Pointer to the attached network driver. */
     132    R3PTRTYPE(PPDMIBASE)                pDrvBase;
     133    /** LUN\#0 + status LUN: The base interface. */
     134    PDMIBASE                            IBase;
     135    /** LUN\#0: The network port interface. */
     136    PDMINETWORKDOWN                     INetworkDown;
     137    /** LUN\#0: The network config port interface. */
     138    PDMINETWORKCONFIG                   INetworkConfig;
     139    /** The shared memory used for the private interface - R3. */
     140    R3PTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIOR3;
     141    /** Software Interrupt timer - R3. */
     142    PTMTIMERR3                          pTimerSoftIntR3;
    122143#ifndef PCNET_NO_POLLING
    123144    /** Poll timer - R3. */
    124145    PTMTIMERR3                          pTimerPollR3;
     146#endif
     147    /** Restore timer.
     148     *  This is used to disconnect and reconnect the link after a restore. */
     149    PTMTIMERR3                          pTimerRestore;
     150
     151    /** Pointer to the device instance - R0. */
     152    PPDMDEVINSR0                        pDevInsR0;
     153    /** Receive signaller - R0. */
     154    R0PTRTYPE(PPDMQUEUE)                pCanRxQueueR0;
     155    /** Transmit signaller - R0. */
     156    R0PTRTYPE(PPDMQUEUE)                pXmitQueueR0;
     157    /** Pointer to the connector of the attached network driver - R0. */
     158    PPDMINETWORKUPR0                    pDrvR0;
     159    /** The shared memory used for the private interface - R0. */
     160    R0PTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIOR0;
     161    /** Software Interrupt timer - R0. */
     162    PTMTIMERR0                          pTimerSoftIntR0;
     163#ifndef PCNET_NO_POLLING
    125164    /** Poll timer - R0. */
    126165    PTMTIMERR0                          pTimerPollR0;
     166#endif
     167
     168    /** Pointer to the device instance - RC. */
     169    PPDMDEVINSRC                        pDevInsRC;
     170    /** Receive signaller - RC. */
     171    RCPTRTYPE(PPDMQUEUE)                pCanRxQueueRC;
     172    /** Transmit signaller - RC. */
     173    RCPTRTYPE(PPDMQUEUE)                pXmitQueueRC;
     174    /** Pointer to the connector of the attached network driver - RC. */
     175    PPDMINETWORKUPRC                    pDrvRC;
     176    /** The shared memory used for the private interface - RC. */
     177    RCPTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIORC;
     178    /** Software Interrupt timer - RC. */
     179    PTMTIMERRC                          pTimerSoftIntRC;
     180#ifndef PCNET_NO_POLLING
    127181    /** Poll timer - RC. */
    128182    PTMTIMERRC                          pTimerPollRC;
     
    132186    uint32_t                            Alignment1;
    133187#endif
    134 
    135     /** Software Interrupt timer - R3. */
    136     PTMTIMERR3                          pTimerSoftIntR3;
    137     /** Software Interrupt timer - R0. */
    138     PTMTIMERR0                          pTimerSoftIntR0;
    139     /** Software Interrupt timer - RC. */
    140     PTMTIMERRC                          pTimerSoftIntRC;
    141188
    142189    /** Register Address Pointer */
     
    155202    uint16_t                            aMII[MII_MAX_REG];
    156203    uint16_t                            u16CSR0LastSeenByGuest;
    157     uint16_t                            Alignment2[HC_ARCH_BITS == 32 ? 2 : 4];
     204    uint16_t                            Alignment2[HC_ARCH_BITS == 32 ? 2 : 2];
    158205    /** Last time we polled the queues */
    159206    uint64_t                            u64LastPoll;
     
    172219    RTGCPHYS32                          GCUpperPhys;
    173220
    174     /** Transmit signaller - RC. */
    175     RCPTRTYPE(PPDMQUEUE)                pXmitQueueRC;
    176     /** Transmit signaller - R3. */
    177     R3PTRTYPE(PPDMQUEUE)                pXmitQueueR3;
    178     /** Transmit signaller - R0. */
    179     R0PTRTYPE(PPDMQUEUE)                pXmitQueueR0;
    180 
    181     /** Receive signaller - R3. */
    182     R3PTRTYPE(PPDMQUEUE)                pCanRxQueueR3;
    183     /** Receive signaller - R0. */
    184     R0PTRTYPE(PPDMQUEUE)                pCanRxQueueR0;
    185     /** Receive signaller - RC. */
    186     RCPTRTYPE(PPDMQUEUE)                pCanRxQueueRC;
    187     /** Pointer to the device instance - RC. */
    188     PPDMDEVINSRC                        pDevInsRC;
    189     /** Pointer to the device instance - R3. */
    190     PPDMDEVINSR3                        pDevInsR3;
    191     /** Pointer to the device instance - R0. */
    192     PPDMDEVINSR0                        pDevInsR0;
    193     /** Restore timer.
    194      *  This is used to disconnect and reconnect the link after a restore. */
    195     PTMTIMERR3                          pTimerRestore;
    196     /** Pointer to the connector of the attached network driver. */
    197     R3PTRTYPE(PPDMINETWORKUP)           pDrvR3;
    198     /** Pointer to the attached network driver. */
    199     R3PTRTYPE(PPDMIBASE)                pDrvBase;
    200     /** LUN\#0 + status LUN: The base interface. */
    201     PDMIBASE                            IBase;
    202     /** LUN\#0: The network port interface. */
    203     PDMINETWORKDOWN                     INetworkDown;
    204     /** LUN\#0: The network config port interface. */
    205     PDMINETWORKCONFIG                   INetworkConfig;
    206221    /** Base address of the MMIO region. */
    207222    RTGCPHYS32                          MMIOBase;
     
    218233    RTMAC                               MacConfigured;
    219234    /** Alignment padding. */
    220     uint8_t                             Alignment4[HC_ARCH_BITS == 64 ? 6 : 6];
     235    uint8_t                             Alignment4[HC_ARCH_BITS == 64 ? 2 : 2];
    221236
    222237    /** The LED. */
     
    242257    /** True if we signal the guest that RX packets are missing. */
    243258    bool                                fSignalRxMiss;
    244     uint8_t                             Alignment5[HC_ARCH_BITS == 64 ? 6 : 2];
     259    uint8_t                             Alignment5[HC_ARCH_BITS == 64 ? 2 : 6];
    245260
    246261#ifdef PCNET_NO_POLLING
     
    254269    DECLR0CALLBACKMEMBER(int, pfnEMInterpretInstructionR0, (PVM pVM, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize));
    255270#endif
    256 
    257     /** The shared memory used for the private interface - R3. */
    258     R3PTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIOR3;
    259     /** The shared memory used for the private interface - R0. */
    260     R0PTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIOR0;
    261     /** The shared memory used for the private interface - RC. */
    262     RCPTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIORC;
    263271
    264272    /** Error counter for bad receive descriptors. */
     
    322330#endif /* VBOX_WITH_STATISTICS */
    323331};
    324 AssertCompileMemberAlignment(PCNetState, StatReceiveBytes, 8);
     332//AssertCompileMemberAlignment(PCNetState, StatReceiveBytes, 8);
    325333
    326334#define PCNETSTATE_2_DEVINS(pPCNet)            ((pPCNet)->CTX_SUFF(pDevIns))
     
    607615
    608616static void pcnetPollTimerStart(PCNetState *pThis);
     617static int  pcnetXmitPending(PCNetState *pThis, bool fOnWorkerThread);
     618
     619
    609620
    610621/**
     
    804815}
    805816
    806 #ifdef IN_RING3
    807817
    808818/**
     
    855865}
    856866
     867#ifdef IN_RING3
    857868/**
    858869 * Read+Write a TX/RX descriptor to prevent PDMDevHlpPhysWrite() allocating
     
    875886    }
    876887}
    877 
    878888#endif /* IN_RING3 */
    879889
     
    917927
    918928#ifdef IN_RING3
    919 
    920929/**
    921930 * Initialize the shared memory for the private guest interface.
     
    961970    pThis->pSharedMMIOR3->cbUsed = off;
    962971}
     972#endif /* IN_RING3 */
    963973
    964974#define MULTICAST_FILTER_LEN 8
     
    11211131}
    11221132
    1123 #endif /* IN_RING3 */
    11241133
    11251134/**
     
    18261835
    18271836
    1828 #ifdef IN_RING3
    1829 
    18301837/**
    18311838 * Write data into guest receive buffers.
     
    21072114    else
    21082115    {
    2109         PPDMINETWORKUP pDrv = pThis->pDrvR3;
     2116        PPDMINETWORKUP pDrv = pThis->CTX_SUFF(pDrv);
    21102117        if (RT_LIKELY(pDrv))
    21112118        {
     
    21402147        else
    21412148        {
    2142             PPDMINETWORKUP pDrv = pThis->pDrvR3;
     2149            PPDMINETWORKUP pDrv = pThis->CTX_SUFF(pDrv);
    21432150            if (RT_LIKELY(pDrv))
    21442151                pDrv->pfnFreeBuf(pDrv, pSgBuf);
     
    21852192            pThis->Led.Asserted.s.fWriting = pThis->Led.Actual.s.fWriting = 1;
    21862193
    2187         PPDMINETWORKUP pDrv = pThis->pDrvR3;
     2194        PPDMINETWORKUP pDrv = pThis->CTX_SUFF(pDrv);
    21882195        if (RT_LIKELY(pDrv))
    21892196        {
     
    23432350
    23442351/**
    2345  * Flushes queued frames.
    2346  */
    2347 DECLINLINE(void) pcnetXmitFlushFrames(PCNetState *pThis)
    2348 {
    2349     pcnetXmitQueueConsumer(pThis->CTX_SUFF(pDevIns), NULL);
    2350 }
    2351 
    2352 #endif /* IN_RING3 */
    2353 
    2354 
    2355 
    2356 /**
    23572352 * Try to transmit frames
    23582353 */
     
    23772372    pThis->aCSR[0] &= ~0x0008;
    23782373
     2374#ifndef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
     2375    /*
     2376     * Transmit pending packets if possible, defere it if we cannot do it
     2377     * in the current context.
     2378     */
     2379# if defined(IN_RING0) || defined(IN_RC)
     2380    if (!pThis->CTX_SUFF(pDrv))
     2381    {
     2382        PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pXmitQueue));
     2383        if (RT_UNLIKELY(pItem))
     2384            PDMQueueInsert(pThis->CTX_SUFF(pXmitQueue), pItem);
     2385    }
     2386    else
     2387# endif
     2388    {
     2389        int rc = pcnetXmitPending(pThis, false /*fOnWorkerThread*/);
     2390        if (rc == VERR_TRY_AGAIN)
     2391            rc = VINF_SUCCESS;
     2392        AssertRC(rc);
     2393    }
     2394#else  /* VBOX_WITH_TX_THREAD_IN_NET_DEVICES */
    23792395    /*
    23802396     * If we're in Ring-3 we should flush the queue now, in GC/R0 we'll queue a flush job.
    23812397     */
    2382 #ifdef IN_RING3
    2383     pcnetXmitFlushFrames(pThis);
    2384 #else
     2398# ifdef IN_RING3
     2399    int rc = RTSemEventSignal(pThis->hSendEventSem);
     2400    AssertRC(rc);
     2401# else
    23852402    PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pXmitQueue));
    23862403    if (RT_UNLIKELY(pItem))
    23872404        PDMQueueInsert(pThis->CTX_SUFF(pXmitQueue), pItem);
    2388 #endif
    2389 }
    2390 
    2391 #ifdef IN_RING3
     2405# endif
     2406#endif /* VBOX_WITH_TX_THREAD_IN_NET_DEVICES */
     2407}
     2408
    23922409
    23932410/**
     
    26642681     * Grab the xmit lock of the driver as well as the E1K device state.
    26652682     */
    2666     PPDMINETWORKUP pDrv = pThis->pDrvR3;
     2683    PPDMINETWORKUP pDrv = pThis->CTX_SUFF(pDrv);
    26672684    if (pDrv)
    26682685    {
     
    26942711}
    26952712
     2713#ifdef IN_RING3
    26962714#ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
    26972715
     
    49234941    pThis->pDrvBase = NULL;
    49244942    pThis->pDrvR3 = NULL;
     4943    pThis->pDrvR0 = NULL;
     4944    pThis->pDrvRC = NULL;
    49254945
    49264946    PDMCritSectLeave(&pThis->CritSect);
     
    49684988        AssertMsgStmt(pThis->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"),
    49694989                      rc = VERR_PDM_MISSING_INTERFACE_BELOW);
     4990        pThis->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASER0), PDMINETWORKUP);
     4991        pThis->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASERC), PDMINETWORKUP);
    49704992    }
    49714993    else if (   rc == VERR_PDM_NO_ATTACHED_DRIVER
     
    50595081    if (PDMCritSectIsInitialized(&pThis->CritSect))
    50605082    {
     5083#ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
    50615084        /*
    50625085         * At this point the send thread is suspended and will not enter
     
    50665089        RTSemEventDestroy(pThis->hSendEventSem);
    50675090        pThis->hSendEventSem = NIL_RTSEMEVENT;
     5091#endif
    50685092        RTSemEventSignal(pThis->hEventOutOfRxSpace);
    50695093        RTSemEventDestroy(pThis->hEventOutOfRxSpace);
     
    50975121     */
    50985122    pThis->hEventOutOfRxSpace = NIL_RTSEMEVENT;
     5123#ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES
    50995124    pThis->hSendEventSem = NIL_RTSEMEVENT;
     5125#endif
    51005126
    51015127    /*
     
    53515377        AssertMsgReturn(pThis->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"),
    53525378                        VERR_PDM_MISSING_INTERFACE_BELOW);
     5379        pThis->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASER0), PDMINETWORKUP);
     5380        pThis->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASERC), PDMINETWORKUP);
    53535381    }
    53545382    else if (   rc == VERR_PDM_NO_ATTACHED_DRIVER
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r28275 r28320  
    8585    /** Pointer to the communication buffer. */
    8686    R3PTRTYPE(PINTNETBUF)           pBufR3;
     87    /** Ring-3 base interface for the ring-0 context. */
     88    PDMIBASER0                      IBaseR0;
     89    /** Ring-3 base interface for the raw-mode context. */
     90    PDMIBASERC                      IBaseRC;
     91    RTR3PTR                         R3PtrAlignment;
     92
     93    /** The network interface for the ring-0 context. */
     94    PDMINETWORKUPR0                 INetworkUpR0;
     95    /** Pointer to the driver instance. */
     96    PPDMDRVINSR0                    pDrvInsR0;
     97    RTR0PTR                         R0PtrAlignment;
     98
     99    /** The network interface for the raw-mode context. */
     100    PDMINETWORKUPRC                 INetworkUpRC;
     101    /** Pointer to the driver instance. */
     102    PPDMDRVINSRC                    pDrvInsRC;
     103    RTRCPTR                         RCPtrAlignment;
     104
     105    /** The transmit lock. */
     106    PDMCRITSECT                     XmitLock;
    87107    /** Interface handle. */
    88108    INTNETIFHANDLE                  hIf;
    89 
    90109    /** The thread state. */
    91110    ASYNCSTATE volatile             enmState;
    92111    /** Reader thread. */
    93     RTTHREAD                        Thread;
     112    RTTHREAD                        hRxThread;
    94113    /** Event semaphore the Thread waits on while the VM is suspended. */
    95114    RTSEMEVENT                      hEvtSuspended;
     
    103122    bool                            fActivateEarlyDeactivateLate;
    104123    /** Padding. */
    105     bool                            afReserved[2];
     124    bool                            afReserved[2+4];
    106125    /** The network name. */
    107126    char                            szNetwork[INTNET_MAX_NETWORK_NAME];
    108127
    109     /** Base interface for ring-0. */
    110     PDMIBASER0                      IBaseR0;
    111     /** Base interface for ring-0. */
    112     PDMIBASERC                      IBaseRC;
    113 
    114     /** The transmit lock. */
    115     PDMCRITSECT                     XmitLock;
    116 
     128    /** Number of GSO packets sent. */
     129    STAMCOUNTER                     StatSentGso;
     130    /** Number of GSO packets recevied. */
     131    STAMCOUNTER                     StatReceivedGso;
     132#ifdef VBOX_WITH_STATISTICS
     133    /** Profiling packet transmit runs. */
     134    STAMPROFILE                     StatTransmit;
     135    /** Profiling packet receive runs. */
     136    STAMPROFILEADV                  StatReceive;
     137#endif /* VBOX_WITH_STATISTICS */
    117138#ifdef LOG_ENABLED
    118139    /** The nano ts of the last transfer. */
     
    121142    uint64_t                        u64LastReceiveTS;
    122143#endif
    123 #ifdef VBOX_WITH_STATISTICS
    124     /** Profiling packet transmit runs. */
    125     STAMPROFILE                     StatTransmit;
    126     /** Profiling packet receive runs. */
    127     STAMPROFILEADV                  StatReceive;
    128 #endif /* VBOX_WITH_STATISTICS */
    129     /** Number of GSO packets sent. */
    130     STAMCOUNTER                     StatSentGso;
    131     /** Number of GSO packets recevied. */
    132     STAMCOUNTER                     StatReceivedGso;
    133144} DRVINTNET;
     145AssertCompileMemberAlignment(DRVINTNET, XmitLock, 8);
     146AssertCompileMemberAlignment(DRVINTNET, StatSentGso, 8);
    134147/** Pointer to instance data of the internal networking driver. */
    135148typedef DRVINTNET *PDRVINTNET;
     
    668681    PDRVINTNET pThis = RT_FROM_MEMBER(pInterface, DRVINTNET, IBaseRC);
    669682
    670     PDMIBASERC_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMIBASERC, &pThis->IBaseRC);
     683#ifdef VBOX_WITH_R0_AND_RC_DRIVERS
     684    PDMIBASERC_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMINETWORKUP, &pThis->INetworkUpRC);
     685#endif
    671686    return NIL_RTRCPTR;
    672687}
     
    680695{
    681696    PDRVINTNET pThis = RT_FROM_MEMBER(pInterface, DRVINTNET, IBaseR0);
    682 
    683     PDMIBASER0_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMIBASER0, &pThis->IBaseR0);
     697#ifdef VBOX_WITH_R0_AND_RC_DRIVERS
     698    PDMIBASER0_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMINETWORKUP, &pThis->INetworkUpR0);
     699#endif
    684700    return NIL_RTR0PTR;
    685701}
     
    888904     * Wait for the thread to terminate.
    889905     */
    890     if (pThis->Thread != NIL_RTTHREAD)
     906    if (pThis->hRxThread != NIL_RTTHREAD)
    891907    {
    892908        if (hEvtSuspended != NIL_RTSEMEVENT)
    893909            RTSemEventSignal(hEvtSuspended);
    894         int rc = RTThreadWait(pThis->Thread, 5000, NULL);
     910        int rc = RTThreadWait(pThis->hRxThread, 5000, NULL);
    895911        AssertRC(rc);
    896         pThis->Thread = NIL_RTTHREAD;
     912        pThis->hRxThread = NIL_RTTHREAD;
    897913    }
    898914
     
    950966    pThis->pDrvInsR3                                = pDrvIns;
    951967    pThis->hIf                                      = INTNET_HANDLE_INVALID;
    952     pThis->Thread                                   = NIL_RTTHREAD;
     968    pThis->hRxThread                                = NIL_RTTHREAD;
    953969    pThis->hEvtSuspended                            = NIL_RTSEMEVENT;
    954970    pThis->hSgCache                                 = NIL_RTMEMCACHE;
     
    12761292     * Note! Using a PDM thread here doesn't fit with the IsService=true operation.
    12771293     */
    1278     rc = RTThreadCreate(&pThis->Thread, drvR3IntNetAsyncIoThread, pThis, _128K, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "INTNET");
     1294    rc = RTThreadCreate(&pThis->hRxThread, drvR3IntNetAsyncIoThread, pThis, _128K, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "INTNET");
    12791295    if (RT_FAILURE(rc))
    12801296    {
Note: See TracChangeset for help on using the changeset viewer.

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