VirtualBox

Changeset 83028 in vbox


Ignore:
Timestamp:
Feb 9, 2020 10:05:09 PM (5 years ago)
Author:
vboxsync
Message:

Network/DevVirtioNet_1_0.cpp: Fixed but in Virtio_1_0.cpp virtioWriteUsedFlags. Can now read guest MAC filter table properly.

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

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

    r82968 r83028  
    5959#include "VBoxDD.h"
    6060
     61/** @todo FIX UP THESE HACKS AFTER DEBUGGING */
     62
     63/* After debugging single instance case, restore instance name logging */
     64#define INSTANCE(pState) (char *)(pState->szInstanceName ? "" : "") // Avoid requiring RT_NOREF in some funcs
     65
     66
    6167#define VIRTIONET_SAVED_STATE_VERSION          UINT32_C(1)
    6268#define VIRTIONET_MAX_QPAIRS                   1
     
    6773#define VIRTIONET_PREALLOCATE_RX_SEG_COUNT     32
    6874
    69 #define INSTANCE(pState) pState->szInstanceName
     75
    7076#define QUEUE_NAME(a_pVirtio, a_idxQueue) ((a_pVirtio)->virtqState[(a_idxQueue)].szVirtqName)
    7177#define VIRTQNAME(idxQueue)           (pThis->aszVirtqNames[idxQueue])
     
    471477
    472478} VIRTIONETR3;
     479
     480
    473481/** Pointer to the ring-3 state of the VirtIO Host NET device. */
    474482typedef VIRTIONETR3 *PVIRTIONETR3;
     
    513521static DECLCALLBACK(int) virtioNetR3WakeupWorker(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
    514522{
    515     LogFunc(("\n"));
    516523    PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
     524    LogFunc(("%s\n", INSTANCE(pThis)));
    517525    return PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[(uintptr_t)pThread->pvUser].hEvtProcess);
    518526}
     
    612620DECLINLINE(bool) virtioNetValidateRequiredFeatures(uint32_t fFeatures)
    613621{
    614     LogFunc(("\n"));
    615622    uint32_t fGuestChksumRequired =   fFeatures & VIRTIONET_F_GUEST_TSO4
    616623                                   || fFeatures & VIRTIONET_F_GUEST_TSO6
     
    694701        uint32_t offIntra = offConfig - RT_UOFFSETOF(VIRTIONET_CONFIG_T, member); \
    695702        if (fWrite) \
    696             LogFunc(("Guest attempted to write readonly virtio_pci_common_cfg.%s\n", #member)); \
     703            LogFunc(("%s Guest attempted to write readonly virtio_pci_common_cfg.%s\n", INSTANCE(pThis), #member)); \
    697704        else \
    698705        { \
     
    721728    else
    722729    {
    723         LogFunc(("Bad access by guest to virtio_net_config: off=%u (%#x), cb=%u\n", offConfig, offConfig, cb));
     730        LogFunc(("%s Bad access by guest to virtio_net_config: off=%u (%#x), cb=%u\n", INSTANCE(pThis), offConfig, offConfig, cb));
    724731        return fWrite ? VINF_SUCCESS : VINF_IOM_MMIO_UNUSED_00;
    725732    }
     
    739746    PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    740747
    741     LogFunc(("%s: uOffset: %d, cb: %d\n",  INSTANCE(pThis), uOffset, cb));
     748    LogFunc(("%s uOffset: %d, cb: %d\n",  INSTANCE(pThis), uOffset, cb));
    742749    return virtioNetR3CfgAccessed(PDMDEVINS_2_DATA(pDevIns, PVIRTIONET), uOffset, pv, cb, false /*fRead*/);
    743750}
     
    750757    PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    751758
    752     LogFunc(("%s: uOffset: %d, cb: %d: %.*Rhxs\n", INSTANCE(pThis), uOffset, cb, RT_MAX(cb, 8) , pv));
     759    LogFunc(("%s uOffset: %d, cb: %d: %.*Rhxs\n", INSTANCE(pThis), uOffset, cb, RT_MAX(cb, 8) , pv));
    753760    return virtioNetR3CfgAccessed(PDMDEVINS_2_DATA(pDevIns, PVIRTIONET), uOffset, (void *)pv, cb, true /*fWrite*/);
    754761}
     
    790797
    791798    RT_NOREF(pThisCC);
    792     LogFunc(("LOAD EXEC!!\n"));
     799    LogFunc(("%s LOAD EXEC!!\n", INSTANCE(pThis)));
    793800
    794801    AssertReturn(uPass == SSM_PASS_FINAL, VERR_SSM_UNEXPECTED_PASS);
     
    813820        if (pThis->afQueueAttached[idxQueue])
    814821        {
    815             LogFunc(("Waking %s worker.\n", VIRTQNAME(idxQueue)));
     822            LogFunc(("%s Waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    816823            rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[idxQueue].hEvtProcess);
    817824            AssertRCReturn(rc, rc);
     
    832839    RT_NOREF(pThisCC);
    833840
    834     LogFunc(("SAVE EXEC!!\n"));
     841    LogFunc(("%s SAVE EXEC!!\n", INSTANCE(pThis)));
    835842
    836843    for (int idxQueue = 0; idxQueue < pThis->cVirtQueues; idxQueue++)
     
    858865    /** @todo create test to conclusively determine I/O has been quiesced and add it here: */
    859866
    860     LogFunc(("Device I/O activity quiesced: %s\n",
    861         virtioCoreGetStateChangeText(pThisCC->enmQuiescingFor)));
     867    LogFunc(("%s Device I/O activity quiesced: %s\n",
     868        INSTANCE(pThis), virtioCoreGetStateChangeText(pThisCC->enmQuiescingFor)));
    862869
    863870    virtioCoreR3VmStateChanged(&pThis->Virtio, pThisCC->enmQuiescingFor);
     
    904911{
    905912    PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    906     LogFunc(("\n"));
     913    LogFunc(("%s\n", INSTANCE(pThis)));
    907914    pThis->fResetting = true;
    908915    virtioNetR3QuiesceDevice(pDevIns, kvirtIoVmStateChangedReset);
     
    914921static DECLCALLBACK(void) virtioNetR3SuspendOrPowerOff(PPDMDEVINS pDevIns, VIRTIOVMSTATECHANGED enmType)
    915922{
    916     LogFunc(("\n"));
    917923
    918924    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    919925    PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC);
     926    LogFunc(("%s\n", INSTANCE(pThis)));
    920927
    921928    RT_NOREF2(pThis, pThisCC);
     
    929936static DECLCALLBACK(void) virtioNetR3PowerOff(PPDMDEVINS pDevIns)
    930937{
    931     LogFunc(("\n"));
     938    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
     939    LogFunc(("%s\n", INSTANCE(pThis)));
     940
    932941    virtioNetR3SuspendOrPowerOff(pDevIns, kvirtIoVmStateChangedPowerOff);
    933942}
     
    938947static DECLCALLBACK(void) virtioNetR3Suspend(PPDMDEVINS pDevIns)
    939948{
    940     LogFunc(("\n"));
     949    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
     950    LogFunc(("%s \n", INSTANCE(pThis)));
    941951    virtioNetR3SuspendOrPowerOff(pDevIns, kvirtIoVmStateChangedSuspend);
    942952}
     
    965975        if (ASMAtomicReadBool(&pThisCC->aWorkers[idxQueue].fSleeping))
    966976        {
    967             Log6Func(("waking %s worker.\n", VIRTQNAME(idxQueue)));
     977            Log6Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    968978            int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[idxQueue].hEvtProcess);
    969979            AssertRC(rc);
     
    10481058    int rc;
    10491059
    1050     LogFlowFunc(("%s: idxQueue = %d\n", INSTANCE(pThis), idxQueue));
     1060    LogFunc(("%s %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    10511061
    10521062    if (!pThis->fVirtioReady)
     
    10671077    }
    10681078
    1069     LogFlowFunc(("%s: idxQueue = %d -> %Rrc\n", INSTANCE(pThis), idxQueue, rc));
     1079    LogFlowFunc(("%s idxQueue = %d -> %Rrc\n", INSTANCE(pThis), idxQueue, rc));
    10701080    return rc;
    10711081}
     
    11001110    if (!virtioNetAllSystemsGo(pThis, pDevIns))
    11011111    {
    1102         LogFunc(("VirtIO not ready\n"));
     1112        LogFunc(("%s VirtIO not ready\n", INSTANCE(pThis)));
    11031113        return VERR_NET_NO_BUFFER_SPACE;
    11041114    }
     
    11071117        return VERR_NET_NO_BUFFER_SPACE;
    11081118
    1109     LogFlowFunc(("%s: timeoutMs=%u\n", INSTANCE(pThis), timeoutMs));
     1119    LogFlowFunc(("%s timeoutMs=%u\n", INSTANCE(pThis), timeoutMs));
    11101120
    11111121    ASMAtomicXchgBool(&pThis->fLeafWantsRxBuffers, true);
     
    11211131            if (RT_SUCCESS(virtioNetR3IsRxQueuePrimed(pDevIns, pThis, idxQueue)))
    11221132            {
    1123                 LogFunc(("Rx bufs now available, releasing waiter..."));
     1133                LogFunc(("%s Rx bufs now available, releasing waiter...", INSTANCE(pThis)));
    11241134                return VINF_SUCCESS;
    11251135            }
    11261136        }
    1127         LogFunc(("%s: Starved for guest Rx bufs, waiting %u ms ...\n",
     1137        LogFunc(("%s Starved for guest Rx bufs, waiting %u ms ...\n",
    11281138                 INSTANCE(pThis), timeoutMs));
    11291139
     
    11411151    ASMAtomicXchgBool(&pThis->fLeafWantsRxBuffers, false);
    11421152
    1143     LogFlowFunc(("%s: Wait for Rx buffers available was interrupted\n", INSTANCE(pThis)));
     1153    LogFlowFunc(("%s Wait for Rx buffers available was interrupted\n", INSTANCE(pThis)));
    11441154    return VERR_INTERRUPTED;
    11451155}
     
    12361246static bool virtioNetR3AddressFilter(PVIRTIONET pThis, const void *pvBuf, size_t cb)
    12371247{
    1238     LogFunc(("\n"));
     1248    LogFunc(("%s\n", INSTANCE(pThis)));
    12391249
    12401250    if (pThis->fPromiscuous)
     
    12481258        && !ASMBitTest(pThis->aVlanFilter, RT_BE2H_U16(uPtr[7]) & 0xFFF))
    12491259    {
    1250         Log4Func(("%s: not our VLAN, returning false\n", INSTANCE(pThis)));
     1260        Log4Func(("%s not our VLAN, returning false\n", INSTANCE(pThis)));
    12511261        return false;
    12521262    }
     
    12741284            return true;
    12751285
    1276     Log2Func(("%s: failed all tests, returning false, packet dump follows:\n",
     1286    Log2Func(("%s failed all tests, returning false, packet dump follows:\n",
    12771287        INSTANCE(pThis)));
    12781288
     
    13021312    RT_NOREF(pThisCC);
    13031313
    1304     LogFunc(("\n"));
     1314    LogFunc(("%s\n", INSTANCE(pThis)));
    13051315    VIRTIONET_PKT_HDR_T rxPktHdr;
    13061316
     
    14491459    PVIRTIONET      pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    14501460
    1451     LogFunc(("\n"));
     1461    LogFunc(("%s\n", pThis));
    14521462
    14531463    if (!pThis->fVirtioReady)
     
    15251535
    15261536/* Read physical bytes from the out segment(s) of descriptor chain */
    1527 static void virtioNetR3PullChain(PPDMDEVINS pDevIns, PVIRTIO_DESC_CHAIN_T pDescChain, void *pv, uint16_t cb)
     1537static void virtioNetR3PullChain(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIO_DESC_CHAIN_T pDescChain, void *pv, uint16_t cb)
    15281538{
    15291539    uint8_t *pb = (uint8_t *)pv;
     
    15381548        pDescChain->cbPhysSend -= cbSeg;
    15391549    }
    1540     LogFunc(("Pulled %d / %d bytes from desc chain (%d bytes left in desc chain)\n",
    1541              cb - cbLim, cb, pDescChain->cbPhysSend));
     1550    LogFunc(("%s Pulled %d/%d bytes from desc chain (%d bytes left)\n",
     1551             INSTANCE(pThis), cb - cbLim, cb, pDescChain->cbPhysSend));
    15421552}
    15431553
     
    15461556{
    15471557
    1548 #define LOG_VIRTIONET_FLAG(fld) LogFunc(("%s = %d\n", #fld, pThis->fld))
    1549 
    1550     LogFunc(("Processing CTRL Rx command\n"));
     1558#define LOG_VIRTIONET_FLAG(fld) LogFunc(("%s Setting %s=%d\n", INSTANCE(pThis), #fld, pThis->fld))
     1559
     1560    LogFunc(("%s Processing CTRL Rx command\n", INSTANCE(pThis)));
    15511561    switch(pCtrlPktHdr->uCmd)
    15521562    {
     
    15691579
    15701580    uint8_t fOn, fPromiscChanged = false;
    1571     virtioNetR3PullChain(pDevIns, pDescChain, &fOn, RT_MIN(pDescChain->cbPhysSend, sizeof(fOn)));
     1581    virtioNetR3PullChain(pDevIns, pThis, pDescChain, &fOn, RT_MIN(pDescChain->cbPhysSend, sizeof(fOn)));
    15721582
    15731583    switch(pCtrlPktHdr->uCmd)
     
    16041614    {
    16051615        uint8_t fPromiscuous = pThis->fPromiscuous | pThis->fAllMulticast;
    1606         LogFunc(("Setting promiscuous state to %d\n", fPromiscuous));
    16071616        pThisCC->pDrv->pfnSetPromiscuousMode(pThisCC->pDrv, fPromiscuous);
    16081617    }
     
    16141623                                  PVIRTIONET_CTRL_HDR_T pCtrlPktHdr, PVIRTIO_DESC_CHAIN_T pDescChain)
    16151624{
    1616     LogFunc(("Processing CTRL MAC command\n"));
     1625    LogFunc(("%s Processing CTRL MAC command\n", INSTANCE(pThis)));
    16171626
    16181627    RT_NOREF(pThisCC);
     
    16291638
    16301639    size_t cbRemaining = pDescChain->cbPhysSend;
    1631 Log6Func(("initial:cbRemaining=%d pDescChain->cbPhysSend=%d sizeof(*pCtrlPktHdr)=%d\n",
    1632          cbRemaining, pDescChain->cbPhysSend, sizeof(*pCtrlPktHdr)));
    16331640    switch(pCtrlPktHdr->uCmd)
    16341641    {
     
    16371644            /* Set default Rx filter MAC */
    16381645            ASSERT_CTRL_ADDR_SET(cbRemaining >= sizeof(VIRTIONET_CTRL_MAC_TABLE_LEN));
    1639             virtioNetR3PullChain(pDevIns, pDescChain, &pThis->rxFilterMacDefault, sizeof(VIRTIONET_CTRL_MAC_TABLE_LEN));
     1646            virtioNetR3PullChain(pDevIns, pThis, pDescChain, &pThis->rxFilterMacDefault, sizeof(VIRTIONET_CTRL_MAC_TABLE_LEN));
    16401647            break;
    16411648        }
     
    16461653            /* Load unicast MAC filter table */
    16471654            ASSERT_CTRL_TABLE_SET(cbRemaining >= sizeof(cMacs));
    1648             virtioNetR3PullChain(pDevIns, pDescChain, &cMacs, sizeof(cMacs));
     1655            virtioNetR3PullChain(pDevIns, pThis, pDescChain, &cMacs, sizeof(cMacs));
    16491656            cbRemaining -= sizeof(cMacs);
    1650             Log6Func(("Guest provided %d unicast MAC Table entries\n", cMacs));
     1657            Log6Func(("%s Guest provided %d unicast MAC Table entries\n", INSTANCE(pThis), cMacs));
    16511658            if (cMacs)
    16521659            {
    16531660                uint32_t cbMacs = cMacs * sizeof(RTMAC);
    16541661                ASSERT_CTRL_TABLE_SET(cbRemaining >= cbMacs);
    1655                 virtioNetR3PullChain(pDevIns, pDescChain, &pThis->aMacUnicastFilter, cbMacs);
     1662                virtioNetR3PullChain(pDevIns, pThis, pDescChain, &pThis->aMacUnicastFilter, cbMacs);
    16561663                cbRemaining -= cbMacs;
    16571664            }
     
    16601667            /* Load multicast MAC filter table */
    16611668            ASSERT_CTRL_TABLE_SET(cbRemaining >= sizeof(cMacs));
    1662             virtioNetR3PullChain(pDevIns, pDescChain, &cMacs, sizeof(cMacs));
     1669            virtioNetR3PullChain(pDevIns, pThis, pDescChain, &cMacs, sizeof(cMacs));
    16631670            cbRemaining -= sizeof(cMacs);
    1664             Log6Func(("Guest provided %d multicast MAC Table entries\n", cMacs));
     1671            Log6Func(("%s Guest provided %d multicast MAC Table entries\n", INSTANCE(pThis), cMacs));
    16651672            if (cMacs)
    16661673            {
    16671674                uint32_t cbMacs = cMacs * sizeof(RTMAC);
    16681675                ASSERT_CTRL_TABLE_SET(cbRemaining >= cbMacs);
    1669                 virtioNetR3PullChain(pDevIns, pDescChain, &pThis->aMacMulticastFilter, cbMacs);
     1676                virtioNetR3PullChain(pDevIns, pThis, pDescChain, &pThis->aMacMulticastFilter, cbMacs);
    16701677                cbRemaining -= cbMacs;
    16711678            }
     
    16731680
    16741681#ifdef LOG_ENABLED
    1675             LogFunc(("%s: unicast MACs:\n", INSTANCE(pThis)));
     1682            LogFunc(("%s unicast MACs:\n", INSTANCE(pThis)));
    16761683            for(unsigned i = 0; i < cMacs; i++)
    16771684                LogFunc(("         %RTmac\n", &pThis->aMacUnicastFilter[i]));
    16781685
    1679             LogFunc(("%s: multicast MACs:\n", INSTANCE(pThis)));
     1686            LogFunc(("%s multicast MACs:\n", INSTANCE(pThis)));
    16801687            for(unsigned i = 0; i < cMacs; i++)
    1681                 LogFunc(("         %RTmac\n", &pThis->aMacUnicastFilter[i]));
     1688                LogFunc(("         %RTmac\n", &pThis->aMacMulticastFilter[i]));
    16821689#endif
    16831690
     
    16901697                                   PVIRTIONET_CTRL_HDR_T pCtrlPktHdr, PVIRTIO_DESC_CHAIN_T pDescChain)
    16911698{
    1692     LogFunc(("Processing CTRL VLAN command\n"));
     1699    LogFunc(("%s Processing CTRL VLAN command\n", INSTANCE(pThis)));
    16931700
    16941701    RT_NOREF(pThisCC);
     
    16981705    AssertMsgReturn(cbRemaining > sizeof(uVlanId),
    16991706        ("DESC chain too small for VIRTIO_NET_CTRL_VLAN cmd processing"), VIRTIONET_ERROR);
    1700     virtioNetR3PullChain(pDevIns, pDescChain, &uVlanId, sizeof(uVlanId));
     1707    virtioNetR3PullChain(pDevIns, pThis, pDescChain, &uVlanId, sizeof(uVlanId));
    17011708    AssertMsgReturn(uVlanId > VIRTIONET_MAX_VLAN_ID,
    17021709        ("%s VLAN ID out of range (VLAN ID=%u)\n", INSTANCE(pThis), uVlanId), VIRTIONET_ERROR);
    1703     LogFunc(("%s: uCommand=%u VLAN ID=%u\n", INSTANCE(pThis), pCtrlPktHdr->uCmd, uVlanId));
     1710    LogFunc(("%s uCommand=%u VLAN ID=%u\n", INSTANCE(pThis), pCtrlPktHdr->uCmd, uVlanId));
    17041711    switch (pCtrlPktHdr->uCmd)
    17051712    {
     
    17191726                            PVIRTIO_DESC_CHAIN_T pDescChain)
    17201727{
    1721     LogFunc(("Received CTRL packet from guest\n"));
     1728    LogFunc(("%s Received CTRL packet from guest\n", INSTANCE(pThis)));
    17221729
    17231730    if (pDescChain->cbPhysSend < 2)
    17241731    {
    1725         LogFunc(("ctrl packet from guest driver incomplete. Skipping ctrl cmd\n"));
     1732        LogFunc(("%s CTRL packet from guest driver incomplete. Skipping ctrl cmd\n", INSTANCE(pThis)));
    17261733        return;
    17271734    }
    17281735    else if (pDescChain->cbPhysReturn < sizeof(VIRTIONET_CTRL_HDR_T_ACK))
    17291736    {
    1730         LogFunc(("Guest driver didn't allocate memory to receive ctrl pkt ACK. Skipping ctrl cmd\n"));
     1737        LogFunc(("%s Guest driver didn't allocate memory to receive ctrl pkt ACK. Skipping ctrl cmd\n", INSTANCE(pThis)));
    17311738        return;
    17321739    }
     
    17421749                        ("DESC chain too small for CTRL pkt header"));
    17431750
    1744     virtioNetR3PullChain(pDevIns, pDescChain, pCtrlPktHdr,
     1751    virtioNetR3PullChain(pDevIns, pThis, pDescChain, pCtrlPktHdr,
    17451752                         RT_MIN(pDescChain->cbPhysSend, sizeof(VIRTIONET_CTRL_HDR_T)));
    17461753
    1747     Log6Func(("CTRL pkt hdr: class=%d cmd=%d\n", pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd));
     1754    Log6Func(("%s CTRL COMMAND: class=%d command=%d\n", INSTANCE(pThis), pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd));
    17481755
    17491756    uint8_t uAck;
     
    17631770            if (FEATURE_DISABLED(STATUS) || FEATURE_DISABLED(GUEST_ANNOUNCE))
    17641771            {
    1765                 LogFunc(("Ignoring CTRL class VIRTIONET_CTRL_ANNOUNCE. Not configured to handle it\n"));
     1772                LogFunc(("%s Ignoring CTRL class VIRTIONET_CTRL_ANNOUNCE. Not configured to handle it\n", INSTANCE(pThis)));
    17661773                virtioNetPrintFeatures(pThis, pThis->fNegotiatedFeatures, "Features");
    17671774                break;
     
    17691776            if (pCtrlPktHdr->uCmd != VIRTIONET_CTRL_ANNOUNCE_ACK)
    17701777            {
    1771                 LogFunc(("Ignoring CTRL class VIRTIONET_CTRL_ANNOUNCE. Unrecognized uCmd\n"));
     1778                LogFunc(("%s Ignoring CTRL class VIRTIONET_CTRL_ANNOUNCE. Unrecognized uCmd\n", INSTANCE(pThis)));
    17721779                break;
    17731780            }
    17741781            pThis->virtioNetConfig.uStatus &= ~VIRTIONET_F_ANNOUNCE;
    1775             Log6Func(("Clearing VIRTIONET_F_ANNOUNCE in config status\n"));
     1782            Log6Func(("%s Clearing VIRTIONET_F_ANNOUNCE in config status\n", INSTANCE(pThis)));
    17761783            break;
    17771784
     
    18151822    RTMemFree(pReturnSegBuf);
    18161823
    1817     LogFunc(("Processed ctrl message class/cmd = %u/%u. Ack=%u.\n",
    1818               pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd, uAck));
     1824    LogFunc(("%s Finished processing CTRL command with status %s\n",
     1825             INSTANCE(pThis), uAck == VIRTIONET_OK ? "VIRTIONET_OK" : "VIRTIONET_ERROR"));
    18191826
    18201827}
     
    18761883        //if (pGso->cbHdrs < pPktHdr->uCSumStart + pPktHdr->uCSumOffset + 2)
    18771884        {
    1878             Log4Func(("%s: HdrLen before adjustment %d.\n",
     1885            Log4Func(("%s HdrLen before adjustment %d.\n",
    18791886                  INSTANCE(pThis), pGso->cbHdrsTotal));
    18801887            switch (pGso->u8Type)
     
    18941901            ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsTotal = pGso->cbHdrsTotal;
    18951902            ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsSeg   = pGso->cbHdrsSeg;
    1896             Log4Func(("%s: adjusted HdrLen to %d.\n",
     1903            Log4Func(("%s adjusted HdrLen to %d.\n",
    18971904                  INSTANCE(pThis), pGso->cbHdrsTotal));
    18981905        }
    1899         Log2Func(("%s: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",
     1906        Log2Func(("%s gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",
    19001907                  INSTANCE(pThis), pGso->u8Type, pGso->cbHdrsTotal, pGso->cbHdrsSeg,
    19011908                  pGso->cbMaxSeg, pGso->offHdr1, pGso->offHdr2));
     
    19281935    if (!pThis->fVirtioReady)
    19291936    {
    1930         LogFunc(("%s Ignoring transmit requests. VirtIO not ready (status=0x%x).\n",
     1937        LogFunc(("%s Ignoring Tx requests. VirtIO not ready (status=0x%x).\n",
    19311938                INSTANCE(pThis), pThis->virtioNetConfig.uStatus));
    19321939        return;
     
    19531960    unsigned int cbPktHdr = sizeof(VIRTIONET_PKT_HDR_T);
    19541961
    1955     Log3Func(("%s: About to transmit %d pending packets\n", INSTANCE(pThis),
     1962    Log3Func(("%s About to transmit %d pending packets\n", INSTANCE(pThis),
    19561963              virtioCoreR3QueuePendingCount(pVirtio->pDevIns, pVirtio, idxQueue)));
    19571964
     
    19631970    {
    19641971        if (RT_SUCCESS(rc))
    1965             Log6Func(("fetched descriptor chain from %s\n", VIRTQNAME(idxQueue)));
     1972            Log6Func(("%s fetched descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    19661973        else
    19671974        {
    1968             LogFunc(("Failed find expected data on %s, rc = %Rrc\n", VIRTQNAME(idxQueue), rc));
     1975            LogFunc(("%s Failed find expected data on %s, rc = %Rrc\n", INSTANCE(pThis), VIRTQNAME(idxQueue), rc));
    19691976            break;
    19701977        }
     
    19771984            /* This check could be made more complex, because in theory (but not likely nor
    19781985             * seen in practice) the first segment could contain header and data. */
    1979             LogFunc(("%s: The first segment is not the header! (%u < 2 || %u != %u).\n",
     1986            LogFunc(("%s The first segment is not the header! (%u < 2 || %u != %u).\n",
    19801987                 INSTANCE(pThis), cSegsFromGuest, paSegsFromGuest[0].cbSeg, cbPktHdr));
    19811988            break;
     
    19891996            uSize +=  paSegsFromGuest[i].cbSeg;
    19901997
    1991         Log5Func(("%s: complete frame is %u bytes.\n", INSTANCE(pThis), uSize));
     1998        Log5Func(("%s complete frame is %u bytes.\n", INSTANCE(pThis), uSize));
    19921999        Assert(uSize <= VIRTIONET_MAX_FRAME_SIZE);
    19932000
     
    20222029                if (RT_FAILURE(rc))
    20232030                {
    2024                     LogFunc(("Failed to transmit frame, rc = %Rrc\n", rc));
     2031                    LogFunc(("%s Failed to transmit frame, rc = %Rrc\n", INSTANCE(pThis), rc));
    20252032                    pThisCC->pDrv->pfnFreeBuf(pThisCC->pDrv, pSgBufToPdmLeafDevice);
    20262033                }
     
    20812088#endif
    20822089
    2083     Log6Func(("%s has available buffers\n", VIRTQNAME(idxQueue)));
     2090    Log6Func(("%s %s has available buffers\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    20842091
    20852092    if (IS_RX_QUEUE(idxQueue))
    20862093    {
    2087         LogFunc(("%s Receive buffers has been added, waking up receive thread.\n",
     2094        LogFunc(("%s Receive buffers have been added, waking Rx thread.\n",
    20882095            INSTANCE(pThis)));
    20892096        virtioNetR3WakeupRxBufWaiter(pDevIns);
     
    20962103            if (ASMAtomicReadBool(&pWorkerR3->fSleeping))
    20972104            {
    2098                 Log6Func(("waking %s worker.\n", VIRTQNAME(idxQueue)));
     2105                Log6Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    20992106                int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pWorker->hEvtProcess);
    21002107                AssertRC(rc);
     
    21182125        return VINF_SUCCESS;
    21192126    }
    2120     LogFunc(("%s\n", VIRTQNAME(idxQueue)));
     2127    LogFunc(("%s %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21212128    while (pThread->enmState == PDMTHREADSTATE_RUNNING)
    21222129    {
     
    21302137            if (!fNotificationSent)
    21312138            {
    2132                 Log6Func(("%s worker sleeping...\n", VIRTQNAME(idxQueue)));
     2139                Log6Func(("%s %s worker sleeping...\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21332140                Assert(ASMAtomicReadBool(&pWorkerR3->fSleeping));
    21342141                int rc = PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pWorker->hEvtProcess, RT_INDEFINITE_WAIT);
     
    21412148                    continue;
    21422149                }
    2143                 Log6Func(("%s worker woken\n", VIRTQNAME(idxQueue)));
     2150                Log6Func(("%s %s worker woken\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21442151                ASMAtomicWriteBool(&pWorkerR3->fNotified, false);
    21452152            }
     
    21542161             if (IS_CTRL_QUEUE(idxQueue))
    21552162             {
    2156                  Log6Func(("fetching next descriptor chain from %s\n", VIRTQNAME(idxQueue)));
     2163                 Log6Func(("%s fetching next descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21572164                 PVIRTIO_DESC_CHAIN_T pDescChain;
    21582165                 int rc = virtioCoreR3QueueGet(pDevIns, &pThis->Virtio, idxQueue, &pDescChain, true);
    21592166                 if (rc == VERR_NOT_AVAILABLE)
    21602167                 {
    2161                     Log6Func(("Nothing found in %s\n", VIRTQNAME(idxQueue)));
     2168                    Log6Func(("%s Nothing found in %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21622169                    continue;
    21632170                 }
     
    21662173             else if (IS_TX_QUEUE(idxQueue))
    21672174             {
    2168                  Log6Func(("Notified of data to transmit\n"));
     2175                 Log6Func(("%s Notified of data to transmit\n", INSTANCE(pThis)));
    21692176                 virtioNetR3TransmitPendingPackets(pDevIns, pThis, pThisCC,
    21702177                                                   idxQueue, true /* fOnWorkerThread */);
     
    21842191    RT_NOREF(pDevIns, pThis, rcBusy);
    21852192    /* Original DevVirtioNet uses CS in attach/detach/link-up timer/tx timer/transmit */
    2186     LogFunc(("CS unimplemented. What does the critical section protect in orig driver??"));
     2193    LogFunc(("%s CS unimplemented. What does the critical section protect in orig driver??", INSTANCE(pThis)));
    21872194    return VINF_SUCCESS;
    21882195}
     
    21912198{
    21922199    RT_NOREF(pDevIns, pThis);
    2193     LogFunc(("CS unimplemented. What does the critical section protect in orig driver??"));
     2200    LogFunc(("%s CS unimplemented. What does the critical section protect in orig driver??", INSTANCE(pThis)));
    21942201}
    21952202
     
    22132220    virtioNetR3CsLeave(pDevIns, pThis);
    22142221
    2215     LogFunc(("%s: Link is up\n", INSTANCE(pThis)));
     2222    LogFunc(("%s Link is up\n", INSTANCE(pThis)));
    22162223
    22172224    if (pThisCC->pDrv)
     
    22422249        AssertRC(rc);
    22432250
    2244         LogFunc(("%s: Link is down temporarily\n", INSTANCE(pThis)));
     2251        LogFunc(("%s Link is down temporarily\n", INSTANCE(pThis)));
    22452252    }
    22462253}
     
    22692276    bool fActiveLinkIsUp = (enmState == PDMNETWORKLINKSTATE_UP);
    22702277
    2271     LogFunc(("%s: enmState=%d\n", INSTANCE(pThis), enmState));
     2278    LogFunc(("%s enmState=%d\n", INSTANCE(pThis), enmState));
    22722279    if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME)
    22732280    {
     
    23092316static int virtioNetR3DestroyWorkerThreads(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC)
    23102317{
    2311     LogFunc(("\n"));
     2318    LogFunc(("%s\n", INSTANCE(pThis)));
    23122319    int rc = VINF_SUCCESS;
    23132320    for (unsigned idxQueue = 0; idxQueue < pThis->cVirtQueues; idxQueue++)
     
    23332340static int virtioNetR3CreateWorkerThreads(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC)
    23342341{
    2335     LogFunc(("\n"));
     2342    LogFunc(("%s\n", INSTANCE(pThis)));
    23362343
    23372344    int rc = VINF_SUCCESS;
     
    23712378    PVIRTIONETCC   pThisCC   = RT_FROM_MEMBER(pVirtioCC, VIRTIONETCC, Virtio);
    23722379
    2373     LogFunc(("\n"));
     2380    LogFunc(("%s\n", INSTANCE(pThis)));
    23742381
    23752382    pThis->fVirtioReady = fVirtioReady;
     
    23772384    if (fVirtioReady)
    23782385    {
    2379         LogFunc(("VirtIO ready\n-----------------------------------------------------------------------------------------\n"));
     2386        LogFunc(("%s VirtIO ready\n-----------------------------------------------------------------------------------------\n",
     2387                 INSTANCE(pThis)));
    23802388
    23812389        pThis->fResetting    = false;
     
    23912399    else
    23922400    {
    2393         LogFunc(("VirtIO is resetting\n"));
     2401        LogFunc(("%s VirtIO is resetting\n", INSTANCE(pThis)));
    23942402
    23952403        pThis->virtioNetConfig.uStatus = pThis->fCableConnected ? VIRTIONET_F_LINK_UP : 0;
     
    24312439    PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC);
    24322440
    2433     LogFunc(("\n"));
     2441    LogFunc(("%s\n", INSTANCE(pThis)));
    24342442    AssertLogRelReturnVoid(iLUN == 0);
    24352443
     
    24582466    RT_NOREF(fFlags);
    24592467
    2460     LogFunc(("%s",  INSTANCE(pThis)));
     2468    LogFunc(("%s", INSTANCE(pThis)));
    24612469
    24622470    AssertLogRelReturn(iLUN == 0, VERR_PDM_NO_SUCH_LUN);
     
    25502558     */
    25512559    LogFunc(("PDM device instance: %d\n", iInstance));
    2552     RTStrPrintf(INSTANCE(pThis), sizeof(INSTANCE(pThis)), "VIRTIONET%d", iInstance);
     2560
     2561
     2562    RTStrPrintf(pThis->szInstanceName, sizeof(pThis->szInstanceName), "VIRTIONET", iInstance);
     2563
    25532564    pThisCC->pDevIns     = pDevIns;
    25542565
     
    26142625    /* Initialize the generic Virtio core: */
    26152626    pThisCC->Virtio.pfnStatusChanged        = virtioNetR3StatusChanged;
    2616     pThisCC->Virtio.pfnQueueNotified        = virtioNetR3QueueNotified;
     2627    pThisCC->Virtio.pfnQueueNotified        = virtioNetR3QueueNotified
     2628    ;
    26172629    pThisCC->Virtio.pfnDevCapRead           = virtioNetR3DevCapRead;
    26182630    pThisCC->Virtio.pfnDevCapWrite          = virtioNetR3DevCapWrite;
     
    27362748    /* .uReserved0 = */             0,
    27372749    /* .szName = */                 "virtio-net-1-dot-0",
    2738     /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_NEW_STYLE //| PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE
     2750    /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_NEW_STYLE //| PDM_DEVREG_FLAGS_RZ
    27392751                                    | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION
    27402752                                    | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION,
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp

    r82968 r83028  
    226226}
    227227
    228 DECLINLINE(void) virtioWriteUsedFlags(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue, uint32_t fFlags)
     228DECLINLINE(void) virtioWriteUsedFlags(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue, uint16_t fFlags)
    229229{
    230230    AssertMsg(pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK, ("Called with guest driver not ready\n"));
     
    234234                          &fFlags, sizeof(fFlags));
    235235}
    236 
    237236#endif
    238237
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