Changeset 38140 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt
- Timestamp:
- Jul 25, 2011 10:01:03 AM (13 years ago)
- Location:
- trunk/src/VBox/HostDrivers/VBoxNetFlt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h
r36956 r38140 184 184 /** Handle to list of created VNICs. */ 185 185 list_t hVNICs; 186 /** Instance number while creating VNICs. */187 uint64_t uInstance;188 186 /** The MAC address of the host interface. */ 189 187 RTMAC MacAddr; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c
r37766 r38140 242 242 /** The (common) global data. */ 243 243 static VBOXNETFLTGLOBALS g_VBoxNetFltSolarisGlobals; 244 /** Global next-free VNIC Id (never decrements). */ 245 static volatile uint64_t g_VBoxNetFltSolarisVNICId = 0; 244 246 245 247 … … 254 256 LOCAL int vboxNetFltSolarisReportInfo(PVBOXNETFLTINS pThis, mac_handle_t hInterface, bool fIsVNIC); 255 257 LOCAL int vboxNetFltSolarisInitVNIC(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC); 256 LOCAL int vboxNetFltSolarisInitVNICTemplate(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC, PVBOXNETFLTVNICTEMPLATE pVNICTemplate);258 LOCAL int vboxNetFltSolarisInitVNICTemplate(PVBOXNETFLTINS pThis, PVBOXNETFLTVNICTEMPLATE pVNICTemplate); 257 259 LOCAL PVBOXNETFLTVNIC vboxNetFltSolarisAllocVNIC(void); 258 260 LOCAL void vboxNetFltSolarisFreeVNIC(PVBOXNETFLTVNIC pVNIC); … … 876 878 * 877 879 * @param pThis The VM connection instance. 878 * @param pVNIC Pointer to the VNIC.879 880 * @param pVNICTemplate Pointer to a VNIC template to initialize. 880 881 * 881 882 * @returns VBox status code. 882 883 */ 883 LOCAL int vboxNetFltSolarisInitVNICTemplate(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC, PVBOXNETFLTVNICTEMPLATE pVNICTemplate)884 LOCAL int vboxNetFltSolarisInitVNICTemplate(PVBOXNETFLTINS pThis, PVBOXNETFLTVNICTEMPLATE pVNICTemplate) 884 885 { 885 886 LogFlow((DEVICE_NAME ":vboxNetFltSolarisInitVNICTemplate pThis=%p pVNIC=%p pVNICTemplate=%p\n", pThis, pVNIC, pVNICTemplate)); … … 1061 1062 AssertReturn(ppVNIC, VERR_INVALID_POINTER); 1062 1063 1064 int rc = VERR_INVALID_STATE; 1063 1065 PVBOXNETFLTVNIC pVNIC = vboxNetFltSolarisAllocVNIC(); 1064 1066 if (RT_UNLIKELY(!pVNIC)) 1065 1067 return VERR_NO_MEMORY; 1066 1067 RTStrPrintf(pVNIC->szName, sizeof(pVNIC->szName), "%s%RU64", VBOXBOW_VNIC_NAME, pThis->u.s.uInstance);1068 1068 1069 1069 /* … … 1086 1086 int MacLen = sizeof(GuestMac); 1087 1087 uint32_t fFlags = 0; 1088 int rc = VERR_INVALID_STATE;1089 1088 1090 1089 if (pThis->u.s.fIsVNICTemplate) … … 1100 1099 * Initialize the VNIC template. 1101 1100 */ 1102 rc = vboxNetFltSolarisInitVNICTemplate(pThis, pVNIC , pVNIC->pVNICTemplate);1101 rc = vboxNetFltSolarisInitVNICTemplate(pThis, pVNIC->pVNICTemplate); 1103 1102 if (RT_FAILURE(rc)) 1104 1103 { … … 1124 1123 * be a physical interface. 1125 1124 */ 1125 rc = RTSemFastMutexRequest(g_VBoxNetFltSolarisMtx); AssertRC(rc); 1126 RTStrPrintf(pVNIC->szName, sizeof(pVNIC->szName), "%s%RU64", VBOXBOW_VNIC_NAME, g_VBoxNetFltSolarisVNICId); 1126 1127 rc = vnic_create(pVNIC->szName, pszLinkName, &AddrType, &MacLen, GuestMac.au8, &MacSlot, 0 /* Mac-Prefix Length */, uVLANId, 1127 1128 fFlags, &pVNIC->hLinkId, &Diag, NULL /* Reserved */); … … 1129 1130 { 1130 1131 pVNIC->fCreated = true; 1132 ASMAtomicIncU64(&g_VBoxNetFltSolarisVNICId); 1133 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 1131 1134 1132 1135 /* … … 1142 1145 if (RT_SUCCESS(rc)) 1143 1146 { 1144 pThis->u.s.uInstance++;1145 1147 LogFlow((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC successfully created VNIC '%s' over '%s' with random mac %.6Rhxs\n", 1146 1148 pVNIC->szName, pszLinkName, &GuestMac)); … … 1165 1167 else 1166 1168 { 1169 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 1170 1167 1171 LogRel((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC failed to create VNIC '%s' over '%s' rc=%d Diag=%d\n", pVNIC->szName, 1168 1172 pszLinkName, rc, Diag)); … … 1325 1329 pThis->u.s.fIsVNICTemplate = false; 1326 1330 list_create(&pThis->u.s.hVNICs, sizeof(VBOXNETFLTVNIC), offsetof(VBOXNETFLTVNIC, hNode)); 1327 pThis->u.s.uInstance = 0;1328 1331 pThis->u.s.hNotify = NULL; 1329 1332 RT_ZERO(pThis->u.s.MacAddr);
Note:
See TracChangeset
for help on using the changeset viewer.