VirtualBox

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


Ignore:
Timestamp:
Sep 1, 2021 4:47:14 PM (3 years ago)
Author:
vboxsync
Message:

Dev/VirtioNet: Notify the guest of link state change after restoring VM state. Do not run TX loop if disconnected.

File:
1 edited

Legend:

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

    r90447 r91069  
    652652    VNET_R3_CS_ENTER_RETURN_VOID(pDevIns, pThis);
    653653
    654     pThis->config.uStatus |= VNET_S_LINK_UP;
    655     vnetR3RaiseInterrupt(pDevIns, pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
    656     vnetWakeupReceive(pDevIns);
     654    Log(("%s vnetR3LinkUpTimer: connected=%s\n", INSTANCE(pThis), vnetR3IsConnected(pDevIns)?"true":"false"));
     655    /* Do not bring up the link if the device is not connected. */
     656    if (vnetR3IsConnected(pDevIns))
     657    {
     658        pThis->config.uStatus |= VNET_S_LINK_UP;
     659        vnetR3RaiseInterrupt(pDevIns, pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);
     660        vnetWakeupReceive(pDevIns);
     661    }
    657662
    658663    vnetR3CsLeave(pDevIns, pThis);
     
    15921597            Log(("vnetR3TxThread: enable kicking and get to sleep\n"));
    15931598            vringSetNotification(pDevIns, &pThisCC->pTxQueue->VRing, true);
    1594             if (vqueueIsEmpty(pDevIns, pThisCC->pTxQueue))
     1599            /*
     1600             * Break out of the loop if the device is not connected. Otherwise we will
     1601             * end up in a tight loop, not being able to transmit, if there is something
     1602             * in TX queue. See @bugref{10096}.
     1603             */
     1604            if (vqueueIsEmpty(pDevIns, pThisCC->pTxQueue) || !vnetR3IsConnected(pDevIns))
    15951605                break;
    15961606            vringSetNotification(pDevIns, &pThisCC->pTxQueue->VRing, false);
     
    19992009        }
    20002010    }
     2011    Log(("%s State has been restored\n", INSTANCE(pThis)));
    20012012
    20022013    return rc;
     
    20212032     */
    20222033    if (!PDMDevHlpVMTeleportedAndNotFullyResumedYet(pDevIns))
     2034    {
     2035        /*
     2036         * Since we do not restore the link state, we pretend it is up, so it will be
     2037         * lowered by vnetR3TempLinkDown, and the guest will be notified. The actual state
     2038         * of the link will be determined later by vnetR3IsConnected in vnetR3LinkUpTimer.
     2039         * See @bugref{10096}.
     2040         */
     2041        pThis->config.uStatus |= VNET_S_LINK_UP;
    20232042        vnetR3TempLinkDown(pDevIns, pThis, pThisCC);
     2043    }
    20242044
    20252045    return VINF_SUCCESS;
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