Changeset 28714 in vbox
- Timestamp:
- Apr 25, 2010 8:04:02 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/intnetinline.h
r28713 r28714 50 50 * @param u16Type The frame type to check. 51 51 */ 52 DECLINLINE(bool) I NETNETIsValidFrameType(uint16_t u16Type)52 DECLINLINE(bool) IntNetIsValidFrameType(uint16_t u16Type) 53 53 { 54 54 if (RT_LIKELY( u16Type == INTNETHDR_TYPE_FRAME … … 70 70 * @param cSegsUsed The number of used segments. 71 71 */ 72 DECLINLINE(void) I NTNETSgInitTempSegs(PINTNETSG pSG, uint32_t cbTotal, unsigned cSegs, unsigned cSegsUsed)72 DECLINLINE(void) IntNetSgInitTempSegs(PINTNETSG pSG, uint32_t cbTotal, unsigned cSegs, unsigned cSegsUsed) 73 73 { 74 74 pSG->pvOwnerData = NULL; … … 107 107 * @param pGso The GSO context. 108 108 */ 109 DECLINLINE(void) I NTNETSgInitTempSegsGso(PINTNETSG pSG, uint32_t cbTotal, unsigned cSegs,109 DECLINLINE(void) IntNetSgInitTempSegsGso(PINTNETSG pSG, uint32_t cbTotal, unsigned cSegs, 110 110 unsigned cSegsUsed, PCPDMNETWORKGSO pGso) 111 111 { … … 143 143 * @param cbFrame The size of the frame. 144 144 */ 145 DECLINLINE(void) I NTNETSgInitTemp(PINTNETSG pSG, void *pvFrame, uint32_t cbFrame)146 { 147 I NTNETSgInitTempSegs(pSG, cbFrame, 1, 1);145 DECLINLINE(void) IntNetSgInitTemp(PINTNETSG pSG, void *pvFrame, uint32_t cbFrame) 146 { 147 IntNetSgInitTempSegs(pSG, cbFrame, 1, 1); 148 148 pSG->aSegs[0].Phys = NIL_RTHCPHYS; 149 149 pSG->aSegs[0].pv = pvFrame; … … 160 160 * @param pGso The GSO context. 161 161 */ 162 DECLINLINE(void) I NTNETSgInitTempGso(PINTNETSG pSG, void *pvFrame, uint32_t cbFrame, PCPDMNETWORKGSO pGso)163 { 164 I NTNETSgInitTempSegsGso(pSG, cbFrame, 1, 1, pGso);162 DECLINLINE(void) IntNetSgInitTempGso(PINTNETSG pSG, void *pvFrame, uint32_t cbFrame, PCPDMNETWORKGSO pGso) 163 { 164 IntNetSgInitTempSegsGso(pSG, cbFrame, 1, 1, pGso); 165 165 pSG->aSegs[0].Phys = NIL_RTHCPHYS; 166 166 pSG->aSegs[0].pv = pvFrame; … … 175 175 * @param pvBuf The buffer to read into (at least pSG->cbTotal in size). 176 176 */ 177 DECLINLINE(void) I NTNETSgRead(PCINTNETSG pSG, void *pvBuf)177 DECLINLINE(void) IntNetSgRead(PCINTNETSG pSG, void *pvBuf) 178 178 { 179 179 memcpy(pvBuf, pSG->aSegs[0].pv, pSG->aSegs[0].cb); … … 204 204 * @param pvBuf The buffer to read into, cb or more in size. 205 205 */ 206 DECLINLINE(void) I NTNETSgReadEx(PCINTNETSG pSG, uint32_t offSrc, uint32_t cbToRead, void *pvBuf)206 DECLINLINE(void) IntNetSgReadEx(PCINTNETSG pSG, uint32_t offSrc, uint32_t cbToRead, void *pvBuf) 207 207 { 208 208 uint8_t *pbDst = (uint8_t *)pvBuf; … … 264 264 * @param pRingBuf The ring buffer. 265 265 */ 266 DECLINLINE(uint32_t) I NTNETRingGetWritable(PINTNETRINGBUF pRingBuf)266 DECLINLINE(uint32_t) IntNetRingGetWritable(PINTNETRINGBUF pRingBuf) 267 267 { 268 268 uint32_t const offRead = ASMAtomicUoReadU32(&pRingBuf->offReadX); … … 280 280 * @param pRingBuf The ring buffer. 281 281 */ 282 DECLINLINE(bool) I NTNETRingHasMoreToRead(PINTNETRINGBUF pRingBuf)282 DECLINLINE(bool) IntNetRingHasMoreToRead(PINTNETRINGBUF pRingBuf) 283 283 { 284 284 uint32_t const offRead = ASMAtomicUoReadU32(&pRingBuf->offReadX); … … 294 294 * @param pRingBuf The ring buffer. 295 295 */ 296 DECLINLINE(PINTNETHDR) I NTNETRingGetNextFrameToRead(PINTNETRINGBUF pRingBuf)296 DECLINLINE(PINTNETHDR) IntNetRingGetNextFrameToRead(PINTNETRINGBUF pRingBuf) 297 297 { 298 298 uint32_t const offRead = ASMAtomicUoReadU32(&pRingBuf->offReadX); … … 310 310 * @param pRingBuf The ring buffer. 311 311 */ 312 DECLINLINE(uint32_t) I NTNETRingGetReadable(PINTNETRINGBUF pRingBuf)312 DECLINLINE(uint32_t) IntNetRingGetReadable(PINTNETRINGBUF pRingBuf) 313 313 { 314 314 uint32_t const offRead = ASMAtomicUoReadU32(&pRingBuf->offReadX); … … 327 327 * @param pBuf The buffer the header is within. Only used in strict builds. 328 328 */ 329 DECLINLINE(void *) I NTNETHdrGetFramePtr(PCINTNETHDR pHdr, PCINTNETBUF pBuf)329 DECLINLINE(void *) IntNetHdrGetFramePtr(PCINTNETHDR pHdr, PCINTNETBUF pBuf) 330 330 { 331 331 uint8_t *pu8 = (uint8_t *)pHdr + pHdr->offFrame; 332 332 #ifdef VBOX_STRICT 333 333 const uintptr_t off = (uintptr_t)pu8 - (uintptr_t)pBuf; 334 Assert(I NETNETIsValidFrameType(pHdr->u16Type));334 Assert(IntNetIsValidFrameType(pHdr->u16Type)); 335 335 Assert(off < pBuf->cbBuf); 336 336 Assert(off + pHdr->cbFrame <= pBuf->cbBuf); … … 353 353 * @param pBuf The buffer the header is within. Only used in strict builds. 354 354 */ 355 DECLINLINE(PPDMNETWORKGSO) I NTNETHdrGetGsoContext(PCINTNETHDR pHdr, PCINTNETBUF pBuf)355 DECLINLINE(PPDMNETWORKGSO) IntNetHdrGetGsoContext(PCINTNETHDR pHdr, PCINTNETBUF pBuf) 356 356 { 357 357 PPDMNETWORKGSO pGso = (PPDMNETWORKGSO)((uint8_t *)pHdr + pHdr->offFrame); … … 372 372 * @param pRingBuf The ring buffer in question. 373 373 */ 374 DECLINLINE(void) I NTNETRingSkipFrame(PINTNETRINGBUF pRingBuf)374 DECLINLINE(void) IntNetRingSkipFrame(PINTNETRINGBUF pRingBuf) 375 375 { 376 376 uint32_t const offReadOld = ASMAtomicUoReadU32(&pRingBuf->offReadX); … … 379 379 Assert(offReadOld < pRingBuf->offEnd); 380 380 Assert(RT_ALIGN_PT(pHdr, INTNETHDR_ALIGNMENT, INTNETHDR *) == pHdr); 381 Assert(I NETNETIsValidFrameType(pHdr->u16Type));381 Assert(IntNetIsValidFrameType(pHdr->u16Type)); 382 382 383 383 /* skip the frame */ … … 387 387 if (offReadNew >= pRingBuf->offEnd) 388 388 offReadNew = pRingBuf->offStart; 389 Log2(("I NTNETRingSkipFrame: offReadX: %#x -> %#x (1)\n", offReadOld, offReadNew));389 Log2(("IntNetRingSkipFrame: offReadX: %#x -> %#x (1)\n", offReadOld, offReadNew)); 390 390 #ifdef INTNET_POISON_READ_FRAMES 391 391 memset((uint8_t *)pHdr + pHdr->offFrame, 0xfe, RT_ALIGN_32(pHdr->cbFrame, INTNETHDR_ALIGNMENT)); … … 501 501 * @param ppvFrame Where to return the frame pointer. 502 502 */ 503 DECLINLINE(int) I NTNETRingAllocateFrame(PINTNETRINGBUF pRingBuf, uint32_t cbFrame, PINTNETHDR *ppHdr, void **ppvFrame)503 DECLINLINE(int) IntNetRingAllocateFrame(PINTNETRINGBUF pRingBuf, uint32_t cbFrame, PINTNETHDR *ppHdr, void **ppvFrame) 504 504 { 505 505 return intnetRingAllocateFrameInternal(pRingBuf, cbFrame, INTNETHDR_TYPE_FRAME, ppHdr, ppvFrame); … … 518 518 * @param ppvFrame Where to return the frame pointer. 519 519 */ 520 DECLINLINE(int) I NTNETRingAllocateGsoFrame(PINTNETRINGBUF pRingBuf, uint32_t cbFrame, PCPDMNETWORKGSO pGso,520 DECLINLINE(int) IntNetRingAllocateGsoFrame(PINTNETRINGBUF pRingBuf, uint32_t cbFrame, PCPDMNETWORKGSO pGso, 521 521 PINTNETHDR *ppHdr, void **ppvFrame) 522 522 { … … 541 541 * @param pRingBuf The ring buffer. 542 542 * @param pHdr The frame header returned by 543 * I NTNETRingAllocateFrame.544 */ 545 DECLINLINE(void) I NTNETRingCommitFrame(PINTNETRINGBUF pRingBuf, PINTNETHDR pHdr)543 * IntNetRingAllocateFrame. 544 */ 545 DECLINLINE(void) IntNetRingCommitFrame(PINTNETRINGBUF pRingBuf, PINTNETHDR pHdr) 546 546 { 547 547 /* … … 565 565 offWriteCom = pRingBuf->offStart; 566 566 } 567 Log2(("I NTNETRingCommitFrame: offWriteCom: %#x -> %#x (R=%#x T=%#x S=%#x)\n", pRingBuf->offWriteCom, offWriteCom, pRingBuf->offReadX, pHdr->u16Type, cbFrame));567 Log2(("IntNetRingCommitFrame: offWriteCom: %#x -> %#x (R=%#x T=%#x S=%#x)\n", pRingBuf->offWriteCom, offWriteCom, pRingBuf->offReadX, pHdr->u16Type, cbFrame)); 568 568 ASMAtomicWriteU32(&pRingBuf->offWriteCom, offWriteCom); 569 569 STAM_REL_COUNTER_ADD(&pRingBuf->cbStatWritten, cbFrame); … … 580 580 * @param pRingBuf The ring buffer. 581 581 * @param pHdr The frame header returned by 582 * I NTNETRingAllocateFrame.582 * IntNetRingAllocateFrame. 583 583 * @param cbUsed The amount of space actually used. This does 584 584 * not include the GSO part. 585 585 */ 586 DECLINLINE(void) I NTNETRingCommitFrameEx(PINTNETRINGBUF pRingBuf, PINTNETHDR pHdr, size_t cbUsed)586 DECLINLINE(void) IntNetRingCommitFrameEx(PINTNETRINGBUF pRingBuf, PINTNETHDR pHdr, size_t cbUsed) 587 587 { 588 588 /* … … 623 623 } 624 624 625 Log2(("I NTNETRingCommitFrameEx: offWriteCom: %#x -> %#x (R=%#x T=%#x S=%#x P=%#x)\n", pRingBuf->offWriteCom, offWriteCom, pRingBuf->offReadX, pHdr->u16Type, pHdr->cbFrame, cbAlignedFrame - cbAlignedUsed));625 Log2(("IntNetRingCommitFrameEx: offWriteCom: %#x -> %#x (R=%#x T=%#x S=%#x P=%#x)\n", pRingBuf->offWriteCom, offWriteCom, pRingBuf->offReadX, pHdr->u16Type, pHdr->cbFrame, cbAlignedFrame - cbAlignedUsed)); 626 626 ASMAtomicWriteU32(&pRingBuf->offWriteCom, offWriteCom); 627 627 STAM_REL_COUNTER_ADD(&pRingBuf->cbStatWritten, cbUsed); … … 640 640 * @param cbFrame How much to write. 641 641 */ 642 DECLINLINE(int) I NTNETRingWriteFrame(PINTNETRINGBUF pRingBuf, const void *pvFrame, size_t cbFrame)642 DECLINLINE(int) IntNetRingWriteFrame(PINTNETRINGBUF pRingBuf, const void *pvFrame, size_t cbFrame) 643 643 { 644 644 /* … … 666 666 if (RT_UNLIKELY(!ASMAtomicCmpXchgU32(&pRingBuf->offWriteInt, offNew, offWriteInt))) 667 667 return VERR_WRONG_ORDER; /* race */ 668 Log2(("I NTNETRingWriteFrame: offWriteInt: %#x -> %#x (1)\n", offWriteInt, offNew));668 Log2(("IntNetRingWriteFrame: offWriteInt: %#x -> %#x (1)\n", offWriteInt, offNew)); 669 669 670 670 PINTNETHDR pHdr = (PINTNETHDR)((uint8_t *)pRingBuf + offWriteInt); … … 675 675 memcpy(pHdr + 1, pvFrame, cbFrame); 676 676 677 Log2(("I NTNETRingWriteFrame: offWriteCom: %#x -> %#x (1)\n", pRingBuf->offWriteCom, offNew));677 Log2(("IntNetRingWriteFrame: offWriteCom: %#x -> %#x (1)\n", pRingBuf->offWriteCom, offNew)); 678 678 ASMAtomicWriteU32(&pRingBuf->offWriteCom, offNew); 679 679 STAM_REL_COUNTER_ADD(&pRingBuf->cbStatWritten, cbFrame); … … 691 691 if (RT_UNLIKELY(!ASMAtomicCmpXchgU32(&pRingBuf->offWriteInt, offNew, offWriteInt))) 692 692 return VERR_WRONG_ORDER; /* race */ 693 Log2(("I NTNETRingWriteFrame: offWriteInt: %#x -> %#x (2)\n", offWriteInt, offNew));693 Log2(("IntNetRingWriteFrame: offWriteInt: %#x -> %#x (2)\n", offWriteInt, offNew)); 694 694 695 695 PINTNETHDR pHdr = (PINTNETHDR)((uint8_t *)pRingBuf + offWriteInt); … … 700 700 memcpy((uint8_t *)pRingBuf + pRingBuf->offStart, pvFrame, cbFrame); 701 701 702 Log2(("I NTNETRingWriteFrame: offWriteCom: %#x -> %#x (2)\n", pRingBuf->offWriteCom, offNew));702 Log2(("IntNetRingWriteFrame: offWriteCom: %#x -> %#x (2)\n", pRingBuf->offWriteCom, offNew)); 703 703 ASMAtomicWriteU32(&pRingBuf->offWriteCom, offNew); 704 704 STAM_REL_COUNTER_ADD(&pRingBuf->cbStatWritten, cbFrame); … … 715 715 if (RT_UNLIKELY(!ASMAtomicCmpXchgU32(&pRingBuf->offWriteInt, offNew, offWriteInt))) 716 716 return VERR_WRONG_ORDER; /* race */ 717 Log2(("I NTNETRingWriteFrame: offWriteInt: %#x -> %#x (3)\n", offWriteInt, offNew));717 Log2(("IntNetRingWriteFrame: offWriteInt: %#x -> %#x (3)\n", offWriteInt, offNew)); 718 718 719 719 PINTNETHDR pHdr = (PINTNETHDR)((uint8_t *)pRingBuf + offWriteInt); … … 724 724 memcpy(pHdr + 1, pvFrame, cbFrame); 725 725 726 Log2(("I NTNETRingWriteFrame: offWriteCom: %#x -> %#x (3)\n", pRingBuf->offWriteCom, offNew));726 Log2(("IntNetRingWriteFrame: offWriteCom: %#x -> %#x (3)\n", pRingBuf->offWriteCom, offNew)); 727 727 ASMAtomicWriteU32(&pRingBuf->offWriteCom, offNew); 728 728 STAM_REL_COUNTER_ADD(&pRingBuf->cbStatWritten, cbFrame); … … 747 747 * @deprecated Bad interface, do NOT use it! Only for tstIntNetR0. 748 748 */ 749 DECLINLINE(uint32_t) I NTNETRingReadAndSkipFrame(PINTNETRINGBUF pRingBuf, void *pvFrameDst)749 DECLINLINE(uint32_t) IntNetRingReadAndSkipFrame(PINTNETRINGBUF pRingBuf, void *pvFrameDst) 750 750 { 751 751 INTNETRINGBUF_ASSERT_SANITY(pRingBuf); … … 789 789 * @param cbSend The send size. 790 790 */ 791 DECLINLINE(void) I NTNETBufInit(PINTNETBUF pIntBuf, uint32_t cbBuf, uint32_t cbRecv, uint32_t cbSend)791 DECLINLINE(void) IntNetBufInit(PINTNETBUF pIntBuf, uint32_t cbBuf, uint32_t cbRecv, uint32_t cbSend) 792 792 { 793 793 AssertCompileSizeAlignment(INTNETBUF, INTNETHDR_ALIGNMENT); -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r28711 r28714 374 374 PINTNETHDR pHdr; 375 375 if (pGso) 376 rc = I NTNETRingAllocateGsoFrame(&pThis->CTX_SUFF(pBuf)->Send, (uint32_t)cbMin, pGso,376 rc = IntNetRingAllocateGsoFrame(&pThis->CTX_SUFF(pBuf)->Send, (uint32_t)cbMin, pGso, 377 377 &pHdr, &pSgBuf->aSegs[0].pvSeg); 378 378 else 379 rc = I NTNETRingAllocateFrame(&pThis->CTX_SUFF(pBuf)->Send, (uint32_t)cbMin,379 rc = IntNetRingAllocateFrame(&pThis->CTX_SUFF(pBuf)->Send, (uint32_t)cbMin, 380 380 &pHdr, &pSgBuf->aSegs[0].pvSeg); 381 381 #ifdef IN_RING3 … … 385 385 drvIntNetProcessXmit(pThis); 386 386 if (pGso) 387 rc = I NTNETRingAllocateGsoFrame(&pThis->CTX_SUFF(pBuf)->Send, (uint32_t)cbMin, pGso,387 rc = IntNetRingAllocateGsoFrame(&pThis->CTX_SUFF(pBuf)->Send, (uint32_t)cbMin, pGso, 388 388 &pHdr, &pSgBuf->aSegs[0].pvSeg); 389 389 else 390 rc = I NTNETRingAllocateFrame(&pThis->CTX_SUFF(pBuf)->Send, (uint32_t)cbMin,390 rc = IntNetRingAllocateFrame(&pThis->CTX_SUFF(pBuf)->Send, (uint32_t)cbMin, 391 391 &pHdr, &pSgBuf->aSegs[0].pvSeg); 392 392 } … … 453 453 /** @todo LATER: try unalloc the frame. */ 454 454 pHdr->u16Type = INTNETHDR_TYPE_PADDING; 455 I NTNETRingCommitFrame(&pThis->CTX_SUFF(pBuf)->Send, pHdr);455 IntNetRingCommitFrame(&pThis->CTX_SUFF(pBuf)->Send, pHdr); 456 456 457 457 #ifdef IN_RING3 … … 484 484 */ 485 485 PINTNETHDR pHdr = (PINTNETHDR)pSgBuf->pvAllocator; 486 I NTNETRingCommitFrameEx(&pThis->CTX_SUFF(pBuf)->Send, pHdr, pSgBuf->cbUsed);486 IntNetRingCommitFrameEx(&pThis->CTX_SUFF(pBuf)->Send, pHdr, pSgBuf->cbUsed); 487 487 int rc = drvIntNetProcessXmit(pThis); 488 488 STAM_PROFILE_STOP(&pThis->StatTransmit, a); … … 671 671 */ 672 672 PINTNETHDR pHdr; 673 while ((pHdr = I NTNETRingGetNextFrameToRead(pRingBuf)) != NULL)673 while ((pHdr = IntNetRingGetNextFrameToRead(pRingBuf)) != NULL) 674 674 { 675 675 /* … … 710 710 Log2(("drvR3IntNetRecvRun: cbFrame=%#x\n" 711 711 "%.*Rhxd\n", 712 cbFrame, cbFrame, I NTNETHdrGetFramePtr(pHdr, pBuf)));712 cbFrame, cbFrame, IntNetHdrGetFramePtr(pHdr, pBuf))); 713 713 } 714 714 #endif 715 rc = pThis->pIAboveNet->pfnReceive(pThis->pIAboveNet, I NTNETHdrGetFramePtr(pHdr, pBuf), cbFrame);715 rc = pThis->pIAboveNet->pfnReceive(pThis->pIAboveNet, IntNetHdrGetFramePtr(pHdr, pBuf), cbFrame); 716 716 AssertRC(rc); 717 717 718 718 /* skip to the next frame. */ 719 I NTNETRingSkipFrame(pRingBuf);719 IntNetRingSkipFrame(pRingBuf); 720 720 } 721 721 else … … 728 728 */ 729 729 STAM_COUNTER_INC(&pThis->StatReceivedGso); 730 PCPDMNETWORKGSO pGso = I NTNETHdrGetGsoContext(pHdr, pBuf);730 PCPDMNETWORKGSO pGso = IntNetHdrGetGsoContext(pHdr, pBuf); 731 731 if (PDMNetGsoIsValid(pGso, cbFrame, cbFrame - sizeof(PDMNETWORKGSO))) 732 732 { … … 770 770 } 771 771 772 I NTNETRingSkipFrame(pRingBuf);772 IntNetRingSkipFrame(pRingBuf); 773 773 } 774 774 } … … 786 786 * NIC is going down, likely because the VM is being reset. Skip the frame. 787 787 */ 788 AssertMsg(I NETNETIsValidFrameType(pHdr->u16Type), ("Unknown frame type %RX16! offRead=%#x\n", pHdr->u16Type, pRingBuf->offReadX));789 I NTNETRingSkipFrame(pRingBuf);788 AssertMsg(IntNetIsValidFrameType(pHdr->u16Type), ("Unknown frame type %RX16! offRead=%#x\n", pHdr->u16Type, pRingBuf->offReadX)); 789 IntNetRingSkipFrame(pRingBuf); 790 790 } 791 791 else … … 803 803 * Link down or unknown frame - skip to the next frame. 804 804 */ 805 AssertMsg(I NETNETIsValidFrameType(pHdr->u16Type), ("Unknown frame type %RX16! offRead=%#x\n", pHdr->u16Type, pRingBuf->offReadX));806 I NTNETRingSkipFrame(pRingBuf);805 AssertMsg(IntNetIsValidFrameType(pHdr->u16Type), ("Unknown frame type %RX16! offRead=%#x\n", pHdr->u16Type, pRingBuf->offReadX)); 806 IntNetRingSkipFrame(pRingBuf); 807 807 STAM_REL_COUNTER_INC(&pBuf->cStatBadFrames); 808 808 } … … 969 969 * Add the frame to the send buffer and push it onto the network. 970 970 */ 971 int rc = I NTNETRingWriteFrame(&pThis->pBufR3->Send, pvBuf, (uint32_t)cb);971 int rc = IntNetRingWriteFrame(&pThis->pBufR3->Send, pvBuf, (uint32_t)cb); 972 972 if ( rc == VERR_BUFFER_OVERFLOW 973 973 && pThis->pBufR3->cbSend < cb) … … 980 980 PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvInsR3, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq)); 981 981 982 rc = I NTNETRingWriteFrame(&pThis->pBufR3->Send, pvBuf, (uint32_t)cb);982 rc = IntNetRingWriteFrame(&pThis->pBufR3->Send, pvBuf, (uint32_t)cb); 983 983 } 984 984 -
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r28711 r28714 2367 2367 int rc; 2368 2368 if (pSG->GsoCtx.u8Type == PDMNETWORKGSOTYPE_INVALID) 2369 rc = I NTNETRingAllocateFrame(pRingBuf, pSG->cbTotal, &pHdr, &pvDst);2369 rc = IntNetRingAllocateFrame(pRingBuf, pSG->cbTotal, &pHdr, &pvDst); 2370 2370 else 2371 rc = I NTNETRingAllocateGsoFrame(pRingBuf, pSG->cbTotal, &pSG->GsoCtx, &pHdr, &pvDst);2371 rc = IntNetRingAllocateGsoFrame(pRingBuf, pSG->cbTotal, &pSG->GsoCtx, &pHdr, &pvDst); 2372 2372 if (RT_SUCCESS(rc)) 2373 2373 { 2374 I NTNETSgRead(pSG, pvDst);2374 IntNetSgRead(pSG, pvDst); 2375 2375 if (pNewDstMac) 2376 2376 ((PRTNETETHERHDR)pvDst)->DstMac = *pNewDstMac; 2377 2377 2378 I NTNETRingCommitFrame(pRingBuf, pHdr);2378 IntNetRingCommitFrame(pRingBuf, pHdr); 2379 2379 return VINF_SUCCESS; 2380 2380 } … … 2481 2481 pThis->abGsoHdrs, &cbSegPayload); 2482 2482 2483 I NTNETSgInitTempSegs(&u.SG, pSG->GsoCtx.cbHdrs + cbSegPayload, 2, 2);2483 IntNetSgInitTempSegs(&u.SG, pSG->GsoCtx.cbHdrs + cbSegPayload, 2, 2); 2484 2484 u.SG.aSegs[0].Phys = NIL_RTHCPHYS; 2485 2485 u.SG.aSegs[0].pv = pThis->abGsoHdrs; … … 3280 3280 * I won't bother allocating and managing SGs rigth now. Sorry. */ 3281 3281 PINTNETHDR pHdr; 3282 while ((pHdr = I NTNETRingGetNextFrameToRead(&pIf->pIntBuf->Send)) != NULL)3282 while ((pHdr = IntNetRingGetNextFrameToRead(&pIf->pIntBuf->Send)) != NULL) 3283 3283 { 3284 3284 uint16_t const u16Type = pHdr->u16Type; … … 3286 3286 { 3287 3287 /* Send regular frame. */ 3288 void *pvCurFrame = I NTNETHdrGetFramePtr(pHdr, pIf->pIntBuf);3289 I NTNETSgInitTemp(&Sg, pvCurFrame, pHdr->cbFrame);3288 void *pvCurFrame = IntNetHdrGetFramePtr(pHdr, pIf->pIntBuf); 3289 IntNetSgInitTemp(&Sg, pvCurFrame, pHdr->cbFrame); 3290 3290 if (pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE) 3291 3291 intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, pHdr->cbFrame, false /*fGso*/, (uint16_t *)&Sg.fFlags); … … 3295 3295 { 3296 3296 /* Send GSO frame if sane. */ 3297 PPDMNETWORKGSO pGso = I NTNETHdrGetGsoContext(pHdr, pIf->pIntBuf);3297 PPDMNETWORKGSO pGso = IntNetHdrGetGsoContext(pHdr, pIf->pIntBuf); 3298 3298 uint32_t cbFrame = pHdr->cbFrame - sizeof(*pGso); 3299 3299 if (RT_LIKELY(PDMNetGsoIsValid(pGso, pHdr->cbFrame, cbFrame))) 3300 3300 { 3301 3301 void *pvCurFrame = pGso + 1; 3302 I NTNETSgInitTempGso(&Sg, pvCurFrame, cbFrame, pGso);3302 IntNetSgInitTempGso(&Sg, pvCurFrame, cbFrame, pGso); 3303 3303 if (pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE) 3304 3304 intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, cbFrame, true /*fGso*/, (uint16_t *)&Sg.fFlags); … … 3325 3325 3326 3326 /* Skip to the next frame. */ 3327 I NTNETRingSkipFrame(&pIf->pIntBuf->Send);3327 IntNetRingSkipFrame(&pIf->pIntBuf->Send); 3328 3328 } 3329 3329 … … 4160 4160 pIf->pIntBuf = pIf->pIntBufDefault; 4161 4161 pIf->pIntBufR3 = pIf->pIntBufDefaultR3; 4162 I NTNETBufInit(pIf->pIntBuf, cbBuf, cbRecv, cbSend);4162 IntNetBufInit(pIf->pIntBuf, cbBuf, cbRecv, cbSend); 4163 4163 4164 4164 /* -
trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp
r28711 r28714 204 204 * it's not supposed to happen here in this testcase. 205 205 */ 206 int rc = I NTNETRingWriteFrame(&pBuf->Send, pvFrame, cbFrame);206 int rc = IntNetRingWriteFrame(&pBuf->Send, pvFrame, cbFrame); 207 207 if (RT_SUCCESS(rc)) 208 208 { … … 212 212 else 213 213 { 214 RTPrintf("tstIntNet-1: I NTNETRingWriteFrame failed, %Rrc; cbFrame=%d pBuf->cbSend=%d\n", rc, cbFrame, pBuf->cbSend);214 RTPrintf("tstIntNet-1: IntNetRingWriteFrame failed, %Rrc; cbFrame=%d pBuf->cbSend=%d\n", rc, cbFrame, pBuf->cbSend); 215 215 g_cErrors++; 216 216 } … … 465 465 */ 466 466 PINTNETHDR pHdr; 467 while ((pHdr = I NTNETRingGetNextFrameToRead(pRingBuf)))467 while ((pHdr = IntNetRingGetNextFrameToRead(pRingBuf))) 468 468 { 469 469 if (pHdr->u16Type == INTNETHDR_TYPE_FRAME) 470 470 { 471 471 size_t cbFrame = pHdr->cbFrame; 472 const void *pvFrame = I NTNETHdrGetFramePtr(pHdr, pBuf);472 const void *pvFrame = IntNetHdrGetFramePtr(pHdr, pBuf); 473 473 uint64_t NanoTS = RTTimeNanoTS() - g_StartTS; 474 474 … … 546 546 else if (pHdr->u16Type == INTNETHDR_TYPE_GSO) 547 547 { 548 PCPDMNETWORKGSO pGso = I NTNETHdrGetGsoContext(pHdr, pBuf);548 PCPDMNETWORKGSO pGso = IntNetHdrGetGsoContext(pHdr, pBuf); 549 549 size_t cbFrame = pHdr->cbFrame; 550 550 if (PDMNetGsoIsValid(pGso, cbFrame, cbFrame - sizeof(*pGso))) … … 580 580 581 581 /* Advance to the next frame. */ 582 I NTNETRingSkipFrame(pRingBuf);582 IntNetRingSkipFrame(pRingBuf); 583 583 } 584 584 } -
trunk/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp
r28711 r28714 194 194 { 195 195 INTNETSG Sg; 196 I NTNETSgInitTemp(&Sg, (void *)pvBuf, cbBuf);196 IntNetSgInitTemp(&Sg, (void *)pvBuf, cbBuf); 197 197 int rc = intnetR0RingWriteFrame(pRingBuf, &Sg, NULL); 198 198 if (RT_SUCCESS(rc)) … … 254 254 255 255 INTNETSG Sg; 256 I NTNETSgInitTemp(&Sg, abBuf, cb);256 IntNetSgInitTemp(&Sg, abBuf, cb); 257 257 RTTEST_CHECK_RC_OK(g_hTest, rc = intnetR0RingWriteFrame(&pArgs->pBuf->Send, &Sg, NULL)); 258 258 if (RT_SUCCESS(rc)) … … 301 301 * Read data. 302 302 */ 303 while (I NTNETRingHasMoreToRead(&pArgs->pBuf->Recv))303 while (IntNetRingHasMoreToRead(&pArgs->pBuf->Recv)) 304 304 { 305 305 uint8_t abBuf[16384]; 306 306 MYFRAMEHDR *pHdr = (MYFRAMEHDR *)&abBuf[0]; 307 uint32_t cb = I NTNETRingReadAndSkipFrame(&pArgs->pBuf->Recv, abBuf);307 uint32_t cb = IntNetRingReadAndSkipFrame(&pArgs->pBuf->Recv, abBuf); 308 308 309 309 /* check for termination frame. */ … … 500 500 */ 501 501 unsigned cYields = 100000; 502 while ( ( I NTNETRingHasMoreToRead(&pThis->pBuf0->Recv)503 || I NTNETRingHasMoreToRead(&pThis->pBuf1->Recv))502 while ( ( IntNetRingHasMoreToRead(&pThis->pBuf0->Recv) 503 || IntNetRingHasMoreToRead(&pThis->pBuf1->Recv)) 504 504 && cYields-- > 0) 505 505 RTThreadYield(); … … 600 600 /* Receive the data. */ 601 601 const unsigned cbExpect = RT_ALIGN(sizeof(s_au16Frame) + sizeof(INTNETHDR), sizeof(INTNETHDR)); 602 RTTESTI_CHECK_MSG(I NTNETRingGetReadable(&pThis->pBuf1->Recv) == cbExpect,603 ("%#x vs. %#x\n", I NTNETRingGetReadable(&pThis->pBuf1->Recv), cbExpect));602 RTTESTI_CHECK_MSG(IntNetRingGetReadable(&pThis->pBuf1->Recv) == cbExpect, 603 ("%#x vs. %#x\n", IntNetRingGetReadable(&pThis->pBuf1->Recv), cbExpect)); 604 604 605 605 void *pvBuf; 606 606 RTTESTI_CHECK_RC_OK_RETV(RTTestGuardedAlloc(g_hTest, sizeof(s_au16Frame), 1, fHeadGuard, &pvBuf)); 607 607 uint32_t cb; 608 RTTESTI_CHECK_MSG_RETV((cb = I NTNETRingReadAndSkipFrame(&pThis->pBuf1->Recv, pvBuf)) == sizeof(s_au16Frame),608 RTTESTI_CHECK_MSG_RETV((cb = IntNetRingReadAndSkipFrame(&pThis->pBuf1->Recv, pvBuf)) == sizeof(s_au16Frame), 609 609 ("%#x vs. %#x\n", cb, sizeof(s_au16Frame))); 610 610 … … 639 639 /* Receive the data. */ 640 640 const unsigned cbExpect = RT_ALIGN(sizeof(s_au16Frame) + sizeof(INTNETHDR), sizeof(INTNETHDR)); 641 RTTESTI_CHECK_MSG(I NTNETRingGetReadable(&pThis->pBuf0->Recv) == cbExpect,642 ("%#x vs. %#x\n", I NTNETRingGetReadable(&pThis->pBuf0->Recv), cbExpect));641 RTTESTI_CHECK_MSG(IntNetRingGetReadable(&pThis->pBuf0->Recv) == cbExpect, 642 ("%#x vs. %#x\n", IntNetRingGetReadable(&pThis->pBuf0->Recv), cbExpect)); 643 643 644 644 void *pvBuf; 645 645 RTTESTI_CHECK_RC_OK_RETV(RTTestGuardedAlloc(g_hTest, sizeof(s_au16Frame), 1, fHeadGuard, &pvBuf)); 646 646 uint32_t cb; 647 RTTESTI_CHECK_MSG_RETV((cb = I NTNETRingReadAndSkipFrame(&pThis->pBuf0->Recv, pvBuf)) == sizeof(s_au16Frame),647 RTTESTI_CHECK_MSG_RETV((cb = IntNetRingReadAndSkipFrame(&pThis->pBuf0->Recv, pvBuf)) == sizeof(s_au16Frame), 648 648 ("%#x vs. %#x\n", cb, sizeof(s_au16Frame))); 649 649 -
trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
r28666 r28714 386 386 { 387 387 mbuf_setlen(pCur, pSG->cbTotal); 388 I NTNETSgRead(pSG, mbuf_data(pCur));388 IntNetSgRead(pSG, mbuf_data(pCur)); 389 389 } 390 390 else … … 399 399 cb = cbLeft; 400 400 mbuf_setlen(pCur, cb); 401 I NTNETSgReadEx(pSG, offSrc, cb, mbuf_data(pCur));401 IntNetSgReadEx(pSG, offSrc, cb, mbuf_data(pCur)); 402 402 403 403 /* advance */ … … 499 499 */ 500 500 unsigned iSeg = 0; 501 I NTNETSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/);501 IntNetSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/); 502 502 for (mbuf_t pCur = pMBuf; pCur; pCur = mbuf_next(pCur)) 503 503 { -
trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
r28666 r28714 189 189 struct mbuf *m0; 190 190 191 I NTNETSgInitTempSegs(pSG, m_length(m, NULL), cSegs, 0 /*cSegsUsed*/);191 IntNetSgInitTempSegs(pSG, m_length(m, NULL), cSegs, 0 /*cSegsUsed*/); 192 192 193 193 for (m0 = m, i = segOffset; m0; m0 = m0->m_next) -
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r28703 r28714 520 520 /* Copy the segments. */ 521 521 skb_put(pPkt, pSG->cbTotal); 522 I NTNETSgRead(pSG, pPkt->data);522 IntNetSgRead(pSG, pPkt->data); 523 523 524 524 #if defined(VBOXNETFLT_WITH_GSO_XMIT_WIRE) || defined(VBOXNETFLT_WITH_GSO_XMIT_HOST) … … 629 629 630 630 if (!pGsoCtx) 631 I NTNETSgInitTempSegs(pSG, pBuf->len, cSegs, 0 /*cSegsUsed*/);631 IntNetSgInitTempSegs(pSG, pBuf->len, cSegs, 0 /*cSegsUsed*/); 632 632 else 633 I NTNETSgInitTempSegsGso(pSG, pBuf->len, cSegs, 0 /*cSegsUsed*/, pGsoCtx);633 IntNetSgInitTempSegsGso(pSG, pBuf->len, cSegs, 0 /*cSegsUsed*/, pGsoCtx); 634 634 635 635 #ifdef VBOXNETFLT_SG_SUPPORT -
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r28681 r28714 2716 2716 * Convert the message block to segments. Work INTNETSG::cbTotal. 2717 2717 */ 2718 I NTNETSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/);2718 IntNetSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/); 2719 2719 mblk_t *pCur = pMsg; 2720 2720 unsigned iSeg = 0; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c
r28666 r28714 481 481 * Convert the message block to segments. Works cbTotal and sets cSegsUsed. 482 482 */ 483 I NTNETSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/);483 IntNetSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/); 484 484 mblk_t *pCur = pMsg; 485 485 unsigned iSeg = 0; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.c
r28666 r28714 418 418 if(Status == STATUS_SUCCESS) 419 419 { 420 I NTNETSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/);420 IntNetSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/); 421 421 return pSG; 422 422 } … … 635 635 { 636 636 /* reinitialize */ 637 I NTNETSgInitTempSegs(pSG, 0 /*cbTotal*/, pSG->cSegsAlloc, 0 /*cSegsUsed*/);637 IntNetSgInitTempSegs(pSG, 0 /*cbTotal*/, pSG->cSegsAlloc, 0 /*cSegsUsed*/); 638 638 639 639 /* convert the ndis buffers to INTNETSG */ … … 1155 1155 if(Status == NDIS_STATUS_SUCCESS) 1156 1156 { 1157 I NTNETSgInitTemp(pSG, pSG + 1, cbPacket);1157 IntNetSgInitTemp(pSG, pSG + 1, cbPacket); 1158 1158 LogFlow(("pSG created (%p)\n", pSG)); 1159 1159 *ppSG = pSG; … … 1693 1693 if(fStatus == NDIS_STATUS_SUCCESS) 1694 1694 { 1695 I NTNETSgRead(pSG, pvMemBuf);1695 IntNetSgRead(pSG, pvMemBuf); 1696 1696 } 1697 1697 else -
trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
r28711 r28714 988 988 * Process the receive buffer. 989 989 */ 990 while (I NTNETRingHasMoreToRead(pRingBuf))990 while (IntNetRingHasMoreToRead(pRingBuf)) 991 991 { 992 992 size_t cb; … … 1020 1020 1021 1021 /* Advance to the next frame. */ 1022 I NTNETRingSkipFrame(pRingBuf);1022 IntNetRingSkipFrame(pRingBuf); 1023 1023 } 1024 1024 } -
trunk/src/VBox/NetworkServices/NAT/VBoxNetNAT.cpp
r28371 r28714 242 242 */ 243 243 PCINTNETHDR pHdr; 244 while ((pHdr = I NTNETRingGetNextFrameToRead(pRingBuf)) != NULL)244 while ((pHdr = IntNetRingGetNextFrameToRead(pRingBuf)) != NULL) 245 245 { 246 246 uint16_t const u16Type = pHdr->u16Type; … … 260 260 break; 261 261 } 262 memcpy(pvSlirpFrame, I NTNETHdrGetFramePtr(pHdr, m_pIfBuf), cbFrame);263 I NTNETRingSkipFrame(&m_pIfBuf->Recv);262 memcpy(pvSlirpFrame, IntNetHdrGetFramePtr(pHdr, m_pIfBuf), cbFrame); 263 IntNetRingSkipFrame(&m_pIfBuf->Recv); 264 264 265 265 /* don't wait, we may have to wakeup the NAT thread first */ … … 271 271 { 272 272 /** @todo pass these unmodified. */ 273 PCPDMNETWORKGSO pGso = I NTNETHdrGetGsoContext(pHdr, m_pIfBuf);273 PCPDMNETWORKGSO pGso = IntNetHdrGetGsoContext(pHdr, m_pIfBuf); 274 274 if (!PDMNetGsoIsValid(pGso, cbFrame, cbFrame - sizeof(*pGso))) 275 275 { 276 I NTNETRingSkipFrame(&m_pIfBuf->Recv);276 IntNetRingSkipFrame(&m_pIfBuf->Recv); 277 277 STAM_REL_COUNTER_INC(&m_pIfBuf->cStatBadFrames); 278 278 continue; … … 298 298 AssertReleaseRC(rc); 299 299 } 300 I NTNETRingSkipFrame(&m_pIfBuf->Recv);300 IntNetRingSkipFrame(&m_pIfBuf->Recv); 301 301 } 302 302 … … 312 312 } 313 313 else if (u16Type == INTNETHDR_TYPE_PADDING) 314 I NTNETRingSkipFrame(&m_pIfBuf->Recv);314 IntNetRingSkipFrame(&m_pIfBuf->Recv); 315 315 else 316 316 { 317 I NTNETRingSkipFrame(&m_pIfBuf->Recv);317 IntNetRingSkipFrame(&m_pIfBuf->Recv); 318 318 STAM_REL_COUNTER_INC(&m_pIfBuf->cStatBadFrames); 319 319 } … … 401 401 rc = RTSemEventWait(g_pNAT->m_EventUrgSend, RT_INDEFINITE_WAIT); 402 402 } 403 rc = I NTNETRingWriteFrame(&pThis->m_pIfBuf->Send, pvFrame, cbFrame);403 rc = IntNetRingWriteFrame(&pThis->m_pIfBuf->Send, pvFrame, cbFrame); 404 404 if (RT_FAILURE(rc)) 405 405 { … … 410 410 rc = SUPR3CallVMMR0Ex(NIL_RTR0PTR, NIL_VMCPUID, VMMR0_DO_INTNET_IF_SEND, 0, &SendReq.Hdr); 411 411 412 rc = I NTNETRingWriteFrame(&pThis->m_pIfBuf->Send, pvFrame, cbFrame);412 rc = IntNetRingWriteFrame(&pThis->m_pIfBuf->Send, pvFrame, cbFrame); 413 413 414 414 } -
trunk/src/VBox/NetworkServices/NetLib/VBoxNetARP.cpp
r28025 r28714 46 46 * Valid IntNet Ethernet frame? Skip GSO, no ARP in there. 47 47 */ 48 PCINTNETHDR pHdr = I NTNETRingGetNextFrameToRead(&pBuf->Recv);48 PCINTNETHDR pHdr = IntNetRingGetNextFrameToRead(&pBuf->Recv); 49 49 if ( !pHdr 50 50 || pHdr->u16Type != INTNETHDR_TYPE_FRAME) … … 52 52 53 53 size_t cbFrame = pHdr->cbFrame; 54 const void *pvFrame = I NTNETHdrGetFramePtr(pHdr, pBuf);54 const void *pvFrame = IntNetHdrGetFramePtr(pHdr, pBuf); 55 55 PCRTNETETHERHDR pEthHdr = (PCRTNETETHERHDR)pvFrame; 56 56 -
trunk/src/VBox/NetworkServices/NetLib/VBoxNetIntIf.cpp
r27856 r28714 80 80 * @param cSegs The number of segments. 81 81 * @param paSegs The segments. 82 * @remark This is the same as INTNETRingWriteFrame and83 * drvIntNetRingWriteFrame.84 82 */ 85 83 int VBoxNetIntIfRingWriteFrame(PINTNETBUF pBuf, PINTNETRINGBUF pRingBuf, size_t cSegs, PCINTNETSEG paSegs) … … 106 104 PINTNETHDR pHdr; 107 105 void *pvFrame; 108 int rc = I NTNETRingAllocateFrame(pRingBuf, cbFrame, &pHdr, &pvFrame);106 int rc = IntNetRingAllocateFrame(pRingBuf, cbFrame, &pHdr, &pvFrame); 109 107 if (RT_SUCCESS(rc)) 110 108 { 111 109 vboxnetIntIfCopySG(pvFrame, cSegs, paSegs); 112 I NTNETRingCommitFrame(pRingBuf, pHdr);110 IntNetRingCommitFrame(pRingBuf, pHdr); 113 111 return VINF_SUCCESS; 114 112 } -
trunk/src/VBox/NetworkServices/NetLib/VBoxNetUDP.cpp
r28156 r28714 64 64 * Valid IntNet Ethernet frame? 65 65 */ 66 PCINTNETHDR pHdr = I NTNETRingGetNextFrameToRead(&pBuf->Recv);66 PCINTNETHDR pHdr = IntNetRingGetNextFrameToRead(&pBuf->Recv); 67 67 if ( !pHdr 68 68 || ( pHdr->u16Type != INTNETHDR_TYPE_FRAME … … 71 71 72 72 size_t cbFrame = pHdr->cbFrame; 73 const void *pvFrame = I NTNETHdrGetFramePtr(pHdr, pBuf);73 const void *pvFrame = IntNetHdrGetFramePtr(pHdr, pBuf); 74 74 PCPDMNETWORKGSO pGso = NULL; 75 75 if (pHdr->u16Type == INTNETHDR_TYPE_GSO)
Note:
See TracChangeset
for help on using the changeset viewer.