Changeset 47499 in vbox
- Timestamp:
- Jul 31, 2013 5:36:16 PM (11 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r47459 r47499 6424 6424 PE1KSTATE pThis = RT_FROM_MEMBER(pInterface, E1KSTATE, INetworkConfig); 6425 6425 bool fOldUp = !!(STATUS & STATUS_LU); 6426 bool fNewUp = enmState == PDMNETWORKLINKSTATE_UP; 6427 6426 bool fNewUp = enmState == PDMNETWORKLINKSTATE_UP || enmState == PDMNETWORKLINKSTATE_DOWN_RESUME; 6427 6428 /* old state was connected but STATUS not yet written by guest */ 6428 6429 if ( fNewUp != fOldUp 6429 || (!fNewUp && pThis->fCableConnected) ) /* old state was connected but STATUS not6430 * yet written by guest */6430 || (!fNewUp && pThis->fCableConnected) 6431 || (pThis->fCableConnected && enmState == PDMNETWORKLINKSTATE_DOWN_RESUME)) 6431 6432 { 6432 6433 if (fNewUp) … … 6449 6450 e1kRaiseInterrupt(pThis, VERR_SEM_BUSY, ICR_LSC); 6450 6451 } 6452 6451 6453 if (pThis->pDrvR3) 6452 pThis->pDrvR3->pfnNotifyLinkChanged(pThis->pDrvR3, enmState); 6454 { 6455 /* 6456 * Send a UP link state to the driver below if the network adapter is only 6457 * temproarily disconnected due to resume event. 6458 */ 6459 if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 6460 pThis->pDrvR3->pfnNotifyLinkChanged(pThis->pDrvR3, PDMNETWORKLINKSTATE_UP); 6461 else 6462 pThis->pDrvR3->pfnNotifyLinkChanged(pThis->pDrvR3, enmState); 6463 } 6453 6464 } 6454 6465 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r46456 r47499 4666 4666 PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkConfig); 4667 4667 bool fLinkUp; 4668 if ( enmState != PDMNETWORKLINKSTATE_DOWN 4669 && enmState != PDMNETWORKLINKSTATE_UP) 4670 { 4671 AssertMsgFailed(("Invalid parameter enmState=%d\n", enmState)); 4672 return VERR_INVALID_PARAMETER; 4673 } 4668 4669 AssertMsgReturn(enmState > PDMNETWORKLINKSTATE_INVALID && enmState <= PDMNETWORKLINKSTATE_DOWN_RESUME, 4670 ("Invalid link state: enmState=%d\n", enmState), VERR_INVALID_PARAMETER); 4674 4671 4675 4672 /* has the state changed? */ 4676 fLinkUp = enmState == PDMNETWORKLINKSTATE_UP; 4677 if (pThis->fLinkUp != fLinkUp) 4673 fLinkUp = enmState == PDMNETWORKLINKSTATE_UP || enmState == PDMNETWORKLINKSTATE_DOWN_RESUME; 4674 if ( pThis->fLinkUp != fLinkUp 4675 || enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 4678 4676 { 4679 4677 pThis->fLinkUp = fLinkUp; 4680 4678 if (fLinkUp) 4681 4679 { 4682 /* connect with a delay of 5 seconds*/4680 /* Connect with a configured delay. */ 4683 4681 pThis->fLinkTempDown = true; 4684 4682 pThis->cLinkDownReported = 0; … … 4697 4695 Assert(!PDMCritSectIsOwner(&pThis->CritSect)); 4698 4696 if (pThis->pDrvR3) 4699 pThis->pDrvR3->pfnNotifyLinkChanged(pThis->pDrvR3, enmState); 4697 { 4698 /* 4699 * Send a UP link state to the driver below if the network adapter is only 4700 * temproarily disconnected due to resume event. 4701 */ 4702 if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 4703 pThis->pDrvR3->pfnNotifyLinkChanged(pThis->pDrvR3, PDMNETWORKLINKSTATE_UP); 4704 else 4705 pThis->pDrvR3->pfnNotifyLinkChanged(pThis->pDrvR3, enmState); 4706 } 4700 4707 } 4701 4708 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r46904 r47499 998 998 PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkConfig); 999 999 bool fOldUp = !!(STATUS & VNET_S_LINK_UP); 1000 bool fNewUp = enmState == PDMNETWORKLINKSTATE_UP; 1001 1002 if (fNewUp != fOldUp) 1000 bool fNewUp = enmState == PDMNETWORKLINKSTATE_UP || enmState == PDMNETWORKLINKSTATE_DOWN_RESUME; 1001 1002 if ( fNewUp != fOldUp 1003 || enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 1003 1004 { 1004 1005 if (fNewUp) … … 1015 1016 } 1016 1017 if (pThis->pDrv) 1017 pThis->pDrv->pfnNotifyLinkChanged(pThis->pDrv, enmState); 1018 { 1019 /* 1020 * Send a UP link state to the driver below if the network adapter is only 1021 * temproarily disconnected due to resume event. 1022 */ 1023 if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 1024 pThis->pDrv->pfnNotifyLinkChanged(pThis->pDrv, PDMNETWORKLINKSTATE_UP); 1025 else 1026 pThis->pDrv->pfnNotifyLinkChanged(pThis->pDrv, enmState); 1027 } 1018 1028 } 1019 1029 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r46904 r47499 1035 1035 LogFlow(("drvR3IntNetPowerResume\n")); 1036 1036 PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET); 1037 VMRESUMEREASON enmReason = PDMDrvHlpVMGetResumeReason(pDrvIns); 1038 1037 1039 if (!pThis->fActivateEarlyDeactivateLate) 1038 1040 { … … 1042 1044 drvR3IntNetSetActive(pThis, true /* fActive */); 1043 1045 } 1044 if ( PDMDrvHlpVMTeleportedAndNotFullyResumedYet(pDrvIns) 1045 && pThis->pIAboveConfigR3) 1046 { 1047 /* 1048 * We've just been teleported and need to drop a hint to the switch 1049 * since we're likely to have changed to a different port. We just 1050 * push out some ethernet frame that doesn't mean anything to anyone. 1051 * For this purpose ethertype 0x801e was chosen since it was registered 1052 * to Sun (dunno what it is/was used for though). 1053 */ 1054 union 1046 1047 switch (enmReason) 1048 { 1049 case VMRESUMEREASON_HOST_RESUME: 1055 1050 { 1056 RTNETETHERHDR Hdr; 1057 uint8_t ab[128]; 1058 } Frame; 1059 RT_ZERO(Frame); 1060 Frame.Hdr.DstMac.au16[0] = 0xffff; 1061 Frame.Hdr.DstMac.au16[1] = 0xffff; 1062 Frame.Hdr.DstMac.au16[2] = 0xffff; 1063 Frame.Hdr.EtherType = RT_H2BE_U16_C(0x801e); 1064 int rc = pThis->pIAboveConfigR3->pfnGetMac(pThis->pIAboveConfigR3, &Frame.Hdr.SrcMac); 1065 if (RT_SUCCESS(rc)) 1066 rc = drvR3IntNetResumeSend(pThis, &Frame, sizeof(Frame)); 1067 if (RT_FAILURE(rc)) 1068 LogRel(("IntNet#%u: Sending dummy frame failed: %Rrc\n", pDrvIns->iInstance, rc)); 1069 } 1051 uint32_t u32TrunkType; 1052 int rc = CFGMR3QueryU32(pDrvIns->pCfg, "TrunkType", &u32TrunkType); 1053 AssertRC(rc); 1054 1055 /* 1056 * Only do the disconnect for bridged networking. Host-only and 1057 * internal networks are not affected by a host resume. 1058 */ 1059 if ( RT_SUCCESS(rc) 1060 && u32TrunkType == kIntNetTrunkType_NetFlt) 1061 { 1062 rc = pThis->pIAboveConfigR3->pfnSetLinkState(pThis->pIAboveConfigR3, 1063 PDMNETWORKLINKSTATE_DOWN_RESUME); 1064 AssertRC(rc); 1065 } 1066 break; 1067 } 1068 case VMRESUMEREASON_TELEPORTED: 1069 case VMRESUMEREASON_TELEPORT_FAILED: 1070 { 1071 if ( PDMDrvHlpVMTeleportedAndNotFullyResumedYet(pDrvIns) 1072 && pThis->pIAboveConfigR3) 1073 { 1074 /* 1075 * We've just been teleported and need to drop a hint to the switch 1076 * since we're likely to have changed to a different port. We just 1077 * push out some ethernet frame that doesn't mean anything to anyone. 1078 * For this purpose ethertype 0x801e was chosen since it was registered 1079 * to Sun (dunno what it is/was used for though). 1080 */ 1081 union 1082 { 1083 RTNETETHERHDR Hdr; 1084 uint8_t ab[128]; 1085 } Frame; 1086 RT_ZERO(Frame); 1087 Frame.Hdr.DstMac.au16[0] = 0xffff; 1088 Frame.Hdr.DstMac.au16[1] = 0xffff; 1089 Frame.Hdr.DstMac.au16[2] = 0xffff; 1090 Frame.Hdr.EtherType = RT_H2BE_U16_C(0x801e); 1091 int rc = pThis->pIAboveConfigR3->pfnGetMac(pThis->pIAboveConfigR3, 1092 &Frame.Hdr.SrcMac); 1093 if (RT_SUCCESS(rc)) 1094 rc = drvR3IntNetResumeSend(pThis, &Frame, sizeof(Frame)); 1095 if (RT_FAILURE(rc)) 1096 LogRel(("IntNet#%u: Sending dummy frame failed: %Rrc\n", 1097 pDrvIns->iInstance, rc)); 1098 } 1099 break; 1100 } 1101 default: /* ignore every other resume reason else */ 1102 break; 1103 } /* end of switch(enmReason) */ 1070 1104 } 1071 1105 -
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r45061 r47499 970 970 PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT); 971 971 drvNATSetMac(pThis); 972 } 973 974 975 /** 976 * @interface_method_impl{PDMDEVREG,pfnResume} 977 */ 978 static DECLCALLBACK(void) drvNATResume(PPDMDRVINS pDrvIns) 979 { 980 PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT); 981 VMRESUMEREASON enmReason = PDMDrvHlpVMGetResumeReason(pDrvIns); 982 983 switch (enmReason) 984 { 985 case VMRESUMEREASON_HOST_RESUME: 986 /* 987 * Host resumed from a suspend and the network might have changed. 988 * Disconnect the guest from the network temporarily to let it pick up the changes. 989 */ 990 pThis->pIAboveConfig->pfnSetLinkState(pThis->pIAboveConfig, 991 PDMNETWORKLINKSTATE_DOWN_RESUME); 992 return; 993 default: /* Ignore every other resume reason. */ 994 /* do nothing */ 995 return; 996 } 972 997 } 973 998 … … 1446 1471 NULL, 1447 1472 /* pfnResume */ 1448 NULL,1473 drvNATResume, 1449 1474 /* pfnAttach */ 1450 1475 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.