Changeset 41407 in vbox
- Timestamp:
- May 22, 2012 5:53:33 PM (13 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r41123 r41407 1046 1046 1047 1047 bool Alignment2[3]; 1048 uint32_t Alignment3; 1048 /** Link up delay (in milliseconds). */ 1049 uint32_t uLinkUpDelay; 1049 1050 1050 1051 /** All: Device register storage. */ … … 2164 2165 2165 2166 2167 /** 2168 * Bring the link up after the configured delay, 5 seconds by default. 2169 * 2170 * @param pState The device state structure. 2171 * @thread any 2172 */ 2173 DECLINLINE(void) e1kBringLinkUpDelayed(E1KSTATE* pState) 2174 { 2175 E1kLog(("%s Will bring up the link in %d seconds...\n", 2176 INSTANCE(pState), pState->uLinkUpDelay / 1000)); 2177 e1kArmTimer(pState, pState->CTX_SUFF(pLUTimer), pState->uLinkUpDelay * 1000); 2178 } 2179 2166 2180 #if 0 /* unused */ 2167 2181 /** … … 2232 2246 { 2233 2247 /* The driver indicates that we should bring up the link */ 2234 /* Do so in 5 seconds . */2235 e1k ArmTimer(pState, pState->CTX_SUFF(pLUTimer), 5000000);2248 /* Do so in 5 seconds (by default). */ 2249 e1kBringLinkUpDelayed(pState); 2236 2250 /* 2237 2251 * Change the status (but not PHY status) anyway as Windows expects … … 2873 2887 return; 2874 2888 2889 E1kLog(("%s e1kLinkUpTimer: Link is up\n", INSTANCE(pState))); 2875 2890 STATUS |= STATUS_LU; 2876 2891 Phy::setLinkStatus(&pState->phy, true); … … 5897 5912 if (fNewUp) 5898 5913 { 5899 E1kLog(("%s Link will be up in approximately 5 secs\n", INSTANCE(pState))); 5914 E1kLog(("%s Link will be up in approximately %d secs\n", 5915 INSTANCE(pState), pState->uLinkUpDelay / 1000)); 5900 5916 pState->fCableConnected = true; 5901 5917 STATUS &= ~STATUS_LU; 5902 5918 Phy::setLinkStatus(&pState->phy, false); 5903 5919 e1kRaiseInterrupt(pState, VERR_SEM_BUSY, ICR_LSC); 5904 /* Restore the link back in 5 second . */5905 e1k ArmTimer(pState, pState->pLUTimerR3, 5000000);5920 /* Restore the link back in 5 seconds (by default). */ 5921 e1kBringLinkUpDelayed(pState); 5906 5922 } 5907 5923 else … … 6204 6220 */ 6205 6221 if ( (STATUS & STATUS_LU) 6206 && !PDMDevHlpVMTeleportedAndNotFullyResumedYet(pDevIns)) 6222 && !PDMDevHlpVMTeleportedAndNotFullyResumedYet(pDevIns) 6223 && pState->uLinkUpDelay) 6207 6224 { 6208 6225 E1kLog(("%s Link is down temporarily\n", INSTANCE(pState))); … … 6210 6227 Phy::setLinkStatus(&pState->phy, false); 6211 6228 e1kRaiseInterrupt(pState, VERR_SEM_BUSY, ICR_LSC); 6212 /* Restore the link back in five seconds . */6213 e1k ArmTimer(pState, pState->pLUTimerR3, 5000000);6229 /* Restore the link back in five seconds (default). */ 6230 e1kBringLinkUpDelayed(pState); 6214 6231 } 6215 6232 return VINF_SUCCESS; … … 6319 6336 Phy::setLinkStatus(&pState->phy, false); 6320 6337 e1kRaiseInterrupt(pState, VERR_SEM_BUSY, ICR_LSC); 6321 /* Restore the link back in 5 second . */6322 e1k ArmTimer(pState, pState->pLUTimerR3, 5000000);6338 /* Restore the link back in 5 seconds (default). */ 6339 e1kBringLinkUpDelayed(pState); 6323 6340 } 6324 6341 … … 6662 6679 if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "AdapterType\0" 6663 6680 "LineSpeed\0" "GCEnabled\0" "R0Enabled\0" 6664 "EthernetCRC\0" ))6681 "EthernetCRC\0" "LinkUpDelay\0")) 6665 6682 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 6666 6683 N_("Invalid configuration for E1000 device")); … … 6701 6718 return PDMDEV_SET_ERROR(pDevIns, rc, 6702 6719 N_("Configuration error: Failed to get the value of 'EthernetCRC'")); 6703 6704 E1kLog(("%s Chip=%s\n", INSTANCE(pState), g_Chips[pState->eChip].pcszName)); 6720 rc = CFGMR3QueryU32Def(pCfg, "LinkUpDelay", (uint32_t*)&pState->uLinkUpDelay, 5000); /* ms */ 6721 if (RT_FAILURE(rc)) 6722 return PDMDEV_SET_ERROR(pDevIns, rc, 6723 N_("Configuration error: Failed to get the value of 'LinkUpDelay'")); 6724 Assert(pState->uLinkUpDelay <= 300000); /* less than 5 minutes */ 6725 if (pState->uLinkUpDelay > 5000) 6726 { 6727 LogRel(("%s WARNING! Link up delay is set to %u seconds!\n", 6728 INSTANCE(pState), pState->uLinkUpDelay / 1000)); 6729 } 6730 else if (pState->uLinkUpDelay == 0) 6731 { 6732 LogRel(("%s WARNING! Link up delay is disabled!\n", INSTANCE(pState))); 6733 } 6734 6735 E1kLog(("%s Chip=%s LinkUpDelay=%ums\n", INSTANCE(pState), 6736 g_Chips[pState->eChip].pcszName, pState->uLinkUpDelay)); 6705 6737 6706 6738 /* Initialize state structure */ -
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r40766 r41407 272 272 bool fAm79C973; 273 273 uint32_t u32LinkSpeed; 274 uint32_t uLinkUpDelay; 275 uint32_t Alignment6; 274 276 275 277 STAMCOUNTER StatReceiveBytes; … … 4333 4335 pThis->aCSR[0] |= RT_BIT(15) | RT_BIT(13); /* ERR | CERR (this is probably wrong) */ 4334 4336 pThis->Led.Asserted.s.fError = pThis->Led.Actual.s.fError = 1; 4335 int rc = TMTimerSetMillies(pThis->pTimerRestore, 5000);4337 int rc = TMTimerSetMillies(pThis->pTimerRestore, pThis->uLinkUpDelay); 4336 4338 AssertRC(rc); 4337 4339 } … … 4776 4778 pThis->aCSR[0] |= RT_BIT(15) | RT_BIT(13); /* ERR | CERR (this is probably wrong) */ 4777 4779 pThis->Led.Asserted.s.fError = pThis->Led.Actual.s.fError = 1; 4778 int rc = TMTimerSetMillies(pThis->pTimerRestore, 5000);4780 int rc = TMTimerSetMillies(pThis->pTimerRestore, pThis->uLinkUpDelay); 4779 4781 AssertRC(rc); 4780 4782 } … … 5022 5024 * Validate configuration. 5023 5025 */ 5024 if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "Am79C973\0" "LineSpeed\0" "GCEnabled\0" "R0Enabled\0" "PrivIfEnabled\0" ))5026 if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "Am79C973\0" "LineSpeed\0" "GCEnabled\0" "R0Enabled\0" "PrivIfEnabled\0" "LinkUpDelay\0")) 5025 5027 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 5026 5028 N_("Invalid configuration for pcnet device")); … … 5063 5065 pThis->fR0Enabled = false; 5064 5066 #endif /* !PCNET_GC_ENABLED */ 5067 5068 rc = CFGMR3QueryU32Def(pCfg, "LinkUpDelay", (uint32_t*)&pThis->uLinkUpDelay, 5000); /* ms */ 5069 if (RT_FAILURE(rc)) 5070 return PDMDEV_SET_ERROR(pDevIns, rc, 5071 N_("Configuration error: Failed to get the value of 'LinkUpDelay'")); 5072 Assert(pThis->uLinkUpDelay <= 300000); /* less than 5 minutes */ 5073 if (pThis->uLinkUpDelay > 5000 || pThis->uLinkUpDelay < 100) 5074 { 5075 LogRel(("PCNet#%d WARNING! Link up delay is set to %u seconds!\n", 5076 iInstance, pThis->uLinkUpDelay / 1000)); 5077 } 5078 Log(("#%d Link up delay is set to %u seconds\n", 5079 iInstance, pThis->uLinkUpDelay / 1000)); 5065 5080 5066 5081 -
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r40282 r41407 161 161 /** True if physical cable is attached in configuration. */ 162 162 bool fCableConnected; 163 /** Link up delay (in milliseconds). */ 164 uint32_t uLinkUpDelay; 165 166 uint32_t alignment; 163 167 164 168 /** Number of packet being sent/received to show in debug log. */ … … 1592 1596 vpciRaiseInterrupt(&pState->VPCI, VERR_SEM_BUSY, VPCI_ISR_CONFIG); 1593 1597 /* Restore the link back in 5 seconds. */ 1594 int rc = TMTimerSetMillies(pState->pLinkUpTimer, 5000);1598 int rc = TMTimerSetMillies(pState->pLinkUpTimer, pState->uLinkUpDelay); 1595 1599 AssertRC(rc); 1596 1600 } … … 1935 1939 * Validate configuration. 1936 1940 */ 1937 if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "LineSpeed\0" ))1941 if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "LineSpeed\0" "LinkUpDelay\0")) 1938 1942 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 1939 1943 N_("Invalid configuration for VirtioNet device")); … … 1949 1953 return PDMDEV_SET_ERROR(pDevIns, rc, 1950 1954 N_("Configuration error: Failed to get the value of 'CableConnected'")); 1955 rc = CFGMR3QueryU32Def(pCfg, "LinkUpDelay", (uint32_t*)&pState->uLinkUpDelay, 5000); /* ms */ 1956 if (RT_FAILURE(rc)) 1957 return PDMDEV_SET_ERROR(pDevIns, rc, 1958 N_("Configuration error: Failed to get the value of 'LinkUpDelay'")); 1959 Assert(pState->uLinkUpDelay <= 300000); /* less than 5 minutes */ 1960 if (pState->uLinkUpDelay > 5000 || pState->uLinkUpDelay < 100) 1961 { 1962 LogRel(("%s WARNING! Link up delay is set to %u seconds!\n", 1963 INSTANCE(pState), pState->uLinkUpDelay / 1000)); 1964 } 1965 Log(("%s Link up delay is set to %u seconds\n", 1966 INSTANCE(pState), pState->uLinkUpDelay / 1000)); 1951 1967 1952 1968 /* Initialize PCI config space */
Note:
See TracChangeset
for help on using the changeset viewer.