VirtualBox

Changeset 81696 in vbox


Ignore:
Timestamp:
Nov 6, 2019 1:48:57 AM (5 years ago)
Author:
vboxsync
Message:

DevVirtioNet.cpp: Some cleanups prepping for refactoring to new PDM device style. bugref:9218

File:
1 edited

Legend:

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

    r81591 r81696  
    5050#ifdef IN_RING3
    5151
    52 #define VNET_PCI_CLASS               0x0200
    53 #define VNET_N_QUEUES                3
    54 #define VNET_NAME_FMT                "VNet%d"
    55 
    56 #if 0
     52# define VNET_PCI_CLASS              0x0200
     53# define VNET_N_QUEUES               3
     54# define VNET_NAME_FMT               "VNet%d"
     55
     56# if 0
    5757/* Virtio Block Device */
    58 #define VNET_PCI_CLASS               0x0180
    59 #define VNET_N_QUEUES                2
    60 #define VNET_NAME_FMT                "VBlk%d"
    61 #endif
     58#  define VNET_PCI_CLASS             0x0180
     59#  define VNET_N_QUEUES              2
     60#  define VNET_NAME_FMT              "VBlk%d"
     61# endif
    6262
    6363#endif /* IN_RING3 */
     
    213213    STAMCOUNTER             StatTransmitGSO;
    214214    STAMCOUNTER             StatTransmitCSum;
    215 #if defined(VBOX_WITH_STATISTICS)
     215#ifdef VBOX_WITH_STATISTICS
    216216    STAMPROFILE             StatReceive;
    217217    STAMPROFILE             StatReceiveStore;
     
    222222    STAMCOUNTER             StatTransmitByNetwork;
    223223    STAMCOUNTER             StatTransmitByThread;
    224 #endif /* VBOX_WITH_STATISTICS */
     224#endif
    225225    /** @}  */
    226226} VNETSTATE;
     
    278278
    279279
    280 struct VNetCtlHdr
     280typedef struct VNetCtlHdr
    281281{
    282282    uint8_t  u8Class;
    283283    uint8_t  u8Command;
    284 };
    285 typedef struct VNetCtlHdr VNETCTLHDR;
     284} VNETCTLHDR;
     285AssertCompileSize(VNETCTLHDR, 2);
    286286typedef VNETCTLHDR *PVNETCTLHDR;
    287 AssertCompileSize(VNETCTLHDR, 2);
     287
     288
    288289
    289290#ifdef IN_RING3
    290291
    291292/** Returns true if large packets are written into several RX buffers. */
    292 DECLINLINE(bool) vnetMergeableRxBuffers(PVNETSTATE pThis)
     293DECLINLINE(bool) vnetR3MergeableRxBuffers(PVNETSTATE pThis)
    293294{
    294295    return !!(pThis->VPCI.uGuestFeatures & VNET_F_MRG_RXBUF);
    295296}
    296297
    297 DECLINLINE(int) vnetCsEnter(PVNETSTATE pThis, int rcBusy)
     298DECLINLINE(int) vnetR3CsEnter(PVNETSTATE pThis, int rcBusy)
    298299{
    299300    return vpciCsEnter(&pThis->VPCI, rcBusy);
    300301}
    301302
    302 DECLINLINE(void) vnetCsLeave(PVNETSTATE pThis)
     303DECLINLINE(void) vnetR3CsLeave(PVNETSTATE pThis)
    303304{
    304305    vpciCsLeave(&pThis->VPCI);
     
    333334 * @param   pszText     A string denoting direction of packet transfer.
    334335 */
    335 DECLINLINE(void) vnetPacketDump(PVNETSTATE pThis, const uint8_t *pbPacket, size_t cb, const char *pszText)
     336DECLINLINE(void) vnetR3PacketDump(PVNETSTATE pThis, const uint8_t *pbPacket, size_t cb, const char *pszText)
    336337{
    337338# ifdef DEBUG
     
    358359DECLINLINE(void) vnetPrintFeatures(PVNETSTATE pThis, uint32_t fFeatures, const char *pcszText)
    359360{
    360 #ifdef DEBUG
     361#ifdef LOG_ENABLED
    361362    static struct
    362363    {
    363         uint32_t uMask;
     364        uint32_t fMask;
    364365        const char *pcszDesc;
    365366    } const s_aFeatures[] =
     
    387388    for (unsigned i = 0; i < RT_ELEMENTS(s_aFeatures); ++i)
    388389    {
    389         if (s_aFeatures[i].uMask & fFeatures)
     390        if (s_aFeatures[i].fMask & fFeatures)
    390391            Log3(("%s --> %s\n", INSTANCE(pThis), s_aFeatures[i].pcszDesc));
    391392    }
    392 #else  /* !DEBUG */
     393#else  /* !LOG_ENABLED */
    393394    RT_NOREF3(pThis, fFeatures, pcszText);
    394 #endif /* !DEBUG */
     395#endif /* !LOG_ENABLED */
    395396}
    396397
     
    408409     */
    409410    return VNET_F_MAC
    410         | VNET_F_STATUS
    411         | VNET_F_CTRL_VQ
    412         | VNET_F_CTRL_RX
    413         | VNET_F_CTRL_VLAN
     411         | VNET_F_STATUS
     412         | VNET_F_CTRL_VQ
     413         | VNET_F_CTRL_RX
     414         | VNET_F_CTRL_VLAN
    414415#ifdef VNET_WITH_GSO
    415         | VNET_F_CSUM
    416         | VNET_F_HOST_TSO4
    417         | VNET_F_HOST_TSO6
    418         | VNET_F_HOST_UFO
    419         | VNET_F_GUEST_CSUM   /* We expect the guest to accept partial TCP checksums (see @bugref{4796}) */
    420         | VNET_F_GUEST_TSO4
    421         | VNET_F_GUEST_TSO6
    422         | VNET_F_GUEST_UFO
     416         | VNET_F_CSUM
     417         | VNET_F_HOST_TSO4
     418         | VNET_F_HOST_TSO6
     419         | VNET_F_HOST_UFO
     420         | VNET_F_GUEST_CSUM   /* We expect the guest to accept partial TCP checksums (see @bugref{4796}) */
     421         | VNET_F_GUEST_TSO4
     422         | VNET_F_GUEST_TSO6
     423         | VNET_F_GUEST_UFO
    423424#endif
    424425#ifdef VNET_WITH_MERGEABLE_RX_BUFS
    425         | VNET_F_MRG_RXBUF
     426         | VNET_F_MRG_RXBUF
    426427#endif
    427         ;
     428         ;
    428429}
    429430
     
    519520 * Wakeup the RX thread.
    520521 */
    521 static void vnetWakeupReceive(PPDMDEVINS pDevIns)
     522static void vnetR3WakeupReceive(PPDMDEVINS pDevIns)
    522523{
    523524    PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
     
    542543 * Helper function that raises an interrupt if the guest is ready to receive it.
    543544 */
    544 int vnetRaiseInterrupt(PVNETSTATE pThis, int rcBusy, uint8_t u8IntCause)
     545static int vnetR3RaiseInterrupt(PVNETSTATE pThis, int rcBusy, uint8_t u8IntCause)
    545546{
    546547    if (pThis->VPCI.uStatus & VPCI_STATUS_DRV_OK)
     
    561562 * @param  pThis        The Virtual I/O network device state.
    562563 */
    563 static void vnetTempLinkDown(PVNETSTATE pThis)
     564static void vnetR3TempLinkDown(PVNETSTATE pThis)
    564565{
    565566    if (STATUS & VNET_S_LINK_UP)
    566567    {
    567568        STATUS &= ~VNET_S_LINK_UP;
    568         vnetRaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
     569        vnetR3RaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
    569570        /* Restore the link back in 5 seconds. */
    570571        int rc = TMTimerSetMillies(pThis->pLinkUpTimer, pThis->cMsLinkUpDelay);
    571572        AssertRC(rc);
    572         Log(("%s vnetTempLinkDown: Link is down temporarily\n", INSTANCE(pThis)));
     573        Log(("%s vnetR3TempLinkDown: Link is down temporarily\n", INSTANCE(pThis)));
    573574    }
    574575}
     
    578579 * @callback_method_impl{FNTMTIMERDEV, Link Up Timer handler.}
    579580 */
    580 static DECLCALLBACK(void) vnetLinkUpTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     581static DECLCALLBACK(void) vnetR3LinkUpTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    581582{
    582583    RT_NOREF(pTimer);
    583584    PVNETSTATE pThis = (PVNETSTATE)pvUser;
    584585
    585     int rc = vnetCsEnter(pThis, VERR_SEM_BUSY);
     586    int rc = vnetR3CsEnter(pThis, VERR_SEM_BUSY);
    586587    if (RT_UNLIKELY(rc != VINF_SUCCESS))
    587588        return;
    588589    STATUS |= VNET_S_LINK_UP;
    589     vnetRaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
    590     vnetWakeupReceive(pDevIns);
    591     vnetCsLeave(pThis);
    592     Log(("%s vnetLinkUpTimer: Link is up\n", INSTANCE(pThis)));
     590    vnetR3RaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
     591    vnetR3WakeupReceive(pDevIns);
     592    vnetR3CsLeave(pThis);
     593    Log(("%s vnetR3LinkUpTimer: Link is up\n", INSTANCE(pThis)));
    593594    if (pThis->pDrv)
    594595        pThis->pDrv->pfnNotifyLinkChanged(pThis->pDrv, PDMNETWORKLINKSTATE_UP);
     
    599600 * @callback_method_impl{FNPDMQUEUEDEV, Handler for the wakeup signaller queue.}
    600601 */
    601 static DECLCALLBACK(bool) vnetCanRxQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem)
     602static DECLCALLBACK(bool) vnetR3CanRxQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem)
    602603{
    603604    RT_NOREF(pItem);
    604     vnetWakeupReceive(pDevIns);
     605    vnetR3WakeupReceive(pDevIns);
    605606    return true;
    606607}
     
    625626 */
    626627#ifdef IN_RING3
    627     vnetWakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns));
     628    vnetR3WakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns));
    628629#else
    629630    PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pCanRxQueue));
     
    681682 * @thread  RX
    682683 */
    683 static int vnetCanReceive(PVNETSTATE pThis)
     684static int vnetR3CanReceive(PVNETSTATE pThis)
    684685{
    685686    int rc = vnetCsRxEnter(pThis, VERR_SEM_BUSY);
    686687    AssertRCReturn(rc, rc);
    687688
    688     LogFlow(("%s vnetCanReceive\n", INSTANCE(pThis)));
     689    LogFlow(("%s vnetR3CanReceive\n", INSTANCE(pThis)));
    689690    if (!(pThis->VPCI.uStatus & VPCI_STATUS_DRV_OK))
    690691        rc = VERR_NET_NO_BUFFER_SPACE;
     
    702703    }
    703704
    704     LogFlow(("%s vnetCanReceive -> %Rrc\n", INSTANCE(pThis), rc));
     705    LogFlow(("%s vnetR3CanReceive -> %Rrc\n", INSTANCE(pThis), rc));
    705706    vnetCsRxLeave(pThis);
    706707    return rc;
     
    710711 * @interface_method_impl{PDMINETWORKDOWN,pfnWaitReceiveAvail}
    711712 */
    712 static DECLCALLBACK(int) vnetNetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies)
     713static DECLCALLBACK(int) vnetR3NetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies)
    713714{
    714715    PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkDown);
    715     LogFlow(("%s vnetNetworkDown_WaitReceiveAvail(cMillies=%u)\n", INSTANCE(pThis), cMillies));
    716     int rc = vnetCanReceive(pThis);
     716    LogFlow(("%s vnetR3NetworkDown_WaitReceiveAvail(cMillies=%u)\n", INSTANCE(pThis), cMillies));
     717    int rc = vnetR3CanReceive(pThis);
    717718
    718719    if (RT_SUCCESS(rc))
     
    729730                     ||  enmVMState == VMSTATE_RUNNING_LS))
    730731    {
    731         int rc2 = vnetCanReceive(pThis);
     732        int rc2 = vnetR3CanReceive(pThis);
    732733        if (RT_SUCCESS(rc2))
    733734        {
     
    735736            break;
    736737        }
    737         Log(("%s vnetNetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", INSTANCE(pThis), cMillies));
     738        Log(("%s vnetR3NetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", INSTANCE(pThis), cMillies));
    738739        RTSemEventWait(pThis->hEventMoreRxDescAvail, cMillies);
    739740    }
     
    741742    ASMAtomicXchgBool(&pThis->fMaybeOutOfSpace, false);
    742743
    743     LogFlow(("%s vnetNetworkDown_WaitReceiveAvail -> %d\n", INSTANCE(pThis), rc));
     744    LogFlow(("%s vnetR3NetworkDown_WaitReceiveAvail -> %d\n", INSTANCE(pThis), rc));
    744745    return rc;
    745746}
     
    765766 * @param   pvBuf           The ethernet packet.
    766767 */
    767 DECLINLINE(bool) vnetIsBroadcast(const void *pvBuf)
     768DECLINLINE(bool) vnetR3IsBroadcast(const void *pvBuf)
    768769{
    769770    static const uint8_t s_abBcastAddr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
     
    778779 * @param   pvBuf           The ethernet packet.
    779780 */
    780 DECLINLINE(bool) vnetIsMulticast(const void *pvBuf)
     781DECLINLINE(bool) vnetR3IsMulticast(const void *pvBuf)
    781782{
    782783    return (*(char*)pvBuf) & 1;
     
    791792 * @param   cb              Number of bytes available in the packet.
    792793 */
    793 static bool vnetAddressFilter(PVNETSTATE pThis, const void *pvBuf, size_t cb)
     794static bool vnetR3AddressFilter(PVNETSTATE pThis, const void *pvBuf, size_t cb)
    794795{
    795796    if (pThis->fPromiscuous)
     
    802803        && !ASMBitTest(pThis->aVlanFilter, RT_BE2H_U16(u16Ptr[7]) & 0xFFF))
    803804    {
    804         Log4(("%s vnetAddressFilter: not our VLAN, returning false\n", INSTANCE(pThis)));
     805        Log4(("%s vnetR3AddressFilter: not our VLAN, returning false\n", INSTANCE(pThis)));
    805806        return false;
    806807    }
    807808
    808     if (vnetIsBroadcast(pvBuf))
     809    if (vnetR3IsBroadcast(pvBuf))
    809810        return true;
    810811
    811     if (pThis->fAllMulti && vnetIsMulticast(pvBuf))
     812    if (pThis->fAllMulti && vnetR3IsMulticast(pvBuf))
    812813        return true;
    813814
    814815    if (!memcmp(pThis->config.mac.au8, pvBuf, sizeof(RTMAC)))
    815816        return true;
    816     Log4(("%s vnetAddressFilter: %RTmac (conf) != %RTmac (dest)\n", INSTANCE(pThis), pThis->config.mac.au8, pvBuf));
     817    Log4(("%s vnetR3AddressFilter: %RTmac (conf) != %RTmac (dest)\n", INSTANCE(pThis), pThis->config.mac.au8, pvBuf));
    817818
    818819    for (unsigned i = 0; i < pThis->nMacFilterEntries; i++)
     
    820821            return true;
    821822
    822     Log2(("%s vnetAddressFilter: failed all tests, returning false, packet dump follows:\n", INSTANCE(pThis)));
    823     vnetPacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
     823    Log2(("%s vnetR3AddressFilter: failed all tests, returning false, packet dump follows:\n", INSTANCE(pThis)));
     824    vnetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
    824825
    825826    return false;
     
    838839 * @thread  RX
    839840 */
    840 static int vnetHandleRxPacket(PVNETSTATE pThis, const void *pvBuf, size_t cb,
    841                               PCPDMNETWORKGSO pGso)
    842 {
    843     VNETHDRMRX   Hdr;
    844     unsigned    uHdrLen;
    845     RTGCPHYS     addrHdrMrx = 0;
     841static int vnetR3HandleRxPacket(PVNETSTATE pThis, const void *pvBuf, size_t cb, PCPDMNETWORKGSO pGso)
     842{
     843    VNETHDRMRX  Hdr;
     844    unsigned    cbHdr;
     845    RTGCPHYS    addrHdrMrx = 0;
    846846
    847847    if (pGso)
    848848    {
    849         Log2(("%s vnetHandleRxPacket: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",
     849        Log2(("%s vnetR3HandleRxPacket: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",
    850850              INSTANCE(pThis), pGso->u8Type, pGso->cbHdrsTotal, pGso->cbHdrsSeg, pGso->cbMaxSeg, pGso->offHdr1, pGso->offHdr2));
    851851        Hdr.Hdr.u8Flags = VNETHDR_F_NEEDS_CSUM;
     
    878878    }
    879879
    880     if (vnetMergeableRxBuffers(pThis))
    881         uHdrLen = sizeof(VNETHDRMRX);
     880    if (vnetR3MergeableRxBuffers(pThis))
     881        cbHdr = sizeof(VNETHDRMRX);
    882882    else
    883         uHdrLen = sizeof(VNETHDR);
    884 
    885     vnetPacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
     883        cbHdr = sizeof(VNETHDR);
     884
     885    vnetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
    886886
    887887    unsigned int uOffset = 0;
     
    898898             * were added and we received a big packet.
    899899             */
    900             Log(("%s vnetHandleRxPacket: Suddenly there is no space in receive queue!\n", INSTANCE(pThis)));
     900            Log(("%s vnetR3HandleRxPacket: Suddenly there is no space in receive queue!\n", INSTANCE(pThis)));
    901901            return VERR_INTERNAL_ERROR;
    902902        }
     
    904904        if (elem.nIn < 1)
    905905        {
    906             Log(("%s vnetHandleRxPacket: No writable descriptors in receive queue!\n", INSTANCE(pThis)));
     906            Log(("%s vnetR3HandleRxPacket: No writable descriptors in receive queue!\n", INSTANCE(pThis)));
    907907            return VERR_INTERNAL_ERROR;
    908908        }
     
    910910        if (nElem == 0)
    911911        {
    912             if (vnetMergeableRxBuffers(pThis))
     912            if (vnetR3MergeableRxBuffers(pThis))
    913913            {
    914914                addrHdrMrx = elem.aSegsIn[nSeg].addr;
    915                 cbReserved = uHdrLen;
     915                cbReserved = cbHdr;
    916916            }
    917917            else
     
    920920                if (elem.aSegsIn[nSeg].cb != sizeof(VNETHDR))
    921921                {
    922                     Log(("%s vnetHandleRxPacket: The first descriptor does match the header size!\n", INSTANCE(pThis)));
     922                    Log(("%s vnetR3HandleRxPacket: The first descriptor does match the header size!\n", INSTANCE(pThis)));
    923923                    return VERR_INTERNAL_ERROR;
    924924                }
    925925                elem.aSegsIn[nSeg++].pv = &Hdr;
    926926            }
    927             uElemSize += uHdrLen;
     927            uElemSize += cbHdr;
    928928        }
    929929        while (nSeg < elem.nIn && uOffset < cb)
     
    938938        vqueuePut(&pThis->VPCI, pThis->pRxQueue, &elem, uElemSize, cbReserved);
    939939        STAM_PROFILE_STOP(&pThis->StatReceiveStore, a);
    940         if (!vnetMergeableRxBuffers(pThis))
     940        if (!vnetR3MergeableRxBuffers(pThis))
    941941            break;
    942942        cbReserved = 0;
    943943    }
    944     if (vnetMergeableRxBuffers(pThis))
     944    if (vnetR3MergeableRxBuffers(pThis))
    945945    {
    946946        Hdr.u16NumBufs = nElem;
     
    949949        if (RT_FAILURE(rc))
    950950        {
    951             Log(("%s vnetHandleRxPacket: Failed to write merged RX buf header: %Rrc\n", INSTANCE(pThis), rc));
     951            Log(("%s vnetR3HandleRxPacket: Failed to write merged RX buf header: %Rrc\n", INSTANCE(pThis), rc));
    952952            return rc;
    953953        }
     
    956956    if (uOffset < cb)
    957957    {
    958         Log(("%s vnetHandleRxPacket: Packet did not fit into RX queue (packet size=%u)!\n", INSTANCE(pThis), cb));
     958        Log(("%s vnetR3HandleRxPacket: Packet did not fit into RX queue (packet size=%u)!\n", INSTANCE(pThis), cb));
    959959        return VERR_TOO_MUCH_DATA;
    960960    }
     
    966966 * @interface_method_impl{PDMINETWORKDOWN,pfnReceiveGso}
    967967 */
    968 static DECLCALLBACK(int) vnetNetworkDown_ReceiveGso(PPDMINETWORKDOWN pInterface,
     968static DECLCALLBACK(int) vnetR3NetworkDown_ReceiveGso(PPDMINETWORKDOWN pInterface,
    969969                                                    const void *pvBuf, size_t cb,
    970970                                                    PCPDMNETWORKGSO pGso)
     
    994994        if (!uFeatures)
    995995        {
    996             Log2(("%s vnetNetworkDown_ReceiveGso: GSO type (0x%x) not supported\n", INSTANCE(pThis), pGso->u8Type));
     996            Log2(("%s vnetR3NetworkDown_ReceiveGso: GSO type (0x%x) not supported\n", INSTANCE(pThis), pGso->u8Type));
    997997            return VERR_NOT_SUPPORTED;
    998998        }
    999999    }
    10001000
    1001     Log2(("%s vnetNetworkDown_ReceiveGso: pvBuf=%p cb=%u pGso=%p\n", INSTANCE(pThis), pvBuf, cb, pGso));
    1002     int rc = vnetCanReceive(pThis);
     1001    Log2(("%s vnetR3NetworkDown_ReceiveGso: pvBuf=%p cb=%u pGso=%p\n", INSTANCE(pThis), pvBuf, cb, pGso));
     1002    int rc = vnetR3CanReceive(pThis);
    10031003    if (RT_FAILURE(rc))
    10041004        return rc;
     
    10131013    STAM_PROFILE_START(&pThis->StatReceive, a);
    10141014    vpciSetReadLed(&pThis->VPCI, true);
    1015     if (vnetAddressFilter(pThis, pvBuf, cb))
     1015    if (vnetR3AddressFilter(pThis, pvBuf, cb))
    10161016    {
    10171017        rc = vnetCsRxEnter(pThis, VERR_SEM_BUSY);
    10181018        if (RT_SUCCESS(rc))
    10191019        {
    1020             rc = vnetHandleRxPacket(pThis, pvBuf, cb, pGso);
     1020            rc = vnetR3HandleRxPacket(pThis, pvBuf, cb, pGso);
    10211021            STAM_REL_COUNTER_ADD(&pThis->StatReceiveBytes, cb);
    10221022            vnetCsRxLeave(pThis);
     
    10311031 * @interface_method_impl{PDMINETWORKDOWN,pfnReceive}
    10321032 */
    1033 static DECLCALLBACK(int) vnetNetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb)
    1034 {
    1035     return vnetNetworkDown_ReceiveGso(pInterface, pvBuf, cb, NULL);
     1033static DECLCALLBACK(int) vnetR3NetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb)
     1034{
     1035    return vnetR3NetworkDown_ReceiveGso(pInterface, pvBuf, cb, NULL);
    10361036}
    10371037
     
    10441044 * @thread  EMT
    10451045 */
    1046 static DECLCALLBACK(int) vnetGetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac)
     1046static DECLCALLBACK(int) vnetR3NetworkConfig_GetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac)
    10471047{
    10481048    PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkConfig);
     
    10581058 * @thread  EMT
    10591059 */
    1060 static DECLCALLBACK(PDMNETWORKLINKSTATE) vnetGetLinkState(PPDMINETWORKCONFIG pInterface)
     1060static DECLCALLBACK(PDMNETWORKLINKSTATE) vnetR3NetworkConfig_GetLinkState(PPDMINETWORKCONFIG pInterface)
    10611061{
    10621062    PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkConfig);
     
    10741074 * @param   enmState        The new link state
    10751075 */
    1076 static DECLCALLBACK(int) vnetSetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState)
     1076static DECLCALLBACK(int) vnetR3NetworkConfig_SetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState)
    10771077{
    10781078    PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkConfig);
     
    10801080    bool fNewUp = enmState == PDMNETWORKLINKSTATE_UP;
    10811081
    1082     Log(("%s vnetSetLinkState: enmState=%d\n", INSTANCE(pThis), enmState));
     1082    Log(("%s vnetR3NetworkConfig_SetLinkState: enmState=%d\n", INSTANCE(pThis), enmState));
    10831083    if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME)
    10841084    {
     
    10871087            /*
    10881088             * We bother to bring the link down only if it was up previously. The UP link state
    1089              * notification will be sent when the link actually goes up in vnetLinkUpTimer().
     1089             * notification will be sent when the link actually goes up in vnetR3LinkUpTimer().
    10901090             */
    1091             vnetTempLinkDown(pThis);
     1091            vnetR3TempLinkDown(pThis);
    10921092            if (pThis->pDrv)
    10931093                pThis->pDrv->pfnNotifyLinkChanged(pThis->pDrv, enmState);
     
    11011101            pThis->fCableConnected = true;
    11021102            STATUS |= VNET_S_LINK_UP;
    1103             vnetRaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
     1103            vnetR3RaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
    11041104        }
    11051105        else
     
    11101110            pThis->fCableConnected = false;
    11111111            STATUS &= ~VNET_S_LINK_UP;
    1112             vnetRaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
     1112            vnetR3RaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
    11131113        }
    11141114        if (pThis->pDrv)
     
    11181118}
    11191119
    1120 static DECLCALLBACK(void) vnetQueueReceive(void *pvState, PVQUEUE pQueue)
     1120static DECLCALLBACK(void) vnetR3QueueReceive(void *pvState, PVQUEUE pQueue)
    11211121{
    11221122    RT_NOREF(pQueue);
    11231123    PVNETSTATE pThis = (PVNETSTATE)pvState;
    11241124    Log(("%s Receive buffers has been added, waking up receive thread.\n", INSTANCE(pThis)));
    1125     vnetWakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns));
     1125    vnetR3WakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns));
    11261126}
    11271127
     
    11321132 * @param   pCtx                The context descriptor.
    11331133 */
    1134 DECLINLINE(PPDMNETWORKGSO) vnetSetupGsoCtx(PPDMNETWORKGSO pGso, VNETHDR const *pHdr)
     1134DECLINLINE(PPDMNETWORKGSO) vnetR3SetupGsoCtx(PPDMNETWORKGSO pGso, VNETHDR const *pHdr)
    11351135{
    11361136    pGso->u8Type = PDMNETWORKGSOTYPE_INVALID;
     
    11711171}
    11721172
    1173 DECLINLINE(uint16_t) vnetCSum16(const void *pvBuf, size_t cb)
     1173DECLINLINE(uint16_t) vnetR3CSum16(const void *pvBuf, size_t cb)
    11741174{
    11751175    uint32_t  csum = 0;
     
    11881188}
    11891189
    1190 DECLINLINE(void) vnetCompleteChecksum(uint8_t *pBuf, size_t cbSize, uint16_t uStart, uint16_t uOffset)
     1190DECLINLINE(void) vnetR3CompleteChecksum(uint8_t *pBuf, size_t cbSize, uint16_t uStart, uint16_t uOffset)
    11911191{
    11921192    AssertReturnVoid(uStart < cbSize);
    11931193    AssertReturnVoid(uStart + uOffset + sizeof(uint16_t) <= cbSize);
    1194     *(uint16_t*)(pBuf + uStart + uOffset) = vnetCSum16(pBuf + uStart, cbSize - uStart);
    1195 }
    1196 
    1197 static bool vnetReadHeader(PVNETSTATE pThis, RTGCPHYS GCPhys, PVNETHDR pHdr, uint32_t cbMax)
    1198 {
    1199     int rc = PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns), GCPhys, pHdr, sizeof(*pHdr));
     1194    *(uint16_t*)(pBuf + uStart + uOffset) = vnetR3CSum16(pBuf + uStart, cbSize - uStart);
     1195}
     1196
     1197static bool vnetR3ReadHeader(PVNETSTATE pThis, RTGCPHYS GCPhys, PVNETHDR pHdr, uint32_t cbMax)
     1198{
     1199    int rc = PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns), GCPhys, pHdr, sizeof(*pHdr)); /** @todo r=bird: Why not PDMDevHlpPCIPhysRead? */
    12001200    if (RT_FAILURE(rc))
    12011201        return false;
     
    12381238}
    12391239
    1240 static int vnetTransmitFrame(PVNETSTATE pThis, PPDMSCATTERGATHER pSgBuf, PPDMNETWORKGSO pGso, PVNETHDR pHdr)
    1241 {
    1242     vnetPacketDump(pThis, (uint8_t *)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, "--> Outgoing");
     1240static int vnetR3TransmitFrame(PVNETSTATE pThis, PPDMSCATTERGATHER pSgBuf, PPDMNETWORKGSO pGso, PVNETHDR pHdr)
     1241{
     1242    vnetR3PacketDump(pThis, (uint8_t *)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, "--> Outgoing");
    12431243    if (pGso)
    12441244    {
     
    12501250        //if (pGso->cbHdrs < pHdr->u16CSumStart + pHdr->u16CSumOffset + 2)
    12511251        {
    1252             Log4(("%s vnetTransmitPendingPackets: HdrLen before adjustment %d.\n",
     1252            Log4(("%s vnetR3TransmitPendingPackets: HdrLen before adjustment %d.\n",
    12531253                  INSTANCE(pThis), pGso->cbHdrsTotal));
    12541254            switch (pGso->u8Type)
     
    12681268            ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsTotal = pGso->cbHdrsTotal;
    12691269            ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsSeg   = pGso->cbHdrsSeg;
    1270             Log4(("%s vnetTransmitPendingPackets: adjusted HdrLen to %d.\n",
     1270            Log4(("%s vnetR3TransmitPendingPackets: adjusted HdrLen to %d.\n",
    12711271                  INSTANCE(pThis), pGso->cbHdrsTotal));
    12721272        }
    1273         Log2(("%s vnetTransmitPendingPackets: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",
     1273        Log2(("%s vnetR3TransmitPendingPackets: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",
    12741274              INSTANCE(pThis), pGso->u8Type, pGso->cbHdrsTotal, pGso->cbHdrsSeg, pGso->cbMaxSeg, pGso->offHdr1, pGso->offHdr2));
    12751275        STAM_REL_COUNTER_INC(&pThis->StatTransmitGSO);
     
    12811281         * This is not GSO frame but checksum offloading is requested.
    12821282         */
    1283         vnetCompleteChecksum((uint8_t*)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed,
     1283        vnetR3CompleteChecksum((uint8_t*)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed,
    12841284                             pHdr->u16CSumStart, pHdr->u16CSumOffset);
    12851285    }
     
    12881288}
    12891289
    1290 static void vnetTransmitPendingPackets(PVNETSTATE pThis, PVQUEUE pQueue, bool fOnWorkerThread)
     1290static void vnetR3TransmitPendingPackets(PVNETSTATE pThis, PVQUEUE pQueue, bool fOnWorkerThread)
    12911291{
    12921292    /*
     
    13221322    }
    13231323
    1324     unsigned int uHdrLen;
    1325     if (vnetMergeableRxBuffers(pThis))
    1326         uHdrLen = sizeof(VNETHDRMRX);
     1324    unsigned int cbHdr;
     1325    if (vnetR3MergeableRxBuffers(pThis))
     1326        cbHdr = sizeof(VNETHDRMRX);
    13271327    else
    1328         uHdrLen = sizeof(VNETHDR);
    1329 
    1330     Log3(("%s vnetTransmitPendingPackets: About to transmit %d pending packets\n",
     1328        cbHdr = sizeof(VNETHDR);
     1329
     1330    Log3(("%s vnetR3TransmitPendingPackets: About to transmit %d pending packets\n",
    13311331          INSTANCE(pThis), vringReadAvailIndex(&pThis->VPCI, &pThis->pTxQueue->VRing) - pThis->pTxQueue->uNextAvailIndex));
    13321332
     
    13411341    {
    13421342        unsigned int uOffset = 0;
    1343         if (elem.nOut < 2 || elem.aSegsOut[0].cb != uHdrLen)
    1344         {
    1345             Log(("%s vnetQueueTransmit: The first segment is not the header! (%u < 2 || %u != %u).\n",
    1346                  INSTANCE(pThis), elem.nOut, elem.aSegsOut[0].cb, uHdrLen));
     1343        if (elem.nOut < 2 || elem.aSegsOut[0].cb != cbHdr)
     1344        {
     1345            Log(("%s vnetR3QueueTransmit: The first segment is not the header! (%u < 2 || %u != %u).\n",
     1346                 INSTANCE(pThis), elem.nOut, elem.aSegsOut[0].cb, cbHdr));
    13471347            break; /* For now we simply ignore the header, but it must be there anyway! */
    13481348        }
     
    13561356        for (unsigned int i = 1; i < elem.nOut && uSize < VNET_MAX_FRAME_SIZE; i++)
    13571357            uSize += elem.aSegsOut[i].cb;
    1358         Log5(("%s vnetTransmitPendingPackets: complete frame is %u bytes.\n", INSTANCE(pThis), uSize));
     1358        Log5(("%s vnetR3TransmitPendingPackets: complete frame is %u bytes.\n", INSTANCE(pThis), uSize));
    13591359        Assert(uSize <= VNET_MAX_FRAME_SIZE);
    13601360
     
    13621362        if (uSize > VNET_MAX_FRAME_SIZE)
    13631363            uSize = VNET_MAX_FRAME_SIZE;
    1364         if (pThis->pDrv && vnetReadHeader(pThis, elem.aSegsOut[0].addr, &Hdr, uSize))
     1364        if (pThis->pDrv && vnetR3ReadHeader(pThis, elem.aSegsOut[0].addr, &Hdr, uSize))
    13651365        {
    13661366            RT_UNTRUSTED_VALIDATED_FENCE();
     
    13691369
    13701370            PDMNETWORKGSO Gso;
    1371             PDMNETWORKGSO *pGso = vnetSetupGsoCtx(&Gso, &Hdr);
     1371            PDMNETWORKGSO *pGso = vnetR3SetupGsoCtx(&Gso, &Hdr);
    13721372
    13731373            /** @todo Optimize away the extra copying! (lazy bird) */
     
    13891389                    uSize -= cbSegment;
    13901390                }
    1391                 rc = vnetTransmitFrame(pThis, pSgBuf, pGso, &Hdr);
     1391                rc = vnetR3TransmitFrame(pThis, pSgBuf, pGso, &Hdr);
    13921392            }
    13931393            else
     
    14201420 * @interface_method_impl{PDMINETWORKDOWN,pfnXmitPending}
    14211421 */
    1422 static DECLCALLBACK(void) vnetNetworkDown_XmitPending(PPDMINETWORKDOWN pInterface)
     1422static DECLCALLBACK(void) vnetR3NetworkDown_XmitPending(PPDMINETWORKDOWN pInterface)
    14231423{
    14241424    PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkDown);
    1425 #if defined(VBOX_WITH_STATISTICS)
    1426     STAM_REL_COUNTER_INC(&pThis->StatTransmitByNetwork);
    1427 #endif /* VBOX_WITH_STATISTICS */
    1428     vnetTransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/);
    1429 }
    1430 
    1431 #ifdef VNET_TX_DELAY
    1432 
    1433 static DECLCALLBACK(void) vnetQueueTransmit(void *pvState, PVQUEUE pQueue)
     1425    STAM_COUNTER_INC(&pThis->StatTransmitByNetwork);
     1426    vnetR3TransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/);
     1427}
     1428
     1429# ifdef VNET_TX_DELAY
     1430
     1431static DECLCALLBACK(void) vnetR3QueueTransmit(void *pvState, PVQUEUE pQueue)
    14341432{
    14351433    PVNETSTATE pThis = (PVNETSTATE)pvState;
     
    14381436    {
    14391437        TMTimerStop(pThis->CTX_SUFF(pTxTimer));
    1440         Log3(("%s vnetQueueTransmit: Got kicked with notification disabled, re-enable notification and flush TX queue\n", INSTANCE(pThis)));
    1441         vnetTransmitPendingPackets(pThis, pQueue, false /*fOnWorkerThread*/);
    1442         if (RT_FAILURE(vnetCsEnter(pThis, VERR_SEM_BUSY)))
    1443             LogRel(("vnetQueueTransmit: Failed to enter critical section!/n"));
     1438        Log3(("%s vnetR3QueueTransmit: Got kicked with notification disabled, re-enable notification and flush TX queue\n", INSTANCE(pThis)));
     1439        vnetR3TransmitPendingPackets(pThis, pQueue, false /*fOnWorkerThread*/);
     1440        if (RT_FAILURE(vnetR3CsEnter(pThis, VERR_SEM_BUSY)))
     1441            LogRel(("vnetR3QueueTransmit: Failed to enter critical section!/n"));
    14441442        else
    14451443        {
    14461444            vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, true);
    1447             vnetCsLeave(pThis);
     1445            vnetR3CsLeave(pThis);
    14481446        }
    14491447    }
    14501448    else
    14511449    {
    1452         if (RT_FAILURE(vnetCsEnter(pThis, VERR_SEM_BUSY)))
    1453             LogRel(("vnetQueueTransmit: Failed to enter critical section!/n"));
     1450        if (RT_FAILURE(vnetR3CsEnter(pThis, VERR_SEM_BUSY)))
     1451            LogRel(("vnetR3QueueTransmit: Failed to enter critical section!/n"));
    14541452        else
    14551453        {
     
    14571455            TMTimerSetMicro(pThis->CTX_SUFF(pTxTimer), VNET_TX_DELAY);
    14581456            pThis->u64NanoTS = RTTimeNanoTS();
    1459             vnetCsLeave(pThis);
     1457            vnetR3CsLeave(pThis);
    14601458        }
    14611459    }
     
    14651463 * @callback_method_impl{FNTMTIMERDEV, Transmit Delay Timer handler.}
    14661464 */
    1467 static DECLCALLBACK(void) vnetTxTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     1465static DECLCALLBACK(void) vnetR3TxTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    14681466{
    14691467    RT_NOREF(pDevIns, pTimer);
     
    14771475    pThis->u32AvgDiff = (pThis->u32AvgDiff * pThis->u32i + u32MicroDiff) / (pThis->u32i + 1);
    14781476    pThis->u32i++;
    1479     Log3(("vnetTxTimer: Expired, diff %9d usec, avg %9d usec, min %9d usec, max %9d usec\n",
     1477    Log3(("vnetR3TxTimer: Expired, diff %9d usec, avg %9d usec, min %9d usec, max %9d usec\n",
    14801478          u32MicroDiff, pThis->u32AvgDiff, pThis->u32MinDiff, pThis->u32MaxDiff));
    14811479
    1482 //    Log3(("%s vnetTxTimer: Expired\n", INSTANCE(pThis)));
    1483     vnetTransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/);
    1484     if (RT_FAILURE(vnetCsEnter(pThis, VERR_SEM_BUSY)))
    1485     {
    1486         LogRel(("vnetTxTimer: Failed to enter critical section!/n"));
     1480//    Log3(("%s vnetR3TxTimer: Expired\n", INSTANCE(pThis)));
     1481    vnetR3TransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/);
     1482    if (RT_FAILURE(vnetR3CsEnter(pThis, VERR_SEM_BUSY)))
     1483    {
     1484        LogRel(("vnetR3TxTimer: Failed to enter critical section!/n"));
    14871485        return;
    14881486    }
    14891487    vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, true);
    1490     vnetCsLeave(pThis);
    1491 }
    1492 
    1493 inline int vnetCreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis)
     1488    vnetR3CsLeave(pThis);
     1489}
     1490
     1491DECLINLINE(int) vnetR3CreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis)
    14941492{
    14951493    RT_NOREF(pDevIns, pThis);
     
    14971495}
    14981496
    1499 inline void vnetDestroyTxThreadAndEvent(PVNETSTATE pThis)
     1497DECLINLINE(void) vnetR3DestroyTxThreadAndEvent(PVNETSTATE pThis)
    15001498{
    15011499    RT_NOREF(pThis);
    15021500}
    1503 #else /* !VNET_TX_DELAY */
    1504 
    1505 static DECLCALLBACK(int) vnetTxThread(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
     1501
     1502# else /* !VNET_TX_DELAY */
     1503
     1504static DECLCALLBACK(int) vnetR3TxThread(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
    15061505{
    15071506    RT_NOREF(pDevIns);
     
    15171516        if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING))
    15181517            break;
    1519 #if defined(VBOX_WITH_STATISTICS)
    1520         STAM_REL_COUNTER_INC(&pThis->StatTransmitByThread);
    1521 #endif /* VBOX_WITH_STATISTICS */
     1518        STAM_COUNTER_INC(&pThis->StatTransmitByThread);
    15221519        while (true)
    15231520        {
    1524             vnetTransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); /// @todo shouldn't it be true instead?
    1525             Log(("vnetTxThread: enable kicking and get to sleep\n"));
     1521            vnetR3TransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); /// @todo shouldn't it be true instead?
     1522            Log(("vnetR3TxThread: enable kicking and get to sleep\n"));
    15261523            vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, true);
    15271524            if (vqueueIsEmpty(&pThis->VPCI, pThis->pTxQueue))
     
    15481545}
    15491546
    1550 static int vnetCreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis)
     1547static int vnetR3CreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis)
    15511548{
    15521549    int rc = SUPSemEventCreate(pThis->pSupDrvSession, &pThis->hTxEvent);
     
    15541551        return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    15551552                                   N_("VNET: Failed to create SUP event semaphore"));
    1556     rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pTxThread, pThis, vnetTxThread,
     1553    rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pTxThread, pThis, vnetR3TxThread,
    15571554                               vnetTxThreadWakeUp, 0, RTTHREADTYPE_IO, INSTANCE(pThis));
    15581555    if (RT_FAILURE(rc))
     
    15621559}
    15631560
    1564 static void vnetDestroyTxThreadAndEvent(PVNETSTATE pThis)
     1561static void vnetR3DestroyTxThreadAndEvent(PVNETSTATE pThis)
    15651562{
    15661563    if (pThis->pTxThread)
     
    15801577}
    15811578
    1582 static DECLCALLBACK(void) vnetQueueTransmit(void *pvState, PVQUEUE pQueue)
     1579static DECLCALLBACK(void) vnetR3QueueTransmit(void *pvState, PVQUEUE pQueue)
    15831580{
    15841581    PVNETSTATE pThis = (PVNETSTATE)pvState;
    15851582
    1586     Log(("vnetQueueTransmit: disable kicking and wake up TX thread\n"));
     1583    Log(("vnetR3QueueTransmit: disable kicking and wake up TX thread\n"));
    15871584    vringSetNotification(&pThis->VPCI, &pQueue->VRing, false);
    15881585    SUPSemEventSignal(pThis->pSupDrvSession, pThis->hTxEvent);
    15891586}
    15901587
    1591 #endif /* !VNET_TX_DELAY */
    1592 
    1593 static uint8_t vnetControlRx(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)
     1588# endif /* !VNET_TX_DELAY */
     1589
     1590static uint8_t vnetR3ControlRx(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)
    15941591{
    15951592    uint8_t u8Ack = VNET_OK;
     
    15981595                      pElem->aSegsOut[1].addr,
    15991596                      &fOn, sizeof(fOn));
    1600     Log(("%s vnetControlRx: uCommand=%u fOn=%u\n", INSTANCE(pThis), pCtlHdr->u8Command, fOn));
     1597    Log(("%s vnetR3ControlRx: uCommand=%u fOn=%u\n", INSTANCE(pThis), pCtlHdr->u8Command, fOn));
    16011598    switch (pCtlHdr->u8Command)
    16021599    {
     
    16171614}
    16181615
    1619 static uint8_t vnetControlMac(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)
     1616static uint8_t vnetR3ControlMac(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)
    16201617{
    16211618    uint32_t nMacs = 0;
     
    16261623        || pElem->aSegsOut[2].cb < sizeof(nMacs))
    16271624    {
    1628         Log(("%s vnetControlMac: Segment layout is wrong (u8Command=%u nOut=%u cb1=%u cb2=%u)\n",
     1625        Log(("%s vnetR3ControlMac: Segment layout is wrong (u8Command=%u nOut=%u cb1=%u cb2=%u)\n",
    16291626             INSTANCE(pThis), pCtlHdr->u8Command, pElem->nOut, pElem->aSegsOut[1].cb, pElem->aSegsOut[2].cb));
    16301627        return VNET_ERROR;
     
    16381635    if (pElem->aSegsOut[1].cb < nMacs * sizeof(RTMAC) + sizeof(nMacs))
    16391636    {
    1640         Log(("%s vnetControlMac: The unicast mac segment is too small (nMacs=%u cb=%u)\n",
     1637        Log(("%s vnetR3ControlMac: The unicast mac segment is too small (nMacs=%u cb=%u)\n",
    16411638             INSTANCE(pThis), nMacs, pElem->aSegsOut[1].cb));
    16421639        return VNET_ERROR;
     
    16451642    if (nMacs > VNET_MAC_FILTER_LEN)
    16461643    {
    1647         Log(("%s vnetControlMac: MAC table is too big, have to use promiscuous mode (nMacs=%u)\n", INSTANCE(pThis), nMacs));
     1644        Log(("%s vnetR3ControlMac: MAC table is too big, have to use promiscuous mode (nMacs=%u)\n", INSTANCE(pThis), nMacs));
    16481645        pThis->fPromiscuous = true;
    16491646    }
     
    16561653        pThis->nMacFilterEntries = nMacs;
    16571654#ifdef DEBUG
    1658         Log(("%s vnetControlMac: unicast macs:\n", INSTANCE(pThis)));
     1655        Log(("%s vnetR3ControlMac: unicast macs:\n", INSTANCE(pThis)));
    16591656        for(unsigned i = 0; i < nMacs; i++)
    16601657            Log(("         %RTmac\n", &pThis->aMacFilter[i]));
     
    16691666    if (pElem->aSegsOut[2].cb < nMacs * sizeof(RTMAC) + sizeof(nMacs))
    16701667    {
    1671         Log(("%s vnetControlMac: The multicast mac segment is too small (nMacs=%u cb=%u)\n",
     1668        Log(("%s vnetR3ControlMac: The multicast mac segment is too small (nMacs=%u cb=%u)\n",
    16721669             INSTANCE(pThis), nMacs, pElem->aSegsOut[2].cb));
    16731670        return VNET_ERROR;
     
    16761673    if (nMacs > VNET_MAC_FILTER_LEN - pThis->nMacFilterEntries)
    16771674    {
    1678         Log(("%s vnetControlMac: MAC table is too big, have to use allmulti mode (nMacs=%u)\n", INSTANCE(pThis), nMacs));
     1675        Log(("%s vnetR3ControlMac: MAC table is too big, have to use allmulti mode (nMacs=%u)\n", INSTANCE(pThis), nMacs));
    16791676        pThis->fAllMulti = true;
    16801677    }
     
    16871684                              nMacs * sizeof(RTMAC));
    16881685#ifdef DEBUG
    1689         Log(("%s vnetControlMac: multicast macs:\n", INSTANCE(pThis)));
     1686        Log(("%s vnetR3ControlMac: multicast macs:\n", INSTANCE(pThis)));
    16901687        for(unsigned i = 0; i < nMacs; i++)
    16911688            Log(("         %RTmac\n",
     
    16981695}
    16991696
    1700 static uint8_t vnetControlVlan(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)
     1697static uint8_t vnetR3ControlVlan(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)
    17011698{
    17021699    uint8_t  u8Ack = VNET_OK;
     
    17051702    if (pElem->nOut != 2 || pElem->aSegsOut[1].cb != sizeof(u16Vid))
    17061703    {
    1707         Log(("%s vnetControlVlan: Segment layout is wrong (u8Command=%u nOut=%u cb=%u)\n",
     1704        Log(("%s vnetR3ControlVlan: Segment layout is wrong (u8Command=%u nOut=%u cb=%u)\n",
    17081705             INSTANCE(pThis), pCtlHdr->u8Command, pElem->nOut, pElem->aSegsOut[1].cb));
    17091706        return VNET_ERROR;
     
    17161713    if (u16Vid >= VNET_MAX_VID)
    17171714    {
    1718         Log(("%s vnetControlVlan: VLAN ID is out of range (VID=%u)\n", INSTANCE(pThis), u16Vid));
     1715        Log(("%s vnetR3ControlVlan: VLAN ID is out of range (VID=%u)\n", INSTANCE(pThis), u16Vid));
    17191716        return VNET_ERROR;
    17201717    }
    17211718
    1722     Log(("%s vnetControlVlan: uCommand=%u VID=%u\n", INSTANCE(pThis), pCtlHdr->u8Command, u16Vid));
     1719    Log(("%s vnetR3ControlVlan: uCommand=%u VID=%u\n", INSTANCE(pThis), pCtlHdr->u8Command, u16Vid));
    17231720
    17241721    switch (pCtlHdr->u8Command)
     
    17381735
    17391736
    1740 static DECLCALLBACK(void) vnetQueueControl(void *pvState, PVQUEUE pQueue)
     1737static DECLCALLBACK(void) vnetR3QueueControl(void *pvState, PVQUEUE pQueue)
    17411738{
    17421739    PVNETSTATE pThis = (PVNETSTATE)pvState;
     
    17471744        if (elem.nOut < 1 || elem.aSegsOut[0].cb < sizeof(VNETCTLHDR))
    17481745        {
    1749             Log(("%s vnetQueueControl: The first 'out' segment is not the header! (%u < 1 || %u < %u).\n",
     1746            Log(("%s vnetR3QueueControl: The first 'out' segment is not the header! (%u < 1 || %u < %u).\n",
    17501747                 INSTANCE(pThis), elem.nOut, elem.aSegsOut[0].cb,sizeof(VNETCTLHDR)));
    17511748            break; /* Skip the element and hope the next one is good. */
    17521749        }
    1753         else if (   elem.nIn < 1
    1754                  || elem.aSegsIn[elem.nIn - 1].cb < sizeof(VNETCTLACK))
    1755         {
    1756             Log(("%s vnetQueueControl: The last 'in' segment is too small to hold the acknowledge! (%u < 1 || %u < %u).\n",
     1750        if (   elem.nIn < 1
     1751            || elem.aSegsIn[elem.nIn - 1].cb < sizeof(VNETCTLACK))
     1752        {
     1753            Log(("%s vnetR3QueueControl: The last 'in' segment is too small to hold the acknowledge! (%u < 1 || %u < %u).\n",
    17571754                 INSTANCE(pThis), elem.nIn, elem.aSegsIn[elem.nIn - 1].cb, sizeof(VNETCTLACK)));
    17581755            break; /* Skip the element and hope the next one is good. */
    17591756        }
    1760         else
    1761         {
    1762             VNETCTLHDR CtlHdr;
    1763             PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns),
    1764                               elem.aSegsOut[0].addr,
    1765                               &CtlHdr, sizeof(CtlHdr));
    1766             switch (CtlHdr.u8Class)
    1767             {
    1768                 case VNET_CTRL_CLS_RX_MODE:
    1769                     u8Ack = vnetControlRx(pThis, &CtlHdr, &elem);
    1770                     break;
    1771                 case VNET_CTRL_CLS_MAC:
    1772                     u8Ack = vnetControlMac(pThis, &CtlHdr, &elem);
    1773                     break;
    1774                 case VNET_CTRL_CLS_VLAN:
    1775                     u8Ack = vnetControlVlan(pThis, &CtlHdr, &elem);
    1776                     break;
    1777                 default:
    1778                     u8Ack = VNET_ERROR;
    1779             }
    1780             Log(("%s Processed control message %u, ack=%u.\n", INSTANCE(pThis), CtlHdr.u8Class, u8Ack));
    1781             PDMDevHlpPCIPhysWrite(pThis->VPCI.CTX_SUFF(pDevIns),
    1782                                   elem.aSegsIn[elem.nIn - 1].addr,
    1783                                   &u8Ack, sizeof(u8Ack));
    1784         }
     1757
     1758        VNETCTLHDR CtlHdr;
     1759        PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns),
     1760                          elem.aSegsOut[0].addr,
     1761                          &CtlHdr, sizeof(CtlHdr));
     1762        switch (CtlHdr.u8Class)
     1763        {
     1764            case VNET_CTRL_CLS_RX_MODE:
     1765                u8Ack = vnetR3ControlRx(pThis, &CtlHdr, &elem);
     1766                break;
     1767            case VNET_CTRL_CLS_MAC:
     1768                u8Ack = vnetR3ControlMac(pThis, &CtlHdr, &elem);
     1769                break;
     1770            case VNET_CTRL_CLS_VLAN:
     1771                u8Ack = vnetR3ControlVlan(pThis, &CtlHdr, &elem);
     1772                break;
     1773            default:
     1774                u8Ack = VNET_ERROR;
     1775        }
     1776        Log(("%s Processed control message %u, ack=%u.\n", INSTANCE(pThis), CtlHdr.u8Class, u8Ack));
     1777        PDMDevHlpPCIPhysWrite(pThis->VPCI.CTX_SUFF(pDevIns),
     1778                              elem.aSegsIn[elem.nIn - 1].addr,
     1779                              &u8Ack, sizeof(u8Ack));
     1780
    17851781        vqueuePut(&pThis->VPCI, pQueue, &elem, sizeof(u8Ack));
    17861782        vqueueSync(&pThis->VPCI, pQueue);
     
    17941790 * Saves the configuration.
    17951791 *
    1796  * @param   pThis      The VNET state.
     1792 * @param   pDevIns     The device instance.
     1793 * @param   pThis       The VNET state.
    17971794 * @param   pSSM        The handle to the saved state.
    17981795 */
    1799 static void vnetSaveConfig(PVNETSTATE pThis, PSSMHANDLE pSSM)
    1800 {
    1801     SSMR3PutMem(pSSM, &pThis->macConfigured, sizeof(pThis->macConfigured));
     1796static void vnetR3SaveConfig(PPDMDEVINS pDevIns, PVNETSTATE pThis, PSSMHANDLE pSSM)
     1797{
     1798    pDevIns->pHlpR3->pfnSSMPutMem(pSSM, &pThis->macConfigured, sizeof(pThis->macConfigured));
    18021799}
    18031800
     
    18061803 * @callback_method_impl{FNSSMDEVLIVEEXEC}
    18071804 */
    1808 static DECLCALLBACK(int) vnetLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
    1809 {
     1805static DECLCALLBACK(int) vnetR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
     1806{
     1807    PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    18101808    RT_NOREF(uPass);
     1809    vnetR3SaveConfig(pDevIns, pThis, pSSM);
     1810    return VINF_SSM_DONT_CALL_AGAIN;
     1811}
     1812
     1813
     1814/**
     1815 * @callback_method_impl{FNSSMDEVSAVEPREP}
     1816 */
     1817static DECLCALLBACK(int) vnetR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     1818{
    18111819    PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    1812     vnetSaveConfig(pThis, pSSM);
    1813     return VINF_SSM_DONT_CALL_AGAIN;
    1814 }
    1815 
    1816 
    1817 /**
    1818  * @callback_method_impl{FNSSMDEVSAVEPREP}
    1819  */
    1820 static DECLCALLBACK(int) vnetSavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    1821 {
    18221820    RT_NOREF(pSSM);
    1823     PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    18241821
    18251822    int rc = vnetCsRxEnter(pThis, VERR_SEM_BUSY);
    1826     if (RT_UNLIKELY(rc != VINF_SUCCESS))
    1827         return rc;
    1828     vnetCsRxLeave(pThis);
    1829     return VINF_SUCCESS;
     1823    if (RT_SUCCESS(rc))
     1824        vnetCsRxLeave(pThis);
     1825    return rc;
    18301826}
    18311827
     
    18341830 * @callback_method_impl{FNSSMDEVSAVEEXEC}
    18351831 */
    1836 static DECLCALLBACK(int) vnetSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    1837 {
    1838     PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
     1832static DECLCALLBACK(int) vnetR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     1833{
     1834    PVNETSTATE      pThis   = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
     1835    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
    18391836
    18401837    /* Save config first */
    1841     vnetSaveConfig(pThis, pSSM);
     1838    vnetR3SaveConfig(pDevIns, pThis, pSSM);
    18421839
    18431840    /* Save the common part */
    18441841    int rc = vpciSaveExec(&pThis->VPCI, pSSM);
    18451842    AssertRCReturn(rc, rc);
     1843
    18461844    /* Save device-specific part */
    1847     rc = SSMR3PutMem( pSSM, pThis->config.mac.au8, sizeof(pThis->config.mac));
     1845    pHlp->pfnSSMPutMem(     pSSM, pThis->config.mac.au8, sizeof(pThis->config.mac));
     1846    pHlp->pfnSSMPutBool(    pSSM, pThis->fPromiscuous);
     1847    pHlp->pfnSSMPutBool(    pSSM, pThis->fAllMulti);
     1848    pHlp->pfnSSMPutU32(     pSSM, pThis->nMacFilterEntries);
     1849    pHlp->pfnSSMPutMem(     pSSM, pThis->aMacFilter, pThis->nMacFilterEntries * sizeof(RTMAC));
     1850    rc = pHlp->pfnSSMPutMem(pSSM, pThis->aVlanFilter, sizeof(pThis->aVlanFilter));
    18481851    AssertRCReturn(rc, rc);
    1849     rc = SSMR3PutBool(pSSM, pThis->fPromiscuous);
    1850     AssertRCReturn(rc, rc);
    1851     rc = SSMR3PutBool(pSSM, pThis->fAllMulti);
    1852     AssertRCReturn(rc, rc);
    1853     rc = SSMR3PutU32( pSSM, pThis->nMacFilterEntries);
    1854     AssertRCReturn(rc, rc);
    1855     rc = SSMR3PutMem( pSSM, pThis->aMacFilter,
    1856                       pThis->nMacFilterEntries * sizeof(RTMAC));
    1857     AssertRCReturn(rc, rc);
    1858     rc = SSMR3PutMem( pSSM, pThis->aVlanFilter, sizeof(pThis->aVlanFilter));
    1859     AssertRCReturn(rc, rc);
     1852
    18601853    Log(("%s State has been saved\n", INSTANCE(pThis)));
    18611854    return VINF_SUCCESS;
     
    18641857
    18651858/**
    1866  * @callback_method_impl{FNSSMDEVLOADPREP, Serializes the receive thread, it may
    1867  *                      be working inside the critsect. }
    1868  */
    1869 static DECLCALLBACK(int) vnetLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    1870 {
     1859 * @callback_method_impl{FNSSMDEVLOADPREP,
     1860 * Serializes the receive thread - it may be working inside the critsect. }
     1861 */
     1862static DECLCALLBACK(int) vnetR3LoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     1863{
     1864    PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    18711865    RT_NOREF(pSSM);
    1872     PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    18731866
    18741867    int rc = vnetCsRxEnter(pThis, VERR_SEM_BUSY);
    1875     if (RT_UNLIKELY(rc != VINF_SUCCESS))
    1876         return rc;
    1877     vnetCsRxLeave(pThis);
    1878     return VINF_SUCCESS;
     1868    if (RT_SUCCESS(rc))
     1869        vnetCsRxLeave(pThis);
     1870    return rc;
    18791871}
    18801872
     
    18831875 * @callback_method_impl{FNSSMDEVLOADEXEC}
    18841876 */
    1885 static DECLCALLBACK(int) vnetLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    1886 {
    1887     PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    1888     int       rc;
     1877static DECLCALLBACK(int) vnetR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
     1878{
     1879    PVNETSTATE      pThis  = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
     1880    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
    18891881
    18901882    /* config checks */
    18911883    RTMAC macConfigured;
    1892     rc = SSMR3GetMem(pSSM, &macConfigured, sizeof(macConfigured));
     1884    int rc = pHlp->pfnSSMGetMem(pSSM, &macConfigured, sizeof(macConfigured));
    18931885    AssertRCReturn(rc, rc);
    18941886    if (memcmp(&macConfigured, &pThis->macConfigured, sizeof(macConfigured))
     
    19011893    if (uPass == SSM_PASS_FINAL)
    19021894    {
    1903         rc = SSMR3GetMem( pSSM, pThis->config.mac.au8,
    1904                           sizeof(pThis->config.mac));
     1895        rc = pHlp->pfnSSMGetMem( pSSM, pThis->config.mac.au8, sizeof(pThis->config.mac));
    19051896        AssertRCReturn(rc, rc);
    19061897
    19071898        if (uVersion > VIRTIO_SAVEDSTATE_VERSION_3_1_BETA1)
    19081899        {
    1909             rc = SSMR3GetBool(pSSM, &pThis->fPromiscuous);
    1910             AssertRCReturn(rc, rc);
    1911             rc = SSMR3GetBool(pSSM, &pThis->fAllMulti);
    1912             AssertRCReturn(rc, rc);
    1913             rc = SSMR3GetU32(pSSM, &pThis->nMacFilterEntries);
    1914             AssertRCReturn(rc, rc);
    1915             rc = SSMR3GetMem(pSSM, pThis->aMacFilter,
    1916                              pThis->nMacFilterEntries * sizeof(RTMAC));
    1917             AssertRCReturn(rc, rc);
     1900            pHlp->pfnSSMGetBool(pSSM, &pThis->fPromiscuous);
     1901            pHlp->pfnSSMGetBool(pSSM, &pThis->fAllMulti);
     1902            pHlp->pfnSSMGetU32(pSSM, &pThis->nMacFilterEntries);
     1903            pHlp->pfnSSMGetMem(pSSM, pThis->aMacFilter, pThis->nMacFilterEntries * sizeof(RTMAC));
     1904
    19181905            /* Clear the rest. */
    19191906            if (pThis->nMacFilterEntries < VNET_MAC_FILTER_LEN)
    19201907                memset(&pThis->aMacFilter[pThis->nMacFilterEntries],
    19211908                       0,
    1922                        (VNET_MAC_FILTER_LEN - pThis->nMacFilterEntries)
    1923                        * sizeof(RTMAC));
    1924             rc = SSMR3GetMem(pSSM, pThis->aVlanFilter,
    1925                              sizeof(pThis->aVlanFilter));
     1909                       (VNET_MAC_FILTER_LEN - pThis->nMacFilterEntries) * sizeof(RTMAC));
     1910            rc = pHlp->pfnSSMGetMem(pSSM, pThis->aVlanFilter, sizeof(pThis->aVlanFilter));
    19261911            AssertRCReturn(rc, rc);
    19271912        }
     
    19461931 *                      loading.}
    19471932 */
    1948 static DECLCALLBACK(int) vnetLoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     1933static DECLCALLBACK(int) vnetR3LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    19491934{
    19501935    RT_NOREF(pSSM);
     
    19591944     */
    19601945    if (!PDMDevHlpVMTeleportedAndNotFullyResumedYet(pDevIns))
    1961         vnetTempLinkDown(pThis);
     1946        vnetR3TempLinkDown(pThis);
    19621947
    19631948    return VINF_SUCCESS;
     
    19701955 * @callback_method_impl{FNPCIIOREGIONMAP}
    19711956 */
    1972 static DECLCALLBACK(int) vnetMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
    1973                                  RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
     1957static DECLCALLBACK(int) vnetR3Map(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
     1958                                   RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
    19741959{
    19751960    PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
     
    20051990
    20061991/**
    2007  * @interface_method_impl{PDMDEVREG,pfnDetach}
    2008  */
    2009 static DECLCALLBACK(void) vnetDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
     1992 * @interface_method_impl{PDMDEVREGR3,pfnDetach}
     1993 */
     1994static DECLCALLBACK(void) vnetR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
    20101995{
    20111996    RT_NOREF(fFlags);
    20121997    PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    2013     Log(("%s vnetDetach:\n", INSTANCE(pThis)));
     1998    Log(("%s vnetR3Detach:\n", INSTANCE(pThis)));
    20141999
    20152000    AssertLogRelReturnVoid(iLUN == 0);
    20162001
    2017     int rc = vnetCsEnter(pThis, VERR_SEM_BUSY);
     2002    int rc = vnetR3CsEnter(pThis, VERR_SEM_BUSY);
    20182003    if (RT_FAILURE(rc))
    20192004    {
    2020         LogRel(("vnetDetach failed to enter critical section!\n"));
     2005        LogRel(("vnetR3Detach failed to enter critical section!\n"));
    20212006        return;
    20222007    }
    20232008
    2024     vnetDestroyTxThreadAndEvent(pThis);
     2009    vnetR3DestroyTxThreadAndEvent(pThis);
    20252010    /*
    20262011     * Zero some important members.
     
    20292014    pThis->pDrv = NULL;
    20302015
    2031     vnetCsLeave(pThis);
    2032 }
    2033 
    2034 
    2035 /**
    2036  * @interface_method_impl{PDMDEVREG,pfnAttach}
    2037  */
    2038 static DECLCALLBACK(int) vnetAttach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
     2016    vnetR3CsLeave(pThis);
     2017}
     2018
     2019
     2020/**
     2021 * @interface_method_impl{PDMDEVREGR3,pfnAttach}
     2022 */
     2023static DECLCALLBACK(int) vnetR3Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
    20392024{
    20402025    RT_NOREF(fFlags);
    20412026    PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    2042     LogFlow(("%s vnetAttach:\n",  INSTANCE(pThis)));
     2027    LogFlow(("%s vnetR3Attach:\n",  INSTANCE(pThis)));
    20432028
    20442029    AssertLogRelReturn(iLUN == 0, VERR_PDM_NO_SUCH_LUN);
    20452030
    2046     int rc = vnetCsEnter(pThis, VERR_SEM_BUSY);
     2031    int rc = vnetR3CsEnter(pThis, VERR_SEM_BUSY);
    20472032    if (RT_FAILURE(rc))
    20482033    {
    2049         LogRel(("vnetAttach failed to enter critical section!\n"));
     2034        LogRel(("vnetR3Attach failed to enter critical section!\n"));
    20502035        return rc;
    20512036    }
     
    20712056                      rc = VERR_PDM_MISSING_INTERFACE_BELOW);
    20722057
    2073         vnetCreateTxThreadAndEvent(pDevIns, pThis);
     2058        vnetR3CreateTxThreadAndEvent(pDevIns, pThis);
    20742059    }
    20752060    else if (   rc == VERR_PDM_NO_ATTACHED_DRIVER
     
    20872072     */
    20882073    if (RT_SUCCESS(rc))
    2089         vnetTempLinkDown(pThis);
    2090 
    2091     vnetCsLeave(pThis);
     2074        vnetR3TempLinkDown(pThis);
     2075
     2076    vnetR3CsLeave(pThis);
    20922077    return rc;
    20932078
     
    20962081
    20972082/**
    2098  * @interface_method_impl{PDMDEVREG,pfnSuspend}
    2099  */
    2100 static DECLCALLBACK(void) vnetSuspend(PPDMDEVINS pDevIns)
     2083 * @interface_method_impl{PDMDEVREGR3,pfnSuspend}
     2084 */
     2085static DECLCALLBACK(void) vnetR3Suspend(PPDMDEVINS pDevIns)
    21012086{
    21022087    /* Poke thread waiting for buffer space. */
    2103     vnetWakeupReceive(pDevIns);
    2104 }
    2105 
    2106 
    2107 /**
    2108  * @interface_method_impl{PDMDEVREG,pfnPowerOff}
    2109  */
    2110 static DECLCALLBACK(void) vnetPowerOff(PPDMDEVINS pDevIns)
     2088    vnetR3WakeupReceive(pDevIns);
     2089}
     2090
     2091
     2092/**
     2093 * @interface_method_impl{PDMDEVREGR3,pfnPowerOff}
     2094 */
     2095static DECLCALLBACK(void) vnetR3PowerOff(PPDMDEVINS pDevIns)
    21112096{
    21122097    /* Poke thread waiting for buffer space. */
    2113     vnetWakeupReceive(pDevIns);
    2114 }
    2115 
    2116 
    2117 /**
    2118  * @interface_method_impl{PDMDEVREG,pfnRelocate}
    2119  */
    2120 static DECLCALLBACK(void) vnetRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
     2098    vnetR3WakeupReceive(pDevIns);
     2099}
     2100
     2101
     2102/**
     2103 * @interface_method_impl{PDMDEVREGR3,pfnRelocate}
     2104 */
     2105static DECLCALLBACK(void) vnetR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    21212106{
    21222107    PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
     
    21312116
    21322117/**
    2133  * @interface_method_impl{PDMDEVREG,pfnDestruct}
    2134  */
    2135 static DECLCALLBACK(int) vnetDestruct(PPDMDEVINS pDevIns)
     2118 * @interface_method_impl{PDMDEVREGR3,pfnDestruct}
     2119 */
     2120static DECLCALLBACK(int) vnetR3Destruct(PPDMDEVINS pDevIns)
    21362121{
    21372122    PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
     
    21582143
    21592144/**
    2160  * @interface_method_impl{PDMDEVREG,pfnConstruct}
    2161  */
    2162 static DECLCALLBACK(int) vnetConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
     2145 * @interface_method_impl{PDMDEVREGR3,pfnConstruct}
     2146 */
     2147static DECLCALLBACK(int) vnetR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    21632148{
    21642149    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    2165     PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    2166     int        rc;
    2167 
    2168     /* Initialize the instance data suffiencently for the destructor not to blow up. */
     2150    PVNETSTATE      pThis   = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
     2151    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
     2152    int             rc;
     2153
     2154    /*
     2155     * Initialize the instance data suffiencently for the destructor not to blow up.
     2156     */
    21692157    pThis->hEventMoreRxDescAvail = NIL_RTSEMEVENT;
    21702158
     
    21752163    /* Initialize PCI part. */
    21762164    pThis->VPCI.IBase.pfnQueryInterface    = vnetQueryInterface;
    2177     rc = vpciConstruct(pDevIns, &pThis->VPCI, iInstance,
    2178                        VNET_NAME_FMT, VIRTIO_NET_ID,
    2179                        VNET_PCI_CLASS, VNET_N_QUEUES);
    2180     pThis->pRxQueue  = vpciAddQueue(&pThis->VPCI, 256, vnetQueueReceive,  "RX ");
    2181     pThis->pTxQueue  = vpciAddQueue(&pThis->VPCI, 256, vnetQueueTransmit, "TX ");
    2182     pThis->pCtlQueue = vpciAddQueue(&pThis->VPCI, 16,  vnetQueueControl,  "CTL");
     2165
     2166    rc = vpciConstruct(pDevIns, &pThis->VPCI, iInstance, VNET_NAME_FMT, VIRTIO_NET_ID, VNET_PCI_CLASS, VNET_N_QUEUES);
     2167    AssertRCReturn(rc, rc);
     2168
     2169    pThis->pRxQueue  = vpciAddQueue(&pThis->VPCI, 256, vnetR3QueueReceive,  "RX ");
     2170    pThis->pTxQueue  = vpciAddQueue(&pThis->VPCI, 256, vnetR3QueueTransmit, "TX ");
     2171    pThis->pCtlQueue = vpciAddQueue(&pThis->VPCI, 16,  vnetR3QueueControl,  "CTL");
    21832172
    21842173    Log(("%s Constructing new instance\n", INSTANCE(pThis)));
     
    21872176     * Validate configuration.
    21882177     */
    2189     if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "LineSpeed\0" "LinkUpDelay\0"))
    2190         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, N_("Invalid configuration for VirtioNet device"));
     2178    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "MAC|CableConnected|LineSpeed|LinkUpDelay", "");
    21912179
    21922180    /* Get config params */
    2193     rc = CFGMR3QueryBytes(pCfg, "MAC", pThis->macConfigured.au8,
    2194                           sizeof(pThis->macConfigured));
     2181    rc = pHlp->pfnCFGMQueryBytes(pCfg, "MAC", pThis->macConfigured.au8, sizeof(pThis->macConfigured));
    21952182    if (RT_FAILURE(rc))
    2196         return PDMDEV_SET_ERROR(pDevIns, rc,
    2197                                 N_("Configuration error: Failed to get MAC address"));
    2198     rc = CFGMR3QueryBool(pCfg, "CableConnected", &pThis->fCableConnected);
     2183        return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed to get MAC address"));
     2184    rc = pHlp->pfnCFGMQueryBool(pCfg, "CableConnected", &pThis->fCableConnected);
    21992185    if (RT_FAILURE(rc))
    2200         return PDMDEV_SET_ERROR(pDevIns, rc,
    2201                                 N_("Configuration error: Failed to get the value of 'CableConnected'"));
    2202     rc = CFGMR3QueryU32Def(pCfg, "LinkUpDelay", (uint32_t*)&pThis->cMsLinkUpDelay, 5000); /* ms */
     2186        return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed to get the value of 'CableConnected'"));
     2187    rc = pHlp->pfnCFGMQueryU32Def(pCfg, "LinkUpDelay", &pThis->cMsLinkUpDelay, 5000); /* ms */
    22032188    if (RT_FAILURE(rc))
    2204         return PDMDEV_SET_ERROR(pDevIns, rc,
    2205                                 N_("Configuration error: Failed to get the value of 'LinkUpDelay'"));
     2189        return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed to get the value of 'LinkUpDelay'"));
    22062190    Assert(pThis->cMsLinkUpDelay <= 300000); /* less than 5 minutes */
    22072191    if (pThis->cMsLinkUpDelay > 5000 || pThis->cMsLinkUpDelay < 100)
    2208     {
    22092192        LogRel(("%s WARNING! Link up delay is set to %u seconds!\n",
    22102193                INSTANCE(pThis), pThis->cMsLinkUpDelay / 1000));
    2211     }
    22122194    Log(("%s Link up delay is set to %u seconds\n",
    22132195         INSTANCE(pThis), pThis->cMsLinkUpDelay / 1000));
    2214 
    22152196
    22162197    vnetPrintFeatures(pThis, vnetIoCb_GetHostFeatures(pThis), "Device supports the following features");
     
    22242205
    22252206    /* Interfaces */
    2226     pThis->INetworkDown.pfnWaitReceiveAvail = vnetNetworkDown_WaitReceiveAvail;
    2227     pThis->INetworkDown.pfnReceive          = vnetNetworkDown_Receive;
    2228     pThis->INetworkDown.pfnReceiveGso       = vnetNetworkDown_ReceiveGso;
    2229     pThis->INetworkDown.pfnXmitPending      = vnetNetworkDown_XmitPending;
    2230 
    2231     pThis->INetworkConfig.pfnGetMac         = vnetGetMac;
    2232     pThis->INetworkConfig.pfnGetLinkState   = vnetGetLinkState;
    2233     pThis->INetworkConfig.pfnSetLinkState   = vnetSetLinkState;
     2207    pThis->INetworkDown.pfnWaitReceiveAvail = vnetR3NetworkDown_WaitReceiveAvail;
     2208    pThis->INetworkDown.pfnReceive          = vnetR3NetworkDown_Receive;
     2209    pThis->INetworkDown.pfnReceiveGso       = vnetR3NetworkDown_ReceiveGso;
     2210    pThis->INetworkDown.pfnXmitPending      = vnetR3NetworkDown_XmitPending;
     2211
     2212    pThis->INetworkConfig.pfnGetMac         = vnetR3NetworkConfig_GetMac;
     2213    pThis->INetworkConfig.pfnGetLinkState   = vnetR3NetworkConfig_GetLinkState;
     2214    pThis->INetworkConfig.pfnSetLinkState   = vnetR3NetworkConfig_SetLinkState;
    22342215
    22352216    /* Initialize critical section. */
     
    22412222
    22422223    /* Map our ports to IO space. */
    2243     rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0,
    2244                                       VPCI_CONFIG + sizeof(VNetPCIConfig),
    2245                                       PCI_ADDRESS_SPACE_IO, vnetMap);
    2246     if (RT_FAILURE(rc))
    2247         return rc;
    2248 
     2224    rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, VPCI_CONFIG + sizeof(VNetPCIConfig), PCI_ADDRESS_SPACE_IO, vnetR3Map);
     2225    AssertRCReturn(rc, rc);
    22492226
    22502227    /* Register save/restore state handlers. */
    22512228    rc = PDMDevHlpSSMRegisterEx(pDevIns, VIRTIO_SAVEDSTATE_VERSION, sizeof(VNETSTATE), NULL,
    2252                                 NULL,         vnetLiveExec, NULL,
    2253                                 vnetSavePrep, vnetSaveExec, NULL,
    2254                                 vnetLoadPrep, vnetLoadExec, vnetLoadDone);
    2255     if (RT_FAILURE(rc))
    2256         return rc;
     2229                                NULL,           vnetR3LiveExec, NULL,
     2230                                vnetR3SavePrep, vnetR3SaveExec, NULL,
     2231                                vnetR3LoadPrep, vnetR3LoadExec, vnetR3LoadDone);
     2232    AssertRCReturn(rc, rc);
    22572233
    22582234    /* Create the RX notifier signaller. */
    22592235    rc = PDMDevHlpQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 1, 0,
    2260                               vnetCanRxQueueConsumer, true, "VNet-Rcv", &pThis->pCanRxQueueR3);
    2261     if (RT_FAILURE(rc))
    2262         return rc;
     2236                              vnetR3CanRxQueueConsumer, true, "VNet-Rcv", &pThis->pCanRxQueueR3);
     2237    AssertRCReturn(rc, rc);
    22632238    pThis->pCanRxQueueR0 = PDMQueueR0Ptr(pThis->pCanRxQueueR3);
    22642239    pThis->pCanRxQueueRC = PDMQueueRCPtr(pThis->pCanRxQueueR3);
    22652240
    22662241    /* Create Link Up Timer */
    2267     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetLinkUpTimer, pThis,
    2268                                 TMTIMER_FLAGS_NO_CRIT_SECT,
     2242    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetR3LinkUpTimer, pThis, TMTIMER_FLAGS_NO_CRIT_SECT,
    22692243                                "VirtioNet Link Up Timer", &pThis->pLinkUpTimer);
    2270     if (RT_FAILURE(rc))
    2271         return rc;
     2244    AssertRCReturn(rc, rc);
    22722245
    22732246#ifndef VNET_TX_DELAY
     
    22772250#else /* VNET_TX_DELAY */
    22782251    /* Create Transmit Delay Timer */
    2279     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetTxTimer, pThis,
    2280                                 TMTIMER_FLAGS_NO_CRIT_SECT,
     2252    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetR3TxTimer, pThis, TMTIMER_FLAGS_NO_CRIT_SECT,
    22812253                                "VirtioNet TX Delay Timer", &pThis->pTxTimerR3);
    2282     if (RT_FAILURE(rc))
    2283         return rc;
     2254    AssertRCReturn(rc, rc);
    22842255    pThis->pTxTimerR0 = TMTimerR0Ptr(pThis->pTxTimerR3);
    22852256    pThis->pTxTimerRC = TMTimerRCPtr(pThis->pTxTimerR3);
     
    23012272                        VERR_PDM_MISSING_INTERFACE_BELOW);
    23022273
    2303         vnetCreateTxThreadAndEvent(pDevIns, pThis);
     2274        vnetR3CreateTxThreadAndEvent(pDevIns, pThis);
    23042275    }
    23052276    else if (   rc == VERR_PDM_NO_ATTACHED_DRIVER
     
    23132284
    23142285    rc = RTSemEventCreate(&pThis->hEventMoreRxDescAvail);
    2315     if (RT_FAILURE(rc))
    2316         return rc;
     2286    AssertRCReturn(rc, rc);
    23172287
    23182288    rc = vnetIoCb_Reset(pThis);
    2319     AssertRC(rc);
     2289    AssertRCReturn(rc, rc);
    23202290
    23212291    PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatReceiveBytes,       STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,          "Amount of data received",            "/Public/Net/VNet%u/BytesReceived", iInstance);
    23222292    PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitBytes,      STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,          "Amount of data transmitted",         "/Public/Net/VNet%u/BytesTransmitted", iInstance);
    23232293
    2324     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatReceiveBytes,       STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,          "Amount of data received",            "/Devices/VNet%d/ReceiveBytes", iInstance);
    2325     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitBytes,      STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,          "Amount of data transmitted",         "/Devices/VNet%d/TransmitBytes", iInstance);
    2326     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatReceiveGSO,         STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,          "Number of received GSO packets",     "/Devices/VNet%d/Packets/ReceiveGSO", iInstance);
    2327     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitPackets,    STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,          "Number of sent packets",             "/Devices/VNet%d/Packets/Transmit", iInstance);
    2328     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitGSO,        STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,          "Number of sent GSO packets",         "/Devices/VNet%d/Packets/Transmit-Gso", iInstance);
    2329     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitCSum,       STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,          "Number of completed TX checksums",   "/Devices/VNet%d/Packets/Transmit-Csum", iInstance);
    2330 #if defined(VBOX_WITH_STATISTICS)
    2331     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatReceive,            STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive",                  "/Devices/VNet%d/Receive/Total", iInstance);
    2332     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatReceiveStore,       STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive storing",          "/Devices/VNet%d/Receive/Store", iInstance);
    2333     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatRxOverflow,         STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, "Profiling RX overflows",        "/Devices/VNet%d/RxOverflow", iInstance);
    2334     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatRxOverflowWakeup,   STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,     "Nr of RX overflow wakeups",          "/Devices/VNet%d/RxOverflowWakeup", iInstance);
    2335     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmit,           STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling transmits in HC",          "/Devices/VNet%d/Transmit/Total", iInstance);
    2336     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitSend,       STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling send transmit in HC",      "/Devices/VNet%d/Transmit/Send", iInstance);
    2337     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitByNetwork,  STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,          "Network-initiated transmissions",    "/Devices/VNet%d/Transmit/ByNetwork", iInstance);
    2338     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitByThread,   STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,          "Thread-initiated transmissions",     "/Devices/VNet%d/Transmit/ByThread", iInstance);
    2339 #endif /* VBOX_WITH_STATISTICS */
     2294    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatReceiveBytes,        STAMTYPE_COUNTER, "ReceiveBytes",           STAMUNIT_BYTES,          "Amount of data received");
     2295    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitBytes,       STAMTYPE_COUNTER, "TransmitBytes",          STAMUNIT_BYTES,          "Amount of data transmitted");
     2296    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatReceiveGSO,          STAMTYPE_COUNTER, "Packets/ReceiveGSO",     STAMUNIT_COUNT,          "Number of received GSO packets");
     2297    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitPackets,     STAMTYPE_COUNTER, "Packets/Transmit",       STAMUNIT_COUNT,          "Number of sent packets");
     2298    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitGSO,         STAMTYPE_COUNTER, "Packets/Transmit-Gso",   STAMUNIT_COUNT,          "Number of sent GSO packets");
     2299    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitCSum,        STAMTYPE_COUNTER, "Packets/Transmit-Csum",  STAMUNIT_COUNT,          "Number of completed TX checksums");
     2300# ifdef VBOX_WITH_STATISTICS
     2301    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatReceive,             STAMTYPE_PROFILE, "Receive/Total",          STAMUNIT_TICKS_PER_CALL, "Profiling receive");
     2302    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatReceiveStore,        STAMTYPE_PROFILE, "Receive/Store",          STAMUNIT_TICKS_PER_CALL, "Profiling receive storing");
     2303    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatRxOverflow,          STAMTYPE_PROFILE, "RxOverflow",             STAMUNIT_TICKS_PER_OCCURENCE, "Profiling RX overflows");
     2304    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatRxOverflowWakeup,    STAMTYPE_COUNTER, "RxOverflowWakeup",       STAMUNIT_OCCURENCES,     "Nr of RX overflow wakeups");
     2305    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmit,            STAMTYPE_PROFILE, "Transmit/Total",         STAMUNIT_TICKS_PER_CALL, "Profiling transmits in HC");
     2306    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitSend,        STAMTYPE_PROFILE, "Transmit/Send",          STAMUNIT_TICKS_PER_CALL, "Profiling send transmit in HC");
     2307    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitByNetwork,   STAMTYPE_COUNTER, "Transmit/ByNetwork",     STAMUNIT_COUNT,          "Network-initiated transmissions");
     2308    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitByThread,    STAMTYPE_COUNTER, "Transmit/ByThread",      STAMUNIT_COUNT,          "Thread-initiated transmissions");
     2309# endif
    23402310
    23412311    return VINF_SUCCESS;
     
    23692339    /* .pszRCMod = */               "VBoxDDRC.rc",
    23702340    /* .pszR0Mod = */               "VBoxDDR0.r0",
    2371     /* .pfnConstruct = */           vnetConstruct,
    2372     /* .pfnDestruct = */            vnetDestruct,
    2373     /* .pfnRelocate = */            vnetRelocate,
     2341    /* .pfnConstruct = */           vnetR3Construct,
     2342    /* .pfnDestruct = */            vnetR3Destruct,
     2343    /* .pfnRelocate = */            vnetR3Relocate,
    23742344    /* .pfnMemSetup = */            NULL,
    23752345    /* .pfnPowerOn = */             NULL,
    23762346    /* .pfnReset = */               NULL,
    2377     /* .pfnSuspend = */             vnetSuspend,
     2347    /* .pfnSuspend = */             vnetR3Suspend,
    23782348    /* .pfnResume = */              NULL,
    2379     /* .pfnAttach = */              vnetAttach,
    2380     /* .pfnDetach = */              vnetDetach,
     2349    /* .pfnAttach = */              vnetR3Attach,
     2350    /* .pfnDetach = */              vnetR3Detach,
    23812351    /* .pfnQueryInterface = */      NULL,
    23822352    /* .pfnInitComplete = */        NULL,
    2383     /* .pfnPowerOff = */            vnetPowerOff,
     2353    /* .pfnPowerOff = */            vnetR3PowerOff,
    23842354    /* .pfnSoftReset = */           NULL,
    23852355    /* .pfnReserved0 = */           NULL,
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