Changeset 28666 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Apr 23, 2010 5:25:58 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 60537
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp ¶
r28624 r28666 1127 1127 1128 1128 /** 1129 * Lookup an address on the network, returning the (first) interface 1130 * having itin its address cache.1129 * Lookup an address on the network, returning the (first) interface having it 1130 * in its address cache. 1131 1131 * 1132 1132 * @returns Pointer to the interface on success, NULL if not found. The caller … … 4222 4222 AssertMsgFailed(("Not implemented because it wasn't required on Darwin\n")); 4223 4223 return ASMAtomicXchgBool(&pThis->fPhysSG, fEnable); 4224 } 4225 4226 4227 /** @copydoc INTNETTRUNKSWPORT::pfnReportMacAddress */ 4228 static DECLCALLBACK(void) intnetR0TrunkIfPortReportMacAddress(PINTNETTRUNKSWPORT pSwitchPort, PCRTMAC pMacAddr) 4229 { 4230 PINTNETTRUNKIF pThis = INTNET_SWITCHPORT_2_TRUNKIF(pSwitchPort); 4231 4232 /* 4233 * Get the network instance and grab the address spinlock before making 4234 * any changes. 4235 */ 4236 intnetR0BusyIncTrunk(pThis); 4237 PINTNETNETWORK pNetwork = pThis->pNetwork; 4238 if (pNetwork) 4239 { 4240 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 4241 RTSpinlockAcquireNoInts(pNetwork->hAddrSpinlock, &Tmp); 4242 4243 pNetwork->MacTab.HostMac = *pMacAddr; 4244 pThis->MacAddr = *pMacAddr; 4245 4246 RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock, &Tmp); 4247 } 4248 else 4249 pThis->MacAddr = *pMacAddr; 4250 intnetR0BusyDecTrunk(pThis); 4251 } 4252 4253 4254 /** @copydoc INTNETTRUNKSWPORT::pfnReportPromiscuousMode */ 4255 static DECLCALLBACK(void) intnetR0TrunkIfPortReportPromiscuousMode(PINTNETTRUNKSWPORT pSwitchPort, bool fPromiscuous) 4256 { 4257 PINTNETTRUNKIF pThis = INTNET_SWITCHPORT_2_TRUNKIF(pSwitchPort); 4258 4259 /* 4260 * Get the network instance and grab the address spinlock before making 4261 * any changes. 4262 */ 4263 intnetR0BusyIncTrunk(pThis); 4264 PINTNETNETWORK pNetwork = pThis->pNetwork; 4265 if (pNetwork) 4266 { 4267 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 4268 RTSpinlockAcquireNoInts(pNetwork->hAddrSpinlock, &Tmp); 4269 4270 pNetwork->MacTab.fHostPromiscuous = fPromiscuous; 4271 4272 RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock, &Tmp); 4273 } 4274 intnetR0BusyDecTrunk(pThis); 4224 4275 } 4225 4276 … … 4666 4717 pTrunk->SwitchPort.pfnSGRelease = intnetR0TrunkIfPortSGRelease; 4667 4718 pTrunk->SwitchPort.pfnSetSGPhys = intnetR0TrunkIfPortSetSGPhys; 4719 pTrunk->SwitchPort.pfnReportMacAddress = intnetR0TrunkIfPortReportMacAddress; 4720 pTrunk->SwitchPort.pfnReportPromiscuousMode = intnetR0TrunkIfPortReportPromiscuousMode; 4668 4721 pTrunk->SwitchPort.pfnReportGsoCapabilities = intnetR0TrunkIfPortReportGsoCapabilities; 4669 4722 pTrunk->SwitchPort.u32VersionEnd = INTNETTRUNKSWPORT_VERSION; … … 4697 4750 if (RT_SUCCESS(rc)) 4698 4751 { 4752 /* 4753 * There are a couple of bits in MacTab as well pertaining to the 4754 * trunk. We have to set this before it's reported. 4755 * 4756 * Note! We don't need to lock the MacTab here - creation time. 4757 */ 4758 pNetwork->MacTab.pTrunk = pTrunk; 4759 pNetwork->MacTab.HostMac = pTrunk->MacAddr; 4760 pNetwork->MacTab.fHostPromiscuous = false; 4761 pNetwork->MacTab.fHostActive = true; 4762 pNetwork->MacTab.fWirePromiscuous = false; /** @todo !!(fFlags & INTNET_OPEN_FLAGS_PROMISC_TRUNK_WIRE); */ 4763 pNetwork->MacTab.fWireActive = true; 4764 4699 4765 #ifdef IN_RING0 /* (testcase is ring-3) */ 4700 4766 /* … … 4705 4771 if (RT_SUCCESS(rc)) 4706 4772 { 4707 rc = pTrunkFactory->pfnCreateAndConnect(pTrunkFactory, pNetwork->szTrunk, &pTrunk->SwitchPort, 4773 rc = pTrunkFactory->pfnCreateAndConnect(pTrunkFactory, 4774 pNetwork->szTrunk, 4775 &pTrunk->SwitchPort, 4708 4776 pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE 4709 ? INTNETTRUNKFACTORY_FLAG_NO_PROMISC : 0, 4777 ? INTNETTRUNKFACTORY_FLAG_NO_PROMISC 4778 : 0, 4710 4779 &pTrunk->pIfPort); 4711 4780 pTrunkFactory->pfnRelease(pTrunkFactory); … … 4713 4782 { 4714 4783 Assert(pTrunk->pIfPort); 4715 pNetwork->MacTab.pTrunk = pTrunk;4716 4717 /*4718 * Query the host info.4719 *4720 * Note! We don't need to lock the MacTab here since the4721 * network is being created.4722 */4723 /** @todo this should be reported by VBoxNet* instead of queried by us! */4724 intnetR0TrunkIfOutLock(pTrunk);4725 4726 pTrunk->pIfPort->pfnGetMacAddress(pTrunk->pIfPort, &pTrunk->MacAddr);4727 pNetwork->MacTab.HostMac = pTrunk->MacAddr;4728 4729 pNetwork->MacTab.fHostPromiscuous = pTrunk->pIfPort->pfnIsPromiscuous(pTrunk->pIfPort);4730 pNetwork->MacTab.fHostActive = true;4731 4732 pNetwork->MacTab.fWirePromiscuous = false; /** @todo !!(fFlags & INTNET_OPEN_FLAGS_PROMISC_TRUNK_WIRE); */4733 pNetwork->MacTab.fWireActive = true;4734 4735 intnetR0TrunkIfOutUnlock(pTrunk);4736 4784 4737 4785 Log(("intnetR0NetworkCreateTrunkIf: VINF_SUCCESS - pszName=%s szTrunk=%s%s Network=%s\n", … … 4743 4791 rc = VERR_NOT_SUPPORTED; 4744 4792 #endif /* IN_RING3 */ 4793 4794 pNetwork->MacTab.pTrunk = NULL; 4795 pNetwork->MacTab.fHostActive = false; 4796 pNetwork->MacTab.fWireActive = false; 4745 4797 } 4746 4798
Note:
See TracChangeset
for help on using the changeset viewer.