VirtualBox

Changeset 18118 in vbox for trunk/src


Ignore:
Timestamp:
Mar 20, 2009 1:43:11 PM (16 years ago)
Author:
vboxsync
Message:

E1000: properly connect/disconnect if the link status changes

File:
1 edited

Legend:

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

    r17183 r18118  
    42714271{
    42724272    E1KSTATE *pState = IFACE_TO_STATE(pInterface, INetworkConfig);
    4273     switch (enmState)
    4274     {
    4275         case PDMNETWORKLINKSTATE_UP:
     4273    bool fOldUp = !!(STATUS & STATUS_LU);
     4274    bool fNewUp = enmState == PDMNETWORKLINKSTATE_UP;
     4275
     4276    if (fNewUp != fOldUp)
     4277    {
     4278        if (fNewUp)
     4279        {
    42764280            E1kLog(("%s Link is up\n", INSTANCE(pState)));
    42774281            STATUS |= STATUS_LU;
    42784282            Phy::setLinkStatus(&pState->phy, true);
    4279             break;
    4280         case PDMNETWORKLINKSTATE_DOWN:
     4283        }
     4284        else
     4285        {
    42814286            E1kLog(("%s Link is down\n", INSTANCE(pState)));
    42824287            STATUS &= ~STATUS_LU;
    42834288            Phy::setLinkStatus(&pState->phy, false);
    4284             break;
    4285         case PDMNETWORKLINKSTATE_DOWN_RESUME:
    4286             /// @todo I failed to locate any references to this state,
    4287             /// looks like it is never used.
    4288             E1kLog(("%s Link is down temporarely\n", INSTANCE(pState)));
    4289             STATUS &= ~STATUS_LU;
    4290             Phy::setLinkStatus(&pState->phy, false);
    4291             break;
    4292         default:
    4293             E1kLog(("%s Invalid link state: %d\n", INSTANCE(pState), enmState));
    4294             return VERR_INVALID_PARAMETER;
    4295     }
    4296     e1kRaiseInterrupt(pState, VERR_SEM_BUSY, ICR_LSC);
     4289        }
     4290        e1kRaiseInterrupt(pState, VERR_SEM_BUSY, ICR_LSC);
     4291        if (pState->pDrv)
     4292            pState->pDrv->pfnNotifyLinkChanged(pState->pDrv, enmState);
     4293    }
    42974294    return VINF_SUCCESS;
    42984295}
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