VirtualBox

Ignore:
Timestamp:
Jul 8, 2010 11:17:25 AM (14 years ago)
Author:
vboxsync
Message:

vboxnetflt: Fixed GRO problem on Linux (#5121)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c

    r30558 r30732  
    11501150    Assert(!skb_shinfo(pBuf)->frag_list);
    11511151
    1152     if (fSrc & INTNETTRUNKDIR_WIRE)
    1153     {
    1154         /*
    1155          * The packet came from wire, ethernet header was removed by device driver.
    1156          * Restore it.
    1157          */
    1158         skb_push(pBuf, ETH_HLEN);
    1159     }
    1160 
    11611152    if (!pGsoCtx)
    11621153        IntNetSgInitTempSegs(pSG, pBuf->len, cSegs, 0 /*cSegsUsed*/);
     
    12461237    Log3(("vboxNetFltLinuxPacketHandler: skb len=%u data_len=%u truesize=%u next=%p nr_frags=%u gso_size=%u gso_seqs=%u gso_type=%x frag_list=%p pkt_type=%x\n",
    12471238          pBuf->len, pBuf->data_len, pBuf->truesize, pBuf->next, skb_shinfo(pBuf)->nr_frags, skb_shinfo(pBuf)->gso_size, skb_shinfo(pBuf)->gso_segs, skb_shinfo(pBuf)->gso_type, skb_shinfo(pBuf)->frag_list, pBuf->pkt_type));
     1239    Log4(("vboxNetFltLinuxPacketHandler: packet dump follows:\n%.*Rhxd\n", pBuf->len-pBuf->data_len, skb_mac_header(pBuf)));
    12481240#else
    12491241    Log3(("vboxNetFltLinuxPacketHandler: skb len=%u data_len=%u truesize=%u next=%p nr_frags=%u tso_size=%u tso_seqs=%u frag_list=%p pkt_type=%x\n",
     
    12881280        Log3(("vboxNetFltLinuxPacketHandler: skb copy len=%u data_len=%u truesize=%u next=%p nr_frags=%u gso_size=%u gso_seqs=%u gso_type=%x frag_list=%p pkt_type=%x\n",
    12891281              pBuf->len, pBuf->data_len, pBuf->truesize, pBuf->next, skb_shinfo(pBuf)->nr_frags, skb_shinfo(pBuf)->gso_size, skb_shinfo(pBuf)->gso_segs, skb_shinfo(pBuf)->gso_type, skb_shinfo(pBuf)->frag_list, pBuf->pkt_type));
     1282        Log4(("vboxNetFltLinuxPacketHandler: packet dump follows:\n%.*Rhxd\n", pBuf->len-pBuf->data_len, skb_mac_header(pBuf)));
    12901283# else
    12911284        Log3(("vboxNetFltLinuxPacketHandler: skb copy len=%u data_len=%u truesize=%u next=%p nr_frags=%u tso_size=%u tso_seqs=%u frag_list=%p pkt_type=%x\n",
     
    14261419        return false;
    14271420    }
     1421    /*
     1422     * It is possible to receive GSO packets from wire if GRO is enabled.
     1423     */
    14281424    if (RT_UNLIKELY(fSrc & INTNETTRUNKDIR_WIRE))
    14291425    {
    14301426        Log5(("vboxNetFltLinuxCanForwardAsGso: fSrc=wire\n"));
     1427#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
     1428        /*
     1429         * The packet came from the wire and the driver has already consumed
     1430         * mac header. We need to restore it back.
     1431         */
     1432        pSkb->mac_len = pSkb->network_header - pSkb->mac_header;
     1433        skb_push(pSkb, pSkb->mac_len);
     1434        Log5(("vboxNetFltLinuxCanForwardAsGso: mac_len=%d data=%p mac_header=%p network_header=%p\n",
     1435              pSkb->mac_len, pSkb->data, skb_mac_header(pSkb), skb_network_header(pSkb)));
     1436#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) */
     1437        /* Older kernels didn't have GRO. */
    14311438        return false;
    1432     }
    1433 
    1434     /*
    1435      * skb_gso_segment does the following. Do we need to do it as well?
    1436      */
     1439#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) */
     1440    }
     1441    else
     1442    {
     1443        /*
     1444         * skb_gso_segment does the following. Do we need to do it as well?
     1445         */
    14371446#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
    1438     skb_reset_mac_header(pSkb);
    1439     pSkb->mac_len = pSkb->network_header - pSkb->mac_header;
     1447        skb_reset_mac_header(pSkb);
     1448        pSkb->mac_len = pSkb->network_header - pSkb->mac_header;
    14401449#else
    1441     pSkb->mac.raw = pSkb->data;
    1442     pSkb->mac_len = pSkb->nh.raw - pSkb->data;
    1443 #endif
     1450        pSkb->mac.raw = pSkb->data;
     1451        pSkb->mac_len = pSkb->nh.raw - pSkb->data;
     1452#endif
     1453    }
    14441454
    14451455    /*
     
    16391649        if (RT_LIKELY(pSG))
    16401650        {
     1651            if (fSrc & INTNETTRUNKDIR_WIRE)
     1652            {
     1653                /*
     1654                 * The packet came from wire, ethernet header was removed by device driver.
     1655                 * Restore it.
     1656                 */
     1657                skb_push(pBuf, ETH_HLEN);
     1658            }
     1659
    16411660            vboxNetFltLinuxSkBufToSG(pThis, pBuf, pSG, cSegs, fSrc, NULL /*pGsoCtx*/);
    16421661
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