VirtualBox

Changeset 39367 in vbox


Ignore:
Timestamp:
Nov 18, 2011 2:16:57 PM (13 years ago)
Author:
vboxsync
Message:

e1000: frame size and fallback buffer allocation fixes (#4806)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevE1000.cpp

    r39357 r39367  
    31923192{
    31933193    PPDMSCATTERGATHER   pSg     = pState->CTX_SUFF(pTxSg);
    3194     uint32_t const      cbFrame = pSg ? ((uint32_t)pSg->cbUsed + (pState->fVTag ? 4 : 0)) : 0;
     3194    uint32_t            cbFrame = pSg ? (uint32_t)pSg->cbUsed : 0;
    31953195    Assert(!pSg || pSg->cSegs == 1);
    31963196
     3197    if (cbFrame > 70) /* unqualified guess */
     3198        pState->led.Asserted.s.fWriting = pState->led.Actual.s.fWriting = 1;
     3199
     3200    /* Add VLAN tag */
     3201    if (cbFrame > 12 && pState->fVTag)
     3202    {
     3203        E1kLog3(("%s Inserting VLAN tag %08x\n",
     3204            INSTANCE(pState), RT_BE2H_U16(VET) | (RT_BE2H_U16(pState->u16VTagTCI) << 16)));
     3205        memmove((uint8_t*)pSg->aSegs[0].pvSeg + 16, (uint8_t*)pSg->aSegs[0].pvSeg + 12, cbFrame - 12);
     3206        *((uint32_t*)pSg->aSegs[0].pvSeg + 3) = RT_BE2H_U16(VET) | (RT_BE2H_U16(pState->u16VTagTCI) << 16);
     3207        pSg->cbUsed += 4;
     3208        cbFrame     += 4;
     3209        Assert(pSg->cbUsed == cbFrame);
     3210        Assert(pSg->cbUsed <= pSg->cbAvailable);
     3211    }
    31973212/*    E1kLog2(("%s <<< Outgoing packet. Dump follows: >>>\n"
    31983213            "%.*Rhxd\n"
     
    32003215            INSTANCE(pState), cbFrame, pSg->aSegs[0].pvSeg, INSTANCE(pState)));*/
    32013216
    3202     if (cbFrame > 70) /* unqualified guess */
    3203         pState->led.Asserted.s.fWriting = pState->led.Actual.s.fWriting = 1;
    3204 
    3205     /* Add VLAN tag */
    3206     if (cbFrame > 16 && pState->fVTag)
    3207     {
    3208         E1kLog3(("%s Inserting VLAN tag %08x\n",
    3209             INSTANCE(pState), RT_BE2H_U16(VET) | (RT_BE2H_U16(pState->u16VTagTCI) << 16)));
    3210         memmove((uint8_t*)pSg->aSegs[0].pvSeg + 16, (uint8_t*)pSg->aSegs[0].pvSeg + 12, cbFrame - 12);
    3211         *((uint32_t*)pSg->aSegs[0].pvSeg + 3) = RT_BE2H_U16(VET) | (RT_BE2H_U16(pState->u16VTagTCI) << 16);
    3212     }
    32133217    /* Update the stats */
    32143218    E1K_INC_CNT32(TPT);
     
    34173421         */
    34183422        if (!pState->CTX_SUFF(pTxSg))
    3419             e1kXmitAllocBuf(pState, pState->u16TxPktLen, true /*fExactSize*/, false /*fGso*/);
     3423            e1kXmitAllocBuf(pState, pState->u16TxPktLen + (pState->fVTag ? 4 : 0), true /*fExactSize*/, false /*fGso*/);
    34203424        if (pState->CTX_SUFF(pTxSg))
    34213425        {
Note: See TracChangeset for help on using the changeset viewer.

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