Changeset 31323 in vbox for trunk/src/VBox
- Timestamp:
- Aug 2, 2010 6:18:22 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 64354
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r31322 r31323 3738 3738 * 3739 3739 * This function will update the active interface count on the network and 3740 * activate or deactivate the trunk connection if necessary. Note that in 3741 * order to do this it is necessary to abandond the network semaphore. 3740 * activate or deactivate the trunk connection if necessary. 3741 * 3742 * The call must own the giant lock (we cannot take it here). 3742 3743 * 3743 3744 * @returns VBox status code. … … 3757 3758 * to save us the extra hazzle. 3758 3759 */ 3759 PINTNET pIntNet = pNetwork->pIntNet;3760 int rc = RTSemMutexRequest(pIntNet->hMtxCreateOpenDestroy, RT_INDEFINITE_WAIT);3761 AssertRCReturn(rc, rc);3762 3763 3760 PINTNETTRUNKIF pTrunk = NULL; 3764 3761 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; … … 3806 3803 /* 3807 3804 * Tell the trunk if necessary. 3805 * The wait for !busy is for the Solaris streams trunk driver (mostly). 3808 3806 */ 3809 3807 if (pTrunk && pTrunk->pIfPort) … … 3814 3812 pTrunk->pIfPort->pfnSetState(pTrunk->pIfPort, fActive ? INTNETTRUNKIFSTATE_ACTIVE : INTNETTRUNKIFSTATE_INACTIVE); 3815 3813 } 3816 3817 RTSemMutexRelease(pIntNet->hMtxCreateOpenDestroy);3818 3814 3819 3815 return VINF_SUCCESS; … … 3851 3847 * tricky there wrt to locking order. 3852 3848 * 3853 * Note! We mark the interface busy so the network cannot be removed while 3854 * we're working on it - paranoia strikes again. 3855 */ 3856 intnetR0BusyIncIf(pIf); 3857 3858 int rc; 3859 PINTNETNETWORK pNetwork = pIf->pNetwork; 3860 if (pNetwork) 3861 rc = intnetR0NetworkSetIfActive(pNetwork, pIf, fActive); 3862 else 3863 rc = VERR_WRONG_ORDER; 3864 3865 intnetR0BusyDecIf(pIf); 3849 * 1. We take the giant lock here. This makes sure nobody is re-enabling 3850 * the network while we're pausing it and vice versa. This also enables 3851 * us to wait for the network to become idle before telling the trunk. 3852 * (Important on Solaris.) 3853 * 3854 * 2. For paranoid reasons, we grab a busy reference to the calling 3855 * interface. This is totally unnecessary but should hurt (when done 3856 * after grabbing the giant lock). 3857 */ 3858 int rc = RTSemMutexRequest(pIntNet->hMtxCreateOpenDestroy, RT_INDEFINITE_WAIT); 3859 if (RT_SUCCESS(rc)) 3860 { 3861 intnetR0BusyIncIf(pIf); 3862 3863 PINTNETNETWORK pNetwork = pIf->pNetwork; 3864 if (pNetwork) 3865 rc = intnetR0NetworkSetIfActive(pNetwork, pIf, fActive); 3866 else 3867 rc = VERR_WRONG_ORDER; 3868 3869 intnetR0BusyDecIf(pIf); 3870 RTSemMutexRelease(pIntNet->hMtxCreateOpenDestroy); 3871 } 3872 3866 3873 intnetR0IfRelease(pIf, pSession); 3874 LogFlow(("IntNetR0IfSetActive: returns %Rrc\n", rc)); 3867 3875 return rc; 3868 3876 }
Note:
See TracChangeset
for help on using the changeset viewer.