VirtualBox

Ignore:
Timestamp:
Aug 27, 2021 5:42:02 AM (3 years ago)
Author:
vboxsync
Message:

Fixes issue in BugRef(8651) Comment #100

File:
1 edited

Legend:

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

    r90797 r90931  
    149149#define CTRLQIDX                        (FEATURE_ENABLED(MQ) ? ((VIRTIONET_MAX_QPAIRS - 1) * 2 + 2) : 2)
    150150
    151 #define IS_LINK_UP(pState)              (pState->virtioNetConfig.uStatus & VIRTIONET_F_LINK_UP)
     151#define IS_LINK_UP(pState)              !!(pState->virtioNetConfig.uStatus & VIRTIONET_F_LINK_UP)
    152152#define IS_LINK_DOWN(pState)            !IS_LINK_UP(pState)
    153153
     
    22792279    PVIRTIOCORE pVirtio = &pThis->Virtio;
    22802280
     2281
     2282    if (!pThis->fVirtioReady)
     2283    {
     2284        LogFunc(("%s Ignoring Tx requests. VirtIO not ready (status=0x%x).\n",
     2285                pThis->szInst, pThis->virtioNetConfig.uStatus));
     2286        return;
     2287    }
     2288
     2289    if (!pThis->fCableConnected)
     2290    {
     2291        Log(("%s Ignoring transmit requests while cable is disconnected.\n", pThis->szInst));
     2292        return;
     2293    }
     2294
    22812295    /*
    22822296     * Only one thread is allowed to transmit at a time, others should skip
     
    22872301        return;
    22882302
    2289 
    2290     if (!pThis->fVirtioReady)
    2291     {
    2292         LogFunc(("%s Ignoring Tx requests. VirtIO not ready (status=0x%x).\n",
    2293                 pThis->szInst, pThis->virtioNetConfig.uStatus));
    2294         return;
    2295     }
    2296 
    2297     if (!pThis->fCableConnected)
    2298     {
    2299         Log(("%s Ignoring transmit requests while cable is disconnected.\n", pThis->szInst));
    2300         return;
    2301     }
    23022303
    23032304
     
    24862487static void virtioNetR3TempLinkDown(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC)
    24872488{
     2489
    24882490    if (IS_LINK_UP(pThis))
    24892491    {
     
    25072509    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    25082510
    2509     bool fCachedLinkIsUp = IS_LINK_UP(pThis);
    2510     bool fActiveLinkIsUp = (enmState == PDMNETWORKLINKSTATE_UP);
     2511    bool fRequestedLinkStateIsUp = (enmState == PDMNETWORKLINKSTATE_UP);
    25112512
    25122513    if (LogIs7Enabled())
     
    25312532    if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME)
    25322533    {
    2533         if (fCachedLinkIsUp)
     2534
     2535        if (IS_LINK_UP(pThis))
    25342536        {
    25352537            /*
     
    25422544        }
    25432545    }
    2544     else if (fActiveLinkIsUp != fCachedLinkIsUp)
    2545     {
    2546         if (fCachedLinkIsUp)
     2546    else if (fRequestedLinkStateIsUp != IS_LINK_UP(pThis))
     2547    {
     2548        if (fRequestedLinkStateIsUp)
    25472549        {
    25482550            Log(("%s Link is up\n", pThis->szInst));
     
    25512553            virtioCoreNotifyConfigChanged(&pThis->Virtio);
    25522554        }
    2553         else /* cached Link state is down */
     2555        else /* Link requested to be brought down */
    25542556        {
    25552557            /* The link was brought down explicitly, make sure it won't come up by timer.  */
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