VirtualBox

Changeset 46904 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jul 2, 2013 12:59:56 PM (11 years ago)
Author:
vboxsync
Message:

IntNet, VirtioNet, NetFilter: Large frame support + drop oversized + UFO fix (#6821)

Location:
trunk/src/VBox/Devices/Network
Files:
4 edited

Legend:

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

    r46576 r46904  
    6767
    6868#define VNET_TX_DELAY           150   /**< 150 microseconds */
    69 #define VNET_MAX_FRAME_SIZE     65536  ///< @todo Is it the right limit?
     69#define VNET_MAX_FRAME_SIZE     65535 + 18  /**< Max IP packet size + Ethernet header with VLAN tag */
    7070#define VNET_MAC_FILTER_LEN     32
    7171#define VNET_MAX_VID            (1 << 12)
     
    386386        | VNET_F_HOST_TSO4
    387387        | VNET_F_HOST_TSO6
    388 /*        | VNET_F_HOST_UFO   -- Disabled temporarely (see @bugref{6821}) */
     388        | VNET_F_HOST_UFO
    389389        | VNET_F_GUEST_CSUM   /* We expect the guest to accept partial TCP checksums (see @bugref{4796}) */
    390390        | VNET_F_GUEST_TSO4
     
    11551155            for (unsigned int i = 1; i < elem.nOut; i++)
    11561156                uSize += elem.aSegsOut[i].cb;
     1157            Log5(("%s vnetTransmitPendingPackets: complete frame is %u bytes.\n",
     1158                  INSTANCE(pThis), uSize));
    11571159            Assert(uSize <= VNET_MAX_FRAME_SIZE);
    11581160            if (pThis->pDrv)
     
    12111213                            /* Update GSO structure embedded into the frame */
    12121214                            ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsTotal = pGso->cbHdrsTotal;
    1213                             ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsSeg   = pGso->cbHdrsTotal;
     1215                            ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsSeg   = pGso->cbHdrsSeg;
    12141216                            Log4(("%s vnetTransmitPendingPackets: adjusted HdrLen to %d.\n",
    12151217                                  INSTANCE(pThis), pGso->cbHdrsTotal));
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r46326 r46904  
    463463    Assert(pSgBuf->fFlags == (PDMSCATTERGATHER_FLAGS_MAGIC | PDMSCATTERGATHER_FLAGS_OWNER_1));
    464464    Assert(pSgBuf->cbUsed <= pSgBuf->cbAvailable);
    465     Assert(   pHdr->u16Type == INTNETHDR_TYPE_FRAME
    466            || pHdr->u16Type == INTNETHDR_TYPE_GSO);
     465    Assert(   pHdr->u8Type == INTNETHDR_TYPE_FRAME
     466           || pHdr->u8Type == INTNETHDR_TYPE_GSO);
    467467    Assert(PDMCritSectIsOwner(&pThis->XmitLock));
    468468
    469469    /** @todo LATER: try unalloc the frame. */
    470     pHdr->u16Type = INTNETHDR_TYPE_PADDING;
     470    pHdr->u8Type = INTNETHDR_TYPE_PADDING;
    471471    IntNetRingCommitFrame(&pThis->CTX_SUFF(pBuf)->Send, pHdr);
    472472
     
    703703
    704704            Log2(("pHdr=%p offRead=%#x: %.8Rhxs\n", pHdr, pRingBuf->offReadX, pHdr));
    705             uint16_t u16Type = pHdr->u16Type;
    706             if (    (   u16Type == INTNETHDR_TYPE_FRAME
    707                      || u16Type == INTNETHDR_TYPE_GSO)
     705            uint8_t u8Type = pHdr->u8Type;
     706            if (    (   u8Type == INTNETHDR_TYPE_FRAME
     707                     || u8Type == INTNETHDR_TYPE_GSO)
    708708                &&  !pThis->fLinkDown)
    709709            {
     
    715715                if (rc == VINF_SUCCESS)
    716716                {
    717                     if (u16Type == INTNETHDR_TYPE_FRAME)
     717                    if (u8Type == INTNETHDR_TYPE_FRAME)
    718718                    {
    719719                        /*
     
    814814                             * NIC is going down, likely because the VM is being reset. Skip the frame.
    815815                             */
    816                             AssertMsg(IntNetIsValidFrameType(pHdr->u16Type), ("Unknown frame type %RX16! offRead=%#x\n", pHdr->u16Type, pRingBuf->offReadX));
     816                            AssertMsg(IntNetIsValidFrameType(pHdr->u8Type), ("Unknown frame type %RX16! offRead=%#x\n", pHdr->u8Type, pRingBuf->offReadX));
    817817                            IntNetRingSkipFrame(pRingBuf);
    818818                        }
     
    831831                 * Link down or unknown frame - skip to the next frame.
    832832                 */
    833                 AssertMsg(IntNetIsValidFrameType(pHdr->u16Type), ("Unknown frame type %RX16! offRead=%#x\n", pHdr->u16Type, pRingBuf->offReadX));
     833                AssertMsg(IntNetIsValidFrameType(pHdr->u8Type), ("Unknown frame type %RX16! offRead=%#x\n", pHdr->u8Type, pRingBuf->offReadX));
    834834                IntNetRingSkipFrame(pRingBuf);
    835835                STAM_REL_COUNTER_INC(&pBuf->cStatBadFrames);
  • trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp

    r45717 r46904  
    26882688
    26892689    /*
     2690     * @todo: We have to adjust MSS so it does not exceed the value configured
     2691     * for the host's interface.
     2692     */
     2693
     2694    /*
    26902695     * Carve out the frame segments with the header and frame in different
    26912696     * scatter / gather segments.
     
    37443749            while ((pHdr = IntNetRingGetNextFrameToRead(&pIf->pIntBuf->Send)) != NULL)
    37453750            {
    3746                 uint16_t const      u16Type = pHdr->u16Type;
    3747                 if (u16Type == INTNETHDR_TYPE_FRAME)
     3751                uint8_t const      u8Type = pHdr->u8Type;
     3752                if (u8Type == INTNETHDR_TYPE_FRAME)
    37483753                {
    37493754                    /* Send regular frame. */
     
    37543759                    enmSwDecision = intnetR0NetworkSend(pNetwork, pIf,  0 /*fSrc*/, &Sg, pDstTab);
    37553760                }
    3756                 else if (u16Type == INTNETHDR_TYPE_GSO)
     3761                else if (u8Type == INTNETHDR_TYPE_GSO)
    37573762                {
    37583763                    /* Send GSO frame if sane. */
     
    37763781                else
    37773782                {
    3778                     if (u16Type != INTNETHDR_TYPE_PADDING)
     3783                    if (u8Type != INTNETHDR_TYPE_PADDING)
    37793784                        STAM_REL_COUNTER_INC(&pIf->pIntBuf->cStatBadFrames); /* ignore */
    37803785                    enmSwDecision = INTNETSWDECISION_DROP;
  • trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp

    r44528 r46904  
    463463        while ((pHdr = IntNetRingGetNextFrameToRead(pRingBuf)))
    464464        {
    465             if (pHdr->u16Type == INTNETHDR_TYPE_FRAME)
     465            if (pHdr->u8Type == INTNETHDR_TYPE_FRAME)
    466466            {
    467467                size_t      cbFrame = pHdr->cbFrame;
     
    540540                }
    541541            }
    542             else if (pHdr->u16Type == INTNETHDR_TYPE_GSO)
     542            else if (pHdr->u8Type == INTNETHDR_TYPE_GSO)
    543543            {
    544544                PCPDMNETWORKGSO pGso    = IntNetHdrGetGsoContext(pHdr, pBuf);
     
    568568                }
    569569            }
    570             else if (pHdr->u16Type != INTNETHDR_TYPE_PADDING)
     570            else if (pHdr->u8Type != INTNETHDR_TYPE_PADDING)
    571571            {
    572                 RTPrintf("tstIntNet-1: Unknown frame type %d\n", pHdr->u16Type);
     572                RTPrintf("tstIntNet-1: Unknown frame type %d\n", pHdr->u8Type);
    573573                STAM_REL_COUNTER_INC(&pBuf->cStatBadFrames);
    574574                g_cErrors++;
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