VirtualBox

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


Ignore:
Timestamp:
Apr 6, 2012 3:05:04 PM (13 years ago)
Author:
vboxsync
Message:

e1000: VLAN support to match the spec (#4806)

File:
1 edited

Legend:

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

    r40793 r40794  
    20272027    Assert(cb <= E1K_MAX_RX_PKT_SIZE);
    20282028    Assert(cb > 16);
    2029     if (status.fVP && cb > 16)
    2030     {
    2031         uint16_t *u16Ptr = (uint16_t*)pvBuf;
    2032         /* VLAN packet -- strip VLAN tag */
    2033         memcpy(rxPacket, pvBuf, 12); /* Copy src and dst addresses */
    2034         status.u16Special = RT_BE2H_U16(u16Ptr[7]); /* Extract VLAN tag */
    2035         memcpy(rxPacket + 12, (uint8_t*)pvBuf + 16, cb - 16); /* Copy the rest of the packet */
     2029    if (status.fVP)
     2030    {
     2031        /* VLAN packet -- strip VLAN tag in VLAN mode */
     2032        if ((CTRL & CTRL_VME) && cb > 16)
     2033        {
     2034            uint16_t *u16Ptr = (uint16_t*)pvBuf;
     2035            memcpy(rxPacket, pvBuf, 12); /* Copy src and dst addresses */
     2036            status.u16Special = RT_BE2H_U16(u16Ptr[7]); /* Extract VLAN tag */
     2037            memcpy(rxPacket + 12, (uint8_t*)pvBuf + 16, cb - 16); /* Copy the rest of the packet */
     2038            cb -= 4;
     2039            E1kLog3(("%s Stripped tag for VLAN %u (cb=%u)\n",
     2040                     INSTANCE(pState), status.u16Special, cb));
     2041        }
     2042        else
     2043            status.fVP = false; /* Set VP only if we stripped the tag */
    20362044    }
    20372045    else
     
    49604968    }
    49614969
    4962     /* Is VLAN filtering enabled? */
    4963     if (RCTL & RCTL_VFE)
    4964     {
    4965         uint16_t *u16Ptr = (uint16_t*)pvBuf;
    4966         /* Compare TPID with VLAN Ether Type */
    4967         if (RT_BE2H_U16(u16Ptr[6]) == VET)
    4968         {
    4969             pStatus->fVP = true;
     4970    uint16_t *u16Ptr = (uint16_t*)pvBuf;
     4971    /* Compare TPID with VLAN Ether Type */
     4972    if (RT_BE2H_U16(u16Ptr[6]) == VET)
     4973    {
     4974        pStatus->fVP = true;
     4975        /* Is VLAN filtering enabled? */
     4976        if (RCTL & RCTL_VFE)
     4977        {
    49704978            /* It is 802.1q packet indeed, let's filter by VID */
    49714979            if (RCTL & RCTL_CFIEN)
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