Changeset 28075 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Apr 7, 2010 11:42:21 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r28068 r28075 462 462 463 463 /** 464 * Reads an entire SG into a fittingly size buffer.465 *466 * @param pSG The SG list to read.467 * @param pvBuf The buffer to read into (at least pSG->cbTotal in size).468 */469 DECLINLINE(void) intnetR0SgRead(PCINTNETSG pSG, void *pvBuf)470 {471 if (pSG->cSegsUsed == 1)472 {473 Assert(pSG->cbTotal == pSG->aSegs[0].cb);474 memcpy(pvBuf, pSG->aSegs[0].pv, pSG->cbTotal);475 }476 else477 {478 uint8_t *pbDst = (uint8_t *)pvBuf;479 unsigned const cSegs = pSG->cSegsUsed; Assert(cSegs == pSG->cSegsUsed);480 for (unsigned iSeg = 0; iSeg < cSegs; iSeg++)481 {482 uint32_t cbSeg = pSG->aSegs[iSeg].cb;483 Assert(cbSeg <= pSG->cbTotal && (uintptr_t)(pbDst - (uint8_t *)pvBuf) + cbSeg <= pSG->cbTotal);484 memcpy(pbDst, pSG->aSegs[iSeg].pv, cbSeg);485 pbDst += cbSeg;486 }487 }488 }489 490 491 492 493 494 495 496 /**497 464 * Retain an interface. 498 465 * … … 1526 1493 if (RT_SUCCESS(rc)) 1527 1494 { 1528 intnetR0SgRead(pSG, pvDst);1495 INTNETSgRead(pSG, pvDst); 1529 1496 if (pNewDstMac) 1530 1497 ((PRTNETETHERHDR)pvDst)->DstMac = *pNewDstMac; … … 2437 2404 INTNETSgInitTempGso(&Sg, pvCurFrame, cbFrame, pGso); 2438 2405 if (pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE) 2439 intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, pHdr->cbFrame, true /*fGso*/, (uint16_t *)&Sg.fFlags);2406 intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, cbFrame, true /*fGso*/, (uint16_t *)&Sg.fFlags); 2440 2407 intnetR0NetworkSend(pNetwork, pIf, 0, &Sg, !!pTrunkIf); 2441 2408 }
Note:
See TracChangeset
for help on using the changeset viewer.