VirtualBox

Changeset 83153 in vbox for trunk


Ignore:
Timestamp:
Feb 25, 2020 1:54:08 PM (5 years ago)
Author:
vboxsync
Message:

Updates since last integration. Troubleshooting why client is not transmitting any data and I can't get ping to work

File:
1 edited

Legend:

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

    r83058 r83153  
    415415    uint8_t                 aVlanFilter[VIRTIONET_MAX_VLAN_ID / sizeof(uint8_t)];
    416416
     417    bool                    fLog;
     418
    417419    /* Receive-blocking-related fields ***************************************/
    418420
     
    522524{
    523525    PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    524     LogFunc(("%s\n", INSTANCE(pThis)));
     526    Log10Func(("%s\n", INSTANCE(pThis)));
    525527    return PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[(uintptr_t)pThread->pvUser].hEvtProcess);
    526528}
     
    535537    AssertReturnVoid(pThis->hEventRxDescAvail != NIL_SUPSEMEVENT);
    536538
    537     LogFunc(("%s Waking downstream driver's Rx buf waiter thread\n", INSTANCE(pThis)));
     539    Log10Func(("%s Waking downstream driver's Rx buf waiter thread\n", INSTANCE(pThis)));
    538540    int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEventRxDescAvail);
    539541    AssertRC(rc);
     
    560562DECLINLINE(void) virtioNetR3PacketDump(PVIRTIONET pThis, const uint8_t *pbPacket, size_t cb, const char *pszText)
    561563{
    562 # ifdef DEBUG
    563 #  if 0
    564     Log(("%s %s packet #%d (%d bytes):\n",
    565          INSTANCE(pThis), pszText, ++pThis->u32PktNo, cb));
    566     Log3(("%.*Rhxd\n", cb, pbPacket));
    567 #  else
     564//    if (!LogIs12Enabled())
     565//        return;
     566
    568567    vboxEthPacketDump(INSTANCE(pThis), pszText, pbPacket, (uint32_t)cb);
    569 #  endif
    570 # else
    571     RT_NOREF4(pThis, pbPacket, cb, pszText);
    572 # endif
    573568}
    574569
     
    757752    PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    758753
    759     LogFunc(("%s uOffset: %d, cb: %d: %.*Rhxs\n", INSTANCE(pThis), uOffset, cb, RT_MAX(cb, 8) , pv));
     754    Log10Func(("%s uOffset: %d, cb: %d: %.*Rhxs\n", INSTANCE(pThis), uOffset, cb, RT_MAX(cb, 8) , pv));
    760755    return virtioNetR3CfgAccessed(PDMDEVINS_2_DATA(pDevIns, PVIRTIONET), uOffset, (void *)pv, cb, true /*fWrite*/);
    761756}
     
    797792
    798793    RT_NOREF(pThisCC);
    799     LogFunc(("%s LOAD EXEC!!\n", INSTANCE(pThis)));
     794    Log7Func(("%s LOAD EXEC!!\n", INSTANCE(pThis)));
    800795
    801796    AssertReturn(uPass == SSM_PASS_FINAL, VERR_SSM_UNEXPECTED_PASS);
     
    820815        if (pThis->afQueueAttached[idxQueue])
    821816        {
    822             LogFunc(("%s Waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     817            Log7Func(("%s Waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    823818            rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[idxQueue].hEvtProcess);
    824819            AssertRCReturn(rc, rc);
     
    839834    RT_NOREF(pThisCC);
    840835
    841     LogFunc(("%s SAVE EXEC!!\n", INSTANCE(pThis)));
     836    Log7Func(("%s SAVE EXEC!!\n", INSTANCE(pThis)));
    842837
    843838    for (int idxQueue = 0; idxQueue < pThis->cVirtQueues; idxQueue++)
     
    865860    /** @todo create test to conclusively determine I/O has been quiesced and add it here: */
    866861
    867     LogFunc(("%s Device I/O activity quiesced: %s\n",
     862    Log7Func(("%s Device I/O activity quiesced: %s\n",
    868863        INSTANCE(pThis), virtioCoreGetStateChangeText(pThisCC->enmQuiescingFor)));
    869864
     
    911906{
    912907    PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    913     LogFunc(("%s\n", INSTANCE(pThis)));
     908    Log7Func(("%s\n", INSTANCE(pThis)));
    914909    pThis->fResetting = true;
    915910    virtioNetR3QuiesceDevice(pDevIns, kvirtIoVmStateChangedReset);
     
    924919    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    925920    PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC);
    926     LogFunc(("%s\n", INSTANCE(pThis)));
     921    Log7Func(("%s\n", INSTANCE(pThis)));
    927922
    928923    RT_NOREF2(pThis, pThisCC);
     
    937932{
    938933    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    939     LogFunc(("%s\n", INSTANCE(pThis)));
     934    Log7Func(("%s\n", INSTANCE(pThis)));
    940935
    941936    virtioNetR3SuspendOrPowerOff(pDevIns, kvirtIoVmStateChangedPowerOff);
     
    948943{
    949944    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    950     LogFunc(("%s \n", INSTANCE(pThis)));
     945    Log7Func(("%s \n", INSTANCE(pThis)));
    951946    virtioNetR3SuspendOrPowerOff(pDevIns, kvirtIoVmStateChangedSuspend);
    952947}
     
    959954    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    960955    PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC);
    961     LogFunc(("\n"));
     956    Log7Func(("\n"));
    962957
    963958    pThisCC->fQuiescing = false;
     
    975970        if (ASMAtomicReadBool(&pThisCC->aWorkers[idxQueue].fSleeping))
    976971        {
    977             Log6Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     972            Log7Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    978973            int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[idxQueue].hEvtProcess);
    979974            AssertRC(rc);
     
    10201015void virtioNetR3SetReadLed(PVIRTIONETR3 pThisR3, bool fOn)
    10211016{
    1022     Log6Func(("%s\n", fOn ? "on" : "off"));
     1017    Log10Func(("%s\n", fOn ? "on" : "off"));
    10231018    if (fOn)
    10241019        pThisR3->led.Asserted.s.fReading = pThisR3->led.Actual.s.fReading = 1;
     
    10361031void virtioNetR3SetWriteLed(PVIRTIONETR3 pThisR3, bool fOn)
    10371032{
    1038     Log6Func(("%s\n", fOn ? "on" : "off"));
     1033    Log10Func(("%s\n", fOn ? "on" : "off"));
    10391034    if (fOn)
    10401035        pThisR3->led.Asserted.s.fWriting = pThisR3->led.Actual.s.fWriting = 1;
     
    10601055    if (!pThis->fVirtioReady)
    10611056    {
    1062         LogFunc(("%s %s VirtIO not ready (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));
     1057        Log8Func(("%s %s VirtIO not ready (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));
    10631058    }
    10641059    else if (!virtioCoreIsQueueEnabled(&pThis->Virtio, RXQIDX_QPAIR(idxQueue)))
    10651060    {
    1066         LogFunc(("%s %s queue not enabled (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));
     1061        Log8Func(("%s %s queue not enabled (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));
    10671062    }
    10681063    else if (virtioCoreQueueIsEmpty(pDevIns, &pThis->Virtio, RXQIDX_QPAIR(idxQueue)))
    10691064    {
    1070         LogFunc(("%s %s queue is empty (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));
     1065        Log8Func(("%s %s queue is empty (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));
    10711066        virtioCoreQueueSetNotify(&pThis->Virtio, RXQIDX_QPAIR(idxQueue), true);
    10721067    }
    10731068    else
    10741069    {
    1075         LogFunc(("%s %s ready with available buffers\n", LOGPARAMS));
     1070        Log8Func(("%s %s ready with available buffers\n", LOGPARAMS));
    10761071        virtioCoreQueueSetNotify(&pThis->Virtio, RXQIDX_QPAIR(idxQueue), false);
    10771072        return VINF_SUCCESS;
     
    11241119    if (virtioNetR3AreRxBufsAvail(pDevIns, pThis))
    11251120    {
    1126             LogFunc(("%s Rx bufs now available, releasing waiter...\n", INSTANCE(pThis)));
     1121            Log10Func(("%s Rx bufs now available, releasing waiter...\n", INSTANCE(pThis)));
    11271122            return VINF_SUCCESS;
    11281123    }
     
    11371132        if (virtioNetR3AreRxBufsAvail(pDevIns, pThis))
    11381133        {
    1139                 LogFunc(("%s Rx bufs now available, releasing waiter...\n", INSTANCE(pThis)));
     1134                Log10Func(("%s Rx bufs now available, releasing waiter...\n", INSTANCE(pThis)));
    11401135                return VINF_SUCCESS;
    11411136        }
    1142         LogFunc(("%s Starved for guest Rx bufs, waiting %u ms ...\n",
     1137        Log9Func(("%s Starved for guest Rx bufs, waiting %u ms ...\n",
    11431138                 INSTANCE(pThis), timeoutMs));
    11441139
     
    11551150    ASMAtomicXchgBool(&pThis->fLeafWantsRxBuffers, false);
    11561151
    1157     LogFlowFunc(("%s Wait for Rx buffers available was interrupted\n", INSTANCE(pThis)));
     1152    Log7Func(("%s Wait for Rx buffers available was interrupted\n", INSTANCE(pThis)));
    11581153    return VERR_INTERRUPTED;
    11591154}
     
    12501245static bool virtioNetR3AddressFilter(PVIRTIONET pThis, const void *pvBuf, size_t cb)
    12511246{
    1252     LogFunc(("%s\n", INSTANCE(pThis)));
     1247
     1248    if (LogIs11Enabled())
     1249    {
     1250        char *pszType;
     1251        if (virtioNetR3IsMulticast(pvBuf))
     1252            pszType = (char *)"Multicast";
     1253        else if (virtioNetR3IsBroadcast(pvBuf))
     1254            pszType = (char *)"Broadcast";
     1255        else
     1256            pszType = (char *)"Unicast";
     1257
     1258        LogFunc(("%s node(%RTmac %s%s), pkt(%RTmac %s)",
     1259                 INSTANCE(pThis), pThis->virtioNetConfig.uMacAddress.au8,
     1260                 pThis->fPromiscuous ? "promiscuous" : "",
     1261                 pThis->fAllMulticast ? " all-multicast" : "",
     1262                 pvBuf,  pszType));
     1263    }
    12531264
    12541265    if (pThis->fPromiscuous)
     
    12621273        && !ASMBitTest(pThis->aVlanFilter, RT_BE2H_U16(uPtr[7]) & 0xFFF))
    12631274    {
    1264         Log4Func(("%s not our VLAN, returning false\n", INSTANCE(pThis)));
     1275        Log11Func(("\n%s not our VLAN, returning false\n", INSTANCE(pThis)));
    12651276        return false;
    12661277    }
    12671278
     1279uint8_t src[6] = { 0xA8, 0x20, 0x66, 0x57, 0x50, 0x3C };
     1280uint8_t dst[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
     1281if (memcmp(pvBuf, dst, 6) == 0 && memcmp(((uint8_t *)pvBuf) + 6, src, 6) == 0)
     1282{
     1283    pThis->fLog = true;
     1284    virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
     1285}
     1286
    12681287    if (virtioNetR3IsBroadcast(pvBuf))
     1288    {
     1289        Log11(("... accept (broadcast)\n"));
     1290        if (LogIs12Enabled())
     1291            virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
    12691292        return true;
    1270 
     1293    }
    12711294    if (pThis->fAllMulticast && virtioNetR3IsMulticast(pvBuf))
     1295    {
     1296        Log11(("... accept (all-multicast mode)\n"));
     1297        if (LogIs12Enabled())
     1298            virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
    12721299        return true;
     1300    }
    12731301
    12741302    if (!memcmp(pThis->virtioNetConfig.uMacAddress.au8, pvBuf, sizeof(RTMAC)))
     1303    {
     1304        Log11((". . . accept (direct to this node)\n"));
     1305        if (LogIs12Enabled())
     1306            virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
    12751307        return true;
    1276 
    1277     Log4Func(("%s : %RTmac (conf) != %RTmac (dest)\n",
    1278         INSTANCE(pThis), pThis->virtioNetConfig.uMacAddress.au8, pvBuf));
     1308    }
    12791309
    12801310    for (uint16_t i = 0; i < pThis->cMulticastFilterMacs; i++)
     1311    {
    12811312        if (!memcmp(&pThis->aMacMulticastFilter[i], pvBuf, sizeof(RTMAC)))
     1313        {
     1314            Log11(("... accept (in multicast array)\n"));
     1315            if (LogIs12Enabled())
     1316                virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
    12821317            return true;
     1318        }
     1319    }
    12831320
    12841321    /** @todo Original combined unicast & multicast into one table. Should we distinguish? */
     
    12861323    for (uint16_t i = 0; i < pThis->cUnicastFilterMacs; i++)
    12871324        if (!memcmp(&pThis->aMacUnicastFilter[i], pvBuf, sizeof(RTMAC)))
     1325        {
     1326            Log11(("... accept (in unicast array)\n"));
    12881327            return true;
    1289 
    1290     Log2Func(("%s failed all tests, returning false, packet dump follows:\n",
    1291         INSTANCE(pThis)));
    1292 
    1293     virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
     1328        }
     1329
     1330    if (LogIs12Enabled())
     1331        Log(("... reject\n"));
    12941332
    12951333    return false;
     
    13161354    RT_NOREF(pThisCC);
    13171355
    1318     LogFunc(("%s\n", INSTANCE(pThis)));
     1356    LogFunc(("%s (%RTmac)\n", INSTANCE(pThis), pvBuf));
    13191357    VIRTIONET_PKT_HDR_T rxPktHdr;
    13201358
     
    13531391    }
    13541392
    1355     virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
     1393//    virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");
    13561394
    13571395    uint16_t cSegsAllocated = VIRTIONET_PREALLOCATE_RX_SEG_COUNT;
    13581396
    1359     PRTSGBUF pVirtSegBufToGuest = NULL;
    1360     PRTSGSEG paVirtSegsToGuest = (PRTSGSEG)RTMemAllocZ(sizeof(RTSGSEG) * cSegsAllocated);
     1397    PRTSGBUF pVirtSegBufToGuest = (PRTSGBUF)RTMemAllocZ(sizeof(RTSGBUF));
     1398    PRTSGSEG paVirtSegsToGuest  = (PRTSGSEG)RTMemAllocZ(sizeof(RTSGSEG) * cSegsAllocated);
    13611399    AssertReturn(paVirtSegsToGuest, VERR_NO_MEMORY);
    13621400
     
    13651403
    13661404    uint8_t fAddPktHdr = true;
    1367     uint32_t uOffset;
     1405    uint32_t uOffset = 0;
    13681406
    13691407    while (uOffset < cb)
     
    13931431        if (fAddPktHdr)
    13941432        {
     1433LogFunc(("Add pkthdr\n"));
    13951434            /* Lead with packet header */
    13961435            paVirtSegsToGuest[cSegs].cbSeg = sizeof(VIRTIONET_PKT_HDR_T);
     
    13981437            AssertReturn(paVirtSegsToGuest[0].pvSeg, VERR_NO_MEMORY);
    13991438
     1439            cbDescChainLeft -= sizeof(VIRTIONET_PKT_HDR_T);
     1440
     1441            memcpy(paVirtSegsToGuest[cSegs].pvSeg, &rxPktHdr, sizeof(VIRTIONET_PKT_HDR_T));
     1442
    14001443            /* Calculate & cache the field we will need to update later in gcPhys memory */
    14011444            gcPhysPktHdrNumBuffers = pDescChain->pSgPhysReturn->paSegs[0].gcPhys
    14021445                                     + RT_UOFFSETOF(VIRTIONET_PKT_HDR_T, uNumBuffers);
    14031446
    1404             if (cSegs++ >= cSegsAllocated)
    1405             {
    1406                 cSegsAllocated <<= 1; /* double the allocation size */
    1407                 paVirtSegsToGuest = (PRTSGSEG)RTMemRealloc(paVirtSegsToGuest, sizeof(RTSGSEG) * cSegsAllocated);
    1408                 AssertReturn(paVirtSegsToGuest, VERR_NO_MEMORY);
    1409             }
    1410 
    14111447            fAddPktHdr = false;
    1412             cbDescChainLeft -= sizeof(VIRTIONET_PKT_HDR_T);
    14131448        }
     1449        if (cSegs++ >= cSegsAllocated)
     1450        {
     1451            cSegsAllocated <<= 1; /* double the allocation size */
     1452            paVirtSegsToGuest = (PRTSGSEG)RTMemRealloc(paVirtSegsToGuest, sizeof(RTSGSEG) * cSegsAllocated);
     1453            AssertReturn(paVirtSegsToGuest, VERR_NO_MEMORY);
     1454        }
     1455LogFunc(("Add new post-hdr segment\n"));
    14141456
    14151457        /* Append remaining Rx pkt or as much current desc chain has room for */
     
    14211463
    14221464        RTSgBufInit(pVirtSegBufToGuest, paVirtSegsToGuest, cSegs);
    1423 
     1465//if (pThis->fLog)
     1466//    RT_BREAKPOINT();
     1467        Log7Func(("Send Rx pkt to guest...\n"));
    14241468        virtioCoreR3QueuePut(pDevIns, &pThis->Virtio, RXQIDX_QPAIR(idxQueue),
    14251469                             pVirtSegBufToGuest, pDescChain, true);
     
    14381482    virtioCoreQueueSync(pDevIns, &pThis->Virtio, RXQIDX_QPAIR(idxQueue));
    14391483
    1440     for (int i = 0; i < 2; i++)
    1441         RTMemFree(paVirtSegsToGuest[i].pvSeg);
     1484//    for (int i = 0; i < cSegs; i++)
     1485//        RTMemFree(paVirtSegsToGuest[i].pvSeg);
    14421486
    14431487    RTMemFree(paVirtSegsToGuest);
    14441488    RTMemFree(pVirtSegBufToGuest);
    14451489
     1490    Log7(("\n"));
    14461491    if (uOffset < cb)
    14471492    {
     
    14491494        return VERR_TOO_MUCH_DATA;
    14501495    }
    1451 
     1496pThis->fLog = false;
    14521497    return VINF_SUCCESS;
    14531498}
     
    14591504                                               size_t cb, PCPDMNETWORKGSO pGso)
    14601505{
    1461 LogFunc(("\n"));
    14621506    PVIRTIONETCC    pThisCC = RT_FROM_MEMBER(pInterface, VIRTIONETCC, INetworkDown);
    14631507    PPDMDEVINS      pDevIns = pThisCC->pDevIns;
     
    15021546    }
    15031547
    1504     Log2Func(("%s pvBuf=%p cb=%u pGso=%p\n", INSTANCE(pThis), pvBuf, cb, pGso));
     1548    Log10Func(("%s pvBuf=%p cb=%3u pGso=%p ...", INSTANCE(pThis), pvBuf, cb, pGso));
    15051549
    15061550    /** @todo If we ever start using more than one Rx/Tx queue pair, is a random queue
     
    16581702            virtioNetR3PullChain(pDevIns, pThis, pDescChain, &cMacs, sizeof(cMacs));
    16591703            cbRemaining -= sizeof(cMacs);
    1660             Log6Func(("%s Guest provided %d unicast MAC Table entries\n", INSTANCE(pThis), cMacs));
     1704            Log7Func(("%s Guest provided %d unicast MAC Table entries\n", INSTANCE(pThis), cMacs));
    16611705            if (cMacs)
    16621706            {
     
    16721716            virtioNetR3PullChain(pDevIns, pThis, pDescChain, &cMacs, sizeof(cMacs));
    16731717            cbRemaining -= sizeof(cMacs);
    1674             Log6Func(("%s Guest provided %d multicast MAC Table entries\n", INSTANCE(pThis), cMacs));
     1718            Log10Func(("%s Guest provided %d multicast MAC Table entries\n", INSTANCE(pThis), cMacs));
    16751719            if (cMacs)
    16761720            {
     
    17551799                         RT_MIN(pDescChain->cbPhysSend, sizeof(VIRTIONET_CTRL_HDR_T)));
    17561800
    1757     Log6Func(("%s CTRL COMMAND: class=%d command=%d\n", INSTANCE(pThis), pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd));
     1801    Log7Func(("%s CTRL COMMAND: class=%d command=%d\n", INSTANCE(pThis), pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd));
    17581802
    17591803    uint8_t uAck;
     
    17831827            }
    17841828            pThis->virtioNetConfig.uStatus &= ~VIRTIONET_F_ANNOUNCE;
    1785             Log6Func(("%s Clearing VIRTIONET_F_ANNOUNCE in config status\n", INSTANCE(pThis)));
     1829            Log7Func(("%s Clearing VIRTIONET_F_ANNOUNCE in config status\n", INSTANCE(pThis)));
    17861830            break;
    17871831
     
    18761920                               PPDMNETWORKGSO pGso, PVIRTIONET_PKT_HDR_T pPktHdr)
    18771921{
     1922LogFunc(("\n"));
    18781923    virtioNetR3PacketDump(pThis, (uint8_t *)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, "--> Outgoing");
    18791924    if (pGso)
     
    19261971                                         uint16_t idxQueue, bool fOnWorkerThread)
    19271972{
     1973
     1974LogFunc(("\n"));
    19281975    PVIRTIOCORE pVirtio = &pThis->Virtio;
    19291976
     
    19632010    unsigned int cbPktHdr = sizeof(VIRTIONET_PKT_HDR_T);
    19642011
    1965     Log3Func(("%s About to transmit %d pending packets\n", INSTANCE(pThis),
    1966               virtioCoreR3QueuePendingCount(pVirtio->pDevIns, pVirtio, idxQueue)));
     2012    int cPkts = virtioCoreR3QueuePendingCount(pVirtio->pDevIns, pVirtio, idxQueue);
     2013    if (!cPkts)
     2014    {
     2015        LogFunc(("%s No packets to send found on %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     2016
     2017        if (pDrv)
     2018            pDrv->pfnEndXmit(pDrv);
     2019
     2020        ASMAtomicWriteU32(&pThis->uIsTransmitting, 0);
     2021        return;
     2022    }
     2023    LogFunc(("%s About to transmit %d pending packets\n", INSTANCE(pThis), cPkts));
    19672024
    19682025    virtioNetR3SetWriteLed(pThisCC, true);
     
    19732030    {
    19742031        if (RT_SUCCESS(rc))
    1975             Log6Func(("%s fetched descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     2032            Log10Func(("%s fetched descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    19762033        else
    19772034        {
    1978             LogFunc(("%s Failed find expected data on %s, rc = %Rrc\n", INSTANCE(pThis), VIRTQNAME(idxQueue), rc));
     2035            LogFunc(("%s failed to find expected data on %s, rc = %Rrc\n", INSTANCE(pThis), VIRTQNAME(idxQueue), rc));
    19792036            break;
    19802037        }
     
    20652122static DECLCALLBACK(void) virtioNetR3NetworkDown_XmitPending(PPDMINETWORKDOWN pInterface)
    20662123{
     2124    LogFunc(("\n"));
    20672125    PVIRTIONETCC    pThisCC = RT_FROM_MEMBER(pInterface, VIRTIONETCC, INetworkDown);
    20682126    PPDMDEVINS      pDevIns = pThisCC->pDevIns;
     
    20712129    /** @todo If we ever start using more than one Rx/Tx queue pair, is a random queue
    20722130          selection algorithm feasible or even necessary */
    2073     LogFunc(("\n"));
    20742131    virtioNetR3TransmitPendingPackets(pDevIns, pThis, pThisCC, TXQIDX_QPAIR(0), false /*fOnWorkerThread*/);
    20752132}
     
    20912148#endif
    20922149
    2093     Log6Func(("%s %s has available buffers\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     2150    Log10Func(("%s %s has available buffers\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    20942151
    20952152    if (IS_RX_QUEUE(idxQueue))
    20962153    {
    2097         LogFunc(("%s Receive buffers have been added, waking Rx thread.\n",
     2154        Log10Func(("%s Receive buffers have been added, waking Rx thread.\n",
    20982155            INSTANCE(pThis)));
    20992156        virtioNetR3WakeupRxBufWaiter(pDevIns);
     
    21062163            if (ASMAtomicReadBool(&pWorkerR3->fSleeping))
    21072164            {
    2108                 Log6Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     2165                Log10Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21092166                int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pWorker->hEvtProcess);
    21102167                AssertRC(rc);
     
    21402197            if (!fNotificationSent)
    21412198            {
    2142                 Log6Func(("%s %s worker sleeping...\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     2199                Log10Func(("%s %s worker sleeping...\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21432200                Assert(ASMAtomicReadBool(&pWorkerR3->fSleeping));
    21442201                int rc = PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pWorker->hEvtProcess, RT_INDEFINITE_WAIT);
     
    21512208                    continue;
    21522209                }
    2153                 Log6Func(("%s %s worker woken\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     2210                Log10Func(("%s %s worker woken\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21542211                ASMAtomicWriteBool(&pWorkerR3->fNotified, false);
    21552212            }
     
    21642221             if (IS_CTRL_QUEUE(idxQueue))
    21652222             {
    2166                  Log6Func(("%s fetching next descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     2223                 Log10Func(("%s fetching next descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21672224                 PVIRTIO_DESC_CHAIN_T pDescChain;
    21682225                 int rc = virtioCoreR3QueueGet(pDevIns, &pThis->Virtio, idxQueue, &pDescChain, true);
    21692226                 if (rc == VERR_NOT_AVAILABLE)
    21702227                 {
    2171                     Log6Func(("%s Nothing found in %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
     2228                    Log10Func(("%s Nothing found in %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));
    21722229                    continue;
    21732230                 }
     
    21762233             else if (IS_TX_QUEUE(idxQueue))
    21772234             {
    2178                  Log6Func(("%s Notified of data to transmit\n", INSTANCE(pThis)));
     2235LogFunc(("Worker thread notified of pending Xmit packets!!!!!!\n"));
     2236                 Log10Func(("%s Notified of data to transmit\n", INSTANCE(pThis)));
    21792237                 virtioNetR3TransmitPendingPackets(pDevIns, pThis, pThisCC,
    21802238                                                   idxQueue, true /* fOnWorkerThread */);
     
    22792337    bool fActiveLinkIsUp = (enmState == PDMNETWORKLINKSTATE_UP);
    22802338
    2281     LogFunc(("%s enmState=%d\n", INSTANCE(pThis), enmState));
     2339    Log7Func(("%s enmState=%d\n", INSTANCE(pThis), enmState));
    22822340    if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME)
    22832341    {
     
    23192377static int virtioNetR3DestroyWorkerThreads(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC)
    23202378{
    2321     LogFunc(("%s\n", INSTANCE(pThis)));
     2379    Log10Func(("%s\n", INSTANCE(pThis)));
    23222380    int rc = VINF_SUCCESS;
    23232381    for (unsigned idxQueue = 0; idxQueue < pThis->cVirtQueues; idxQueue++)
     
    23432401static int virtioNetR3CreateWorkerThreads(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC)
    23442402{
    2345     LogFunc(("%s\n", INSTANCE(pThis)));
    2346 
     2403    Log10Func(("%s\n", INSTANCE(pThis)));
    23472404    int rc = VINF_SUCCESS;
    23482405    /* Attach the queues and create worker threads for them: */
     
    23502407    {
    23512408        /* Skip creating threads for receive queues, only create for transmit queues & control queue */
    2352         if (IS_RX_QUEUE(idxQueue))
    2353             continue;
    2354 
    2355         rc = PDMDevHlpSUPSemEventCreate(pDevIns, &pThis->aWorkers[idxQueue].hEvtProcess);
    2356 
    2357         if (RT_FAILURE(rc))
    2358             return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    2359                                        N_("DevVirtioNET: Failed to create SUP event semaphore"));
    2360 
    2361         rc = PDMDevHlpThreadCreate(pDevIns, &pThisCC->aWorkers[idxQueue].pThread,
    2362                                    (void *)(uintptr_t)idxQueue, virtioNetR3WorkerThread,
    2363                                    virtioNetR3WakeupWorker, 0, RTTHREADTYPE_IO, VIRTQNAME(idxQueue));
    2364         if (rc != VINF_SUCCESS)
     2409        if (!IS_RX_QUEUE(idxQueue))
    23652410        {
    2366             LogRel(("Error creating thread for Virtual Queue %s: %Rrc\n", VIRTQNAME(idxQueue), rc));
    2367             return rc;
     2411            rc = PDMDevHlpSUPSemEventCreate(pDevIns, &pThis->aWorkers[idxQueue].hEvtProcess);
     2412
     2413            if (RT_FAILURE(rc))
     2414                return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     2415                                           N_("DevVirtioNET: Failed to create SUP event semaphore"));
     2416
     2417            rc = PDMDevHlpThreadCreate(pDevIns, &pThisCC->aWorkers[idxQueue].pThread,
     2418                                       (void *)(uintptr_t)idxQueue, virtioNetR3WorkerThread,
     2419                                       virtioNetR3WakeupWorker, 0, RTTHREADTYPE_IO, VIRTQNAME(idxQueue));
     2420            if (rc != VINF_SUCCESS)
     2421            {
     2422                LogRel(("Error creating thread for Virtual Queue %s: %Rrc\n", VIRTQNAME(idxQueue), rc));
     2423                return rc;
     2424            }
    23682425        }
    2369 
    23702426        pThis->afQueueAttached[idxQueue] = true;
    23712427    }
     
    23802436    PVIRTIONET     pThis     = RT_FROM_MEMBER(pVirtio,  VIRTIONET, Virtio);
    23812437    PVIRTIONETCC   pThisCC   = RT_FROM_MEMBER(pVirtioCC, VIRTIONETCC, Virtio);
    2382 
    2383     LogFunc(("%s\n", INSTANCE(pThis)));
    23842438
    23852439    pThis->fVirtioReady = fVirtioReady;
     
    23972451            (void) virtioCoreR3QueueAttach(&pThis->Virtio, idxQueue, VIRTQNAME(idxQueue));
    23982452            pThis->afQueueAttached[idxQueue] = true;
     2453            virtioCoreQueueIsEmpty(pThisCC->pDevIns, &pThis->Virtio, idxQueue);
    23992454            virtioCoreQueueSetNotify(&pThis->Virtio, idxQueue, true);
    24002455        }
     
    24052460
    24062461        pThis->virtioNetConfig.uStatus = pThis->fCableConnected ? VIRTIONET_F_LINK_UP : 0;
    2407         LogFunc(("%s Link is %s\n", INSTANCE(pThis), pThis->fCableConnected ? "up" : "down"));
     2462        Log7Func(("%s Link is %s\n", INSTANCE(pThis), pThis->fCableConnected ? "up" : "down"));
    24082463
    24092464        pThis->fPromiscuous  = true;
     
    24422497    PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC);
    24432498
    2444     LogFunc(("%s\n", INSTANCE(pThis)));
     2499    Log7Func(("%s\n", INSTANCE(pThis)));
    24452500    AssertLogRelReturnVoid(iLUN == 0);
    24462501
     
    24692524    RT_NOREF(fFlags);
    24702525
    2471     LogFunc(("%s", INSTANCE(pThis)));
     2526    Log7Func(("%s", INSTANCE(pThis)));
    24722527
    24732528    AssertLogRelReturn(iLUN == 0, VERR_PDM_NO_SUCH_LUN);
     
    25602615     * Quick initialization of the state data, making sure that the destructor always works.
    25612616     */
    2562     LogFunc(("PDM device instance: %d\n", iInstance));
     2617    Log7Func(("PDM device instance: %d\n", iInstance));
    25632618
    25642619
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