VirtualBox

Changeset 28075 in vbox


Ignore:
Timestamp:
Apr 7, 2010 11:42:21 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59785
Message:

intnetinline.h: INTNETRingCommitFrameEx must account for the GSO header.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/intnetinline.h

    r28071 r28075  
    579579 * @param   pHdr                The frame header returned by
    580580 *                              INTNETRingAllocateFrame.
    581  * @param   cbUsed              The amount of space actually used.
     581 * @param   cbUsed              The amount of space actually used.  This does
     582 *                              not include the GSO part.
    582583 */
    583584DECLINLINE(void) INTNETRingCommitFrameEx(PINTNETRINGBUF pRingBuf, PINTNETHDR pHdr, size_t cbUsed)
     
    589590    INTNETHDR_ASSERT_SANITY(pHdr, pRingBuf);
    590591    Assert(pRingBuf->offWriteCom == ((uintptr_t)pHdr - (uintptr_t)pRingBuf));
     592
     593    if (pHdr->u16Type == INTNETHDR_TYPE_GSO)
     594        cbUsed += sizeof(PDMNETWORKGSO);
    591595
    592596    /*
  • trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp

    r28068 r28075  
    462462
    463463/**
    464  * Reads an entire SG into a fittingly size buffer.
    465  *
    466  * @param   pSG         The SG list to read.
    467  * @param   pvBuf       The buffer to read into (at least pSG->cbTotal in size).
    468  */
    469 DECLINLINE(void) intnetR0SgRead(PCINTNETSG pSG, void *pvBuf)
    470 {
    471     if (pSG->cSegsUsed == 1)
    472     {
    473         Assert(pSG->cbTotal == pSG->aSegs[0].cb);
    474         memcpy(pvBuf, pSG->aSegs[0].pv, pSG->cbTotal);
    475     }
    476     else
    477     {
    478         uint8_t       *pbDst = (uint8_t *)pvBuf;
    479         unsigned const cSegs = pSG->cSegsUsed; Assert(cSegs == pSG->cSegsUsed);
    480         for (unsigned iSeg = 0; iSeg < cSegs; iSeg++)
    481         {
    482             uint32_t cbSeg = pSG->aSegs[iSeg].cb;
    483             Assert(cbSeg <= pSG->cbTotal && (uintptr_t)(pbDst - (uint8_t *)pvBuf) + cbSeg <= pSG->cbTotal);
    484             memcpy(pbDst, pSG->aSegs[iSeg].pv, cbSeg);
    485             pbDst += cbSeg;
    486         }
    487     }
    488 }
    489 
    490 
    491 
    492 
    493 
    494 
    495 
    496 /**
    497464 * Retain an interface.
    498465 *
     
    15261493    if (RT_SUCCESS(rc))
    15271494    {
    1528         intnetR0SgRead(pSG, pvDst);
     1495        INTNETSgRead(pSG, pvDst);
    15291496        if (pNewDstMac)
    15301497            ((PRTNETETHERHDR)pvDst)->DstMac = *pNewDstMac;
     
    24372404                INTNETSgInitTempGso(&Sg, pvCurFrame, cbFrame, pGso);
    24382405                if (pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE)
    2439                     intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, pHdr->cbFrame, true /*fGso*/, (uint16_t *)&Sg.fFlags);
     2406                    intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, cbFrame, true /*fGso*/, (uint16_t *)&Sg.fFlags);
    24402407                intnetR0NetworkSend(pNetwork, pIf, 0, &Sg, !!pTrunkIf);
    24412408            }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette