- Timestamp:
- Jun 30, 2008 5:00:39 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 32514
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/intnet.h
r9803 r10031 362 362 DECLR0CALLBACKMEMBER(bool, pfnRecvWire,(PINTNETTRUNKSWPORT pIfPort, PINTNETSG pSG)); 363 363 364 /** 365 * This is called by the pfnSendToHost and pfnSendToWire code when they are 366 * done with a SG. 367 * 368 * It may be called after they return if the frame was pushed in an 369 * async manner. 370 * 371 * @param pIfPort Pointer to this structure. 372 * @param pSG Pointer to the (scatter /) gather structure. 373 * 374 * @remarks Will grab the network semaphore. 375 */ 376 DECLR0CALLBACKMEMBER(void, pfnSGRelease,(PINTNETTRUNKIFPORT pIfPort, PINTNETSG pSG)); 377 364 378 /** Structure version number. (INTNETTRUNKSWPORT_VERSION) */ 365 379 uint32_t u32VersionEnd; … … 389 403 * 390 404 * @param pIfPort Pointer to this structure. 405 * 406 * @remarks The caller may own any locks. 391 407 */ 392 408 DECLR0CALLBACKMEMBER(void, pfnRetain,(PINTNETTRUNKIFPORT pIfPort)); … … 395 411 * Releases the object. 396 412 * 397 * This must be called for every pfnRetain call. Where possible, it 398 * should be executed without holding any locks unless the caller 399 * is certain it is not going to trigger the destructor. 400 * 401 * @param pIfPort Pointer to this structure. 413 * This must be called for every pfnRetain call. 414 * 415 * 416 * @param pIfPort Pointer to this structure. 417 * 418 * @remarks Where possible, it should be executed without holding any locks 419 * unless the caller is certain it is not going to trigger the destructor. 402 420 */ 403 421 DECLR0CALLBACKMEMBER(void, pfnRelease,(PINTNETTRUNKIFPORT pIfPort)); … … 410 428 * 411 429 * @param pIfPort Pointer to this structure. 430 * 431 * @remarks Called without holding any locks. 412 432 */ 413 433 DECLR0CALLBACKMEMBER(void, pfnDisconnectAndRelease,(PINTNETTRUNKIFPORT pIfPort)); … … 421 441 * the interface from the internal network, however, this might be done immediately 422 442 * before disconnecting and may leave an incoming frame waiting on the internal network 423 * semaphore. 443 * semaphore. So, after the final suspend a pfnWaitForIdle is always called to make sure 444 * the interface is idle before pfnDisconnectAndRelease is called. 424 445 * 425 446 * @returns The previous state. … … 444 465 * an indefinite wait. 445 466 * 446 * @remarks Will not grab any semaphores.467 * @remarks Called while *not* owning any semaphores. Will not grab anything. 447 468 */ 448 469 DECLR0CALLBACKMEMBER(bool, pfnWaitForIdle,(PINTNETTRUNKIFPORT pIfPort, uint32_t cMillies)); … … 467 488 * Tests whether the host is operating the interface is promiscuous mode. 468 489 * 469 * The default behavior of internal networking 'switch' is to 'autodetect'470 * promiscuous mode on the trunk port, which is whe rethis method is used.471 * For security reasons this default m y of course be overridden so that the490 * The default behavior of the internal networking 'switch' is to 'autodetect' 491 * promiscuous mode on the trunk port, which is when this method is used. 492 * For security reasons this default may of course be overridden so that the 472 493 * host cannot sniff at what's going on. 473 494 * … … 498 519 * allocating and copying. 499 520 * 500 * @remarks Called while owning the network semaphore? 521 * @remarks Called while owning the network semaphore. 522 * (Works on darwin, but may have to be relaxed later on other hosts.) 501 523 * 502 524 * @remarks TAP and NAT will use this interface for all their traffic, see pfnIsHostMac. … … 519 541 * allocating and copying. 520 542 * 521 * @remarks Called while owning the network semaphore? 543 * @remarks Called while owning the network semaphore. 544 * (Works on darwin, but may have to be relaxed later on other hosts.) 522 545 * 523 546 * @remarks TAP and NAT will call pfnSGRelease and return successfully. 524 547 */ 525 548 DECLR0CALLBACKMEMBER(int, pfnSendToWire,(PINTNETTRUNKIFPORT pIfPort, PINTNETSG pSG)); 526 527 /**528 * This is called by the pfnSendToHost and pfnSendToWire code when they are529 * done with a SG.530 *531 * It may be called after they return if the frame was pushed in an532 * async manner.533 *534 * @param pIfPort Pointer to this structure.535 * @param pSG Pointer to the (scatter /) gather structure.536 *537 * @remarks Will grab the network semaphore.538 */539 DECLR0CALLBACKMEMBER(void, pfnSGRelease,(PINTNETTRUNKIFPORT pIfPort, PINTNETSG pSG));540 549 541 550 /** Structure version number. (INTNETTRUNKIFPORT_VERSION) */ -
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r9694 r10031 82 82 /** The SUPR0 object id. */ 83 83 void *pvObj; 84 } INTNETIF, *PINTNETIF; 84 } INTNETIF; 85 typedef INTNETIF *PINTNETIF; 85 86 86 87 … … 108 109 /** The network name. */ 109 110 char szName[INTNET_MAX_NETWORK_NAME]; 110 } INTNETNETWORK, *PINTNETNETWORK; 111 } INTNETNETWORK; 112 typedef INTNETNETWORK *PINTNETNETWORK; 111 113 112 114 … … 117 119 { 118 120 /** Pointer to the object we're a handle for. */ 119 PINTNETIF pIF;121 PINTNETIF pIF; 120 122 /** Index to the next free entry. */ 121 uintptr_t iNext; 122 } INTNETHTE, *PINTNETHTE; 123 uintptr_t iNext; 124 } INTNETHTE; 125 typedef INTNETHTE *PINTNETHTE; 123 126 124 127 … … 129 132 { 130 133 /** Pointer to the handle table. */ 131 PINTNETHTE paEntries;134 PINTNETHTE paEntries; 132 135 /** The number of allocated handles. */ 133 uint32_t cAllocated;136 uint32_t cAllocated; 134 137 /** The index of the first free handle entry. 135 * ~0Umeans empty list. */136 uint32_t volatile iHead;138 * UINT32_MAX means empty list. */ 139 uint32_t volatile iHead; 137 140 /** The index of the last free handle entry. 138 * ~0U means empty list. */ 139 uint32_t volatile iTail; 140 } INTNETHT, *PINTNETHT; 141 * UINT32_MAX means empty list. */ 142 uint32_t volatile iTail; 143 } INTNETHT; 144 typedef INTNETHT *PINTNETHT; 141 145 142 146 … … 181 185 if ( i < pHT->cAllocated 182 186 && pHT->paEntries[i].iNext >= INTNET_HANDLE_MAX 183 && pHT->paEntries[i].iNext != ~0U)187 && pHT->paEntries[i].iNext != UINT32_MAX) 184 188 pIF = pHT->paEntries[i].pIF; 185 189 … … 214 218 */ 215 219 uint32_t i = pHT->iHead; 216 if (i != ~0U)220 if (i != UINT32_MAX) 217 221 { 218 222 pHT->iHead = pHT->paEntries[i].iNext; 219 if (pHT->iHead == ~0U)220 pHT->iTail = ~0U;223 if (pHT->iHead == UINT32_MAX) 224 pHT->iTail = UINT32_MAX; 221 225 222 226 pHT->paEntries[i].pIF = pIF; … … 253 257 i = pHT->cAllocated; 254 258 uint32_t iTail = pHT->iTail; 255 if (iTail == ~0U)259 if (iTail == UINT32_MAX) 256 260 pHT->iHead = iTail = i++; 257 261 while (i < cNew) … … 260 264 iTail = i++; 261 265 } 262 paNew[iTail].iNext = ~0U;266 paNew[iTail].iNext = UINT32_MAX; 263 267 pHT->iTail = iTail; 264 268 … … 297 301 * Insert at the end of the free list. 298 302 */ 299 pHT->paEntries[i].iNext = ~0U;303 pHT->paEntries[i].iNext = UINT32_MAX; 300 304 const uint32_t iTail = pHT->iTail; 301 if (iTail != ~0U)305 if (iTail != UINT32_MAX) 302 306 pHT->paEntries[iTail].iNext = i; 303 307 else … … 446 450 PDMMAC MacDst; 447 451 PDMMAC MacSrc; 448 } INTNETETHERHDR , *PINTNETETHERHDR;452 } INTNETETHERHDR; 449 453 #pragma pack() 454 typedef INTNETETHERHDR *PINTNETETHERHDR; 450 455 451 456 … … 1558 1563 //pIntNet->IfHandles.paEntries = NULL; 1559 1564 //pIntNet->IfHandles.cAllocated = 0; 1560 pIntNet->IfHandles.iHead = ~0U;1561 pIntNet->IfHandles.iTail = ~0U;1565 pIntNet->IfHandles.iHead = UINT32_MAX; 1566 pIntNet->IfHandles.iTail = UINT32_MAX; 1562 1567 1563 1568 rc = RTSemFastMutexCreate(&pIntNet->FastMutex);
Note:
See TracChangeset
for help on using the changeset viewer.