Changeset 30732 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/linux
- Timestamp:
- Jul 8, 2010 11:17:25 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r30558 r30732 1150 1150 Assert(!skb_shinfo(pBuf)->frag_list); 1151 1151 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 1161 1152 if (!pGsoCtx) 1162 1153 IntNetSgInitTempSegs(pSG, pBuf->len, cSegs, 0 /*cSegsUsed*/); … … 1246 1237 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", 1247 1238 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))); 1248 1240 #else 1249 1241 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", … … 1288 1280 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", 1289 1281 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))); 1290 1283 # else 1291 1284 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", … … 1426 1419 return false; 1427 1420 } 1421 /* 1422 * It is possible to receive GSO packets from wire if GRO is enabled. 1423 */ 1428 1424 if (RT_UNLIKELY(fSrc & INTNETTRUNKDIR_WIRE)) 1429 1425 { 1430 1426 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. */ 1431 1438 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 */ 1437 1446 #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; 1440 1449 #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 } 1444 1454 1445 1455 /* … … 1639 1649 if (RT_LIKELY(pSG)) 1640 1650 { 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 1641 1660 vboxNetFltLinuxSkBufToSG(pThis, pBuf, pSG, cSegs, fSrc, NULL /*pGsoCtx*/); 1642 1661
Note:
See TracChangeset
for help on using the changeset viewer.