Changeset 20672 in vbox for trunk/src/VBox/Devices/Network/DevE1000.cpp
- Timestamp:
- Jun 17, 2009 3:52:28 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 48771
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r20374 r20672 5036 5036 } 5037 5037 5038 5039 #ifdef VBOX_DYNAMIC_NET_ATTACH 5040 /** 5041 * Detach notification. 5042 * 5043 * One port on the network card has been disconnected from the network. 5044 * 5045 * @param pDevIns The device instance. 5046 * @param iLUN The logical unit which is being detached. 5047 */ 5048 static DECLCALLBACK(void) e1kDetach(PPDMDEVINS pDevIns, unsigned iLUN) 5049 { 5050 E1KSTATE *pState = PDMINS_2_DATA(pDevIns, E1KSTATE*); 5051 Log(("%s e1kDetach:\n", INSTANCE(pState))); 5052 5053 AssertLogRelReturnVoid(iLUN == 0); 5054 5055 PDMCritSectEnter(&pState->cs, VERR_SEM_BUSY); 5056 5057 /** @todo: r=pritesh still need to check if i missed 5058 * to clean something in this function 5059 */ 5060 5061 /* 5062 * Zero some important members. 5063 */ 5064 pState->pDrvBase = NULL; 5065 pState->pDrv = NULL; 5066 5067 PDMCritSectLeave(&pState->cs); 5068 } 5069 5070 5071 /** 5072 * Attach the Network attachment. 5073 * 5074 * One port on the network card has been connected to a network. 5075 * 5076 * @returns VBox status code. 5077 * @param pDevIns The device instance. 5078 * @param iLUN The logical unit which is being attached. 5079 * 5080 * @remarks This code path is not used during construction. 5081 */ 5082 static DECLCALLBACK(int) e1kAttach(PPDMDEVINS pDevIns, unsigned iLUN) 5083 { 5084 E1KSTATE *pState = PDMINS_2_DATA(pDevIns, E1KSTATE*); 5085 LogFlow(("%s e1kAttach:\n", INSTANCE(pState))); 5086 5087 AssertLogRelReturn(iLUN == 0, VERR_PDM_NO_SUCH_LUN); 5088 5089 PDMCritSectEnter(&pState->cs, VERR_SEM_BUSY); 5090 5091 /* 5092 * Attach the driver. 5093 */ 5094 int rc = PDMDevHlpDriverAttach(pDevIns, 0, &pState->IBase, &pState->pDrvBase, "Network Port"); 5095 if (RT_SUCCESS(rc)) 5096 { 5097 if (rc == VINF_NAT_DNS) 5098 { 5099 #ifdef RT_OS_LINUX 5100 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "NoDNSforNAT", 5101 N_("A Domain Name Server (DNS) for NAT networking could not be determined. Please check your /etc/resolv.conf for <tt>nameserver</tt> entries. Either add one manually (<i>man resolv.conf</i>) or ensure that your host is correctly connected to an ISP. If you ignore this warning the guest will not be able to perform nameserver lookups and it will probably observe delays if trying so")); 5102 #else 5103 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "NoDNSforNAT", 5104 N_("A Domain Name Server (DNS) for NAT networking could not be determined. Ensure that your host is correctly connected to an ISP. If you ignore this warning the guest will not be able to perform nameserver lookups and it will probably observe delays if trying so")); 5105 #endif 5106 } 5107 pState->pDrv = (PPDMINETWORKCONNECTOR)pState->pDrvBase->pfnQueryInterface(pState->pDrvBase, PDMINTERFACE_NETWORK_CONNECTOR); 5108 if (!pState->pDrv) 5109 { 5110 AssertMsgFailed(("Failed to obtain the PDMINTERFACE_NETWORK_CONNECTOR interface!\n")); 5111 rc = VERR_PDM_MISSING_INTERFACE_BELOW; 5112 } 5113 } 5114 else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 5115 Log(("%s No attached driver!\n", INSTANCE(pState))); 5116 5117 5118 /* 5119 * Temporary set the link down if it was up so that the guest 5120 * will know that we have change the configuration of the 5121 * network card 5122 */ 5123 if ((STATUS & STATUS_LU) && RT_SUCCESS(rc)) 5124 { 5125 STATUS &= ~STATUS_LU; 5126 Phy::setLinkStatus(&pState->phy, false); 5127 e1kRaiseInterrupt(pState, ICR_LSC); 5128 /* Restore the link back in 5 second. */ 5129 e1kArmTimer(pState, pState->pLUTimer, 5000000); 5130 } 5131 5132 PDMCritSectLeave(&pState->cs); 5133 return rc; 5134 5135 } 5136 #endif /* VBOX_DYNAMIC_NET_ATTACH */ 5137 5138 5038 5139 /** 5039 5140 * @copydoc FNPDMDEVPOWEROFF … … 5089 5190 /* Resume notification - optional. */ 5090 5191 NULL, 5192 #ifdef VBOX_DYNAMIC_NET_ATTACH 5193 /* Attach command - optional. */ 5194 e1kAttach, 5195 /* Detach notification - optional. */ 5196 e1kDetach, 5197 #else /* !VBOX_DYNAMIC_NET_ATTACH */ 5091 5198 /* Attach command - optional. */ 5092 5199 NULL, 5093 5200 /* Detach notification - optional. */ 5094 5201 NULL, 5202 #endif /* !VBOX_DYNAMIC_NET_ATTACH */ 5095 5203 /* Query a LUN base interface - optional. */ 5096 5204 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.