Changeset 28157 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/linux
- Timestamp:
- Apr 10, 2010 1:14:45 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r28156 r28157 324 324 */ 325 325 pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev); 326 #if 0 /* trying to figure out why submitting GSOs is so darn slow. */ 327 if ( pSG->GsoCtx.u8Type != PDMNETWORKGSOTYPE_INVALID 328 && pSG->cbTotal > 4096 329 && fDstWire 330 && pDev 331 && (pDev->features & NETIF_F_SG) 332 ) 333 { 334 uint32_t off = 0; 335 uint32_t cbLeft = pSG->cbTotal; 336 uint32_t iFrag = 0; 337 338 pPkt = dev_alloc_skb(pSG->GsoCtx.cbHdrs + NET_IP_ALIGN + 64); 339 if (RT_UNLIKELY(!pPkt)) 340 { 341 Log(("vboxNetFltLinuxSkBufFromSG: Failed to allocate sk_buff(%u).\n", pSG->cbTotal)); 342 pSG->pvUserData = NULL; 343 return NULL; 344 } 345 pPkt->dev = pDev; 346 pPkt->ip_summed = CHECKSUM_NONE; 347 348 /* Align IP header on 16-byte boundary: 2 + 14 (ethernet hdr size). */ 349 skb_reserve(pPkt, NET_IP_ALIGN); 350 351 /* Copy the headers. */ 352 skb_put(pPkt, pSG->GsoCtx.cbHdrs); 353 INTNETSgReadEx(pSG, off, pSG->GsoCtx.cbHdrs, pPkt->data); 354 off += pSG->GsoCtx.cbHdrs; 355 cbLeft -= off; 356 357 /* Copy the payload into fragments. */ 358 while (cbLeft) 359 { 360 void *pvPage; 361 uint32_t cbUsed = RT_MIN(cbLeft, PAGE_SIZE); 362 struct page *pPage = alloc_page(GFP_ATOMIC); 363 if (!pPage) 364 { 365 dev_kfree_skb(pPkt); 366 return NULL; 367 } 368 369 skb_fill_page_desc(pPkt, iFrag, pPage, 0, cbUsed); 370 371 pvPage = kmap(pPage); 372 INTNETSgReadEx(pSG, off, cbUsed, pvPage); 373 kunmap(pPage); 374 375 /* advance */ 376 iFrag += 1; 377 pPkt->len += cbUsed; 378 pPkt->data_len += cbUsed; 379 pPkt->truesize += cbUsed; 380 off += cbUsed; 381 cbLeft -= cbUsed; 382 } 383 } 384 else 385 #endif 386 { 387 pPkt = dev_alloc_skb(pSG->cbTotal + NET_IP_ALIGN); 388 if (RT_UNLIKELY(!pPkt)) 389 { 390 Log(("vboxNetFltLinuxSkBufFromSG: Failed to allocate sk_buff(%u).\n", pSG->cbTotal)); 391 pSG->pvUserData = NULL; 392 return NULL; 393 } 394 pPkt->dev = pDev; 395 pPkt->ip_summed = CHECKSUM_NONE; 396 397 /* Align IP header on 16-byte boundary: 2 + 14 (ethernet hdr size). */ 398 skb_reserve(pPkt, NET_IP_ALIGN); 399 400 /* Copy the segments. */ 401 skb_put(pPkt, pSG->cbTotal); 402 INTNETSgRead(pSG, pPkt->data); 403 } 326 pPkt = dev_alloc_skb(pSG->cbTotal + NET_IP_ALIGN); 327 if (RT_UNLIKELY(!pPkt)) 328 { 329 Log(("vboxNetFltLinuxSkBufFromSG: Failed to allocate sk_buff(%u).\n", pSG->cbTotal)); 330 pSG->pvUserData = NULL; 331 return NULL; 332 } 333 pPkt->dev = pDev; 334 pPkt->ip_summed = CHECKSUM_NONE; 335 336 /* Align IP header on 16-byte boundary: 2 + 14 (ethernet hdr size). */ 337 skb_reserve(pPkt, NET_IP_ALIGN); 338 339 /* Copy the segments. */ 340 skb_put(pPkt, pSG->cbTotal); 341 INTNETSgRead(pSG, pPkt->data); 404 342 405 343 #if defined(VBOXNETFLT_WITH_GSO_XMIT_WIRE) || defined(VBOXNETFLT_WITH_GSO_XMIT_HOST)
Note:
See TracChangeset
for help on using the changeset viewer.