Changeset 38549 in vbox for trunk/include
- Timestamp:
- Aug 26, 2011 1:26:07 PM (13 years ago)
- Location:
- trunk/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/intnetinline.h
r28848 r38549 75 75 pSG->fFlags = INTNETSG_FLAGS_TEMP; 76 76 pSG->GsoCtx.u8Type = (uint8_t)PDMNETWORKGSOTYPE_INVALID; 77 pSG->GsoCtx.cbHdrs = 0; 77 pSG->GsoCtx.cbHdrsTotal = 0; 78 pSG->GsoCtx.cbHdrsSeg = 0; 78 79 pSG->GsoCtx.cbMaxSeg= 0; 79 80 pSG->GsoCtx.offHdr1 = 0; 80 81 pSG->GsoCtx.offHdr2 = 0; 81 pSG->GsoCtx.au8Unused[0] = 0; 82 pSG->GsoCtx.au8Unused[1] = 0; 82 pSG->GsoCtx.u8Unused= 0; 83 83 #if ARCH_BITS == 64 84 84 pSG->uPadding = 0; … … 113 113 pSG->fFlags = INTNETSG_FLAGS_TEMP; 114 114 pSG->GsoCtx.u8Type = pGso->u8Type; 115 pSG->GsoCtx.cbHdrs = pGso->cbHdrs; 115 pSG->GsoCtx.cbHdrsTotal = pGso->cbHdrsTotal; 116 pSG->GsoCtx.cbHdrsSeg = pGso->cbHdrsSeg; 116 117 pSG->GsoCtx.cbMaxSeg= pGso->cbMaxSeg; 117 118 pSG->GsoCtx.offHdr1 = pGso->offHdr1; 118 119 pSG->GsoCtx.offHdr2 = pGso->offHdr2; 119 pSG->GsoCtx.au8Unused[0] = 0; 120 pSG->GsoCtx.au8Unused[1] = 0; 120 pSG->GsoCtx.u8Unused= 0; 121 121 #if ARCH_BITS == 64 122 122 pSG->uPadding = 0; -
trunk/include/VBox/types.h
r37702 r38549 948 948 uint8_t u8Type; 949 949 /** The total header size. */ 950 uint8_t cbHdrs ;950 uint8_t cbHdrsTotal; 951 951 /** The max segment size (MSS) to apply. */ 952 952 uint16_t cbMaxSeg; … … 956 956 /** Offset of the second header (TCP / UDP). 0 if not not needed. */ 957 957 uint8_t offHdr2; 958 /** The header size used for segmentation (equal to offHdr2 in UFO). */ 959 uint8_t cbHdrsSeg; 958 960 /** Unused. */ 959 uint8_t au8Unused[2];961 uint8_t u8Unused; 960 962 } PDMNETWORKGSO; 961 963 /** Pointer to a GSO context. */ -
trunk/include/VBox/vmm/pdmnetinline.h
r35361 r38549 80 80 if (RT_UNLIKELY( pGso->offHdr2 <= pGso->offHdr1 )) 81 81 return false; 82 if (RT_UNLIKELY( pGso->cbHdrs <= pGso->offHdr2 ))82 if (RT_UNLIKELY( pGso->cbHdrsTotal <= pGso->offHdr2 )) 83 83 return false; 84 84 … … 113 113 case PDMNETWORKGSOTYPE_IPV6_TCP: 114 114 case PDMNETWORKGSOTYPE_IPV4_IPV6_TCP: 115 if (RT_UNLIKELY( (unsigned)pGso->cbHdrs - pGso->offHdr2 < RTNETTCP_MIN_LEN ))115 if (RT_UNLIKELY( (unsigned)pGso->cbHdrsTotal - pGso->offHdr2 < RTNETTCP_MIN_LEN )) 116 116 return false; 117 117 break; … … 119 119 case PDMNETWORKGSOTYPE_IPV6_UDP: 120 120 case PDMNETWORKGSOTYPE_IPV4_IPV6_UDP: 121 if (RT_UNLIKELY( (unsigned)pGso->cbHdrs - pGso->offHdr2 < RTNETUDP_MIN_LEN ))121 if (RT_UNLIKELY( (unsigned)pGso->cbHdrsTotal - pGso->offHdr2 < RTNETUDP_MIN_LEN )) 122 122 return false; 123 123 break; … … 129 129 130 130 /* There must be at more than one segment. */ 131 if (RT_UNLIKELY( cbFrame <= pGso->cbHdrs ))131 if (RT_UNLIKELY( cbFrame <= pGso->cbHdrsTotal )) 132 132 return false; 133 if (RT_UNLIKELY( cbFrame - pGso->cbHdrs < pGso->cbMaxSeg ))133 if (RT_UNLIKELY( cbFrame - pGso->cbHdrsTotal < pGso->cbMaxSeg )) 134 134 return false; 135 135 … … 137 137 } 138 138 139 140 /** 141 * Returns the length of header for a particular segment/fragment. 142 * 143 * We cannot simply treat UDP header as a part of payload because we do not 144 * want to modify the payload but still need to modify the checksum field in 145 * UDP header. So we want to include UDP header when calculating the length 146 * of headers in the first segment getting it copied to a temporary buffer 147 * along with other headers. 148 * 149 * @returns Length of headers (including UDP header for the first fragment). 150 * @param pGso The GSO context. 151 * @param iSeg The segment index. 152 */ 153 DECLINLINE(uint8_t) pdmNetSegHdrLen(PCPDMNETWORKGSO pGso, uint32_t iSeg) 154 { 155 return iSeg ? pGso->cbHdrsSeg : pGso->cbHdrsTotal; 156 } 157 158 /** 159 * Returns the length of payload for a particular segment/fragment. 160 * 161 * The first segment does not contain UDP header. The size of UDP header is 162 * determined as the difference between the total headers size and the size 163 * used during segmentation. 164 * 165 * @returns Length of payload (including UDP header for the first fragment). 166 * @param pGso The GSO context. 167 * @param iSeg The segment that we're carving out (0-based). 168 * @param cSegs The number of segments in the GSO frame. 169 * @param cbFrame The size of the GSO frame. 170 */ 171 DECLINLINE(uint32_t) pdmNetSegPayloadLen(PCPDMNETWORKGSO pGso, uint32_t iSeg, uint32_t cSegs, uint32_t cbFrame) 172 { 173 if (iSeg + 1 == cSegs) 174 return cbFrame - iSeg * pGso->cbMaxSeg - pdmNetSegHdrLen(pGso, iSeg); 175 else 176 return pGso->cbMaxSeg - (iSeg ? 0 : pGso->cbHdrsTotal - pGso->cbHdrsSeg); 177 } 139 178 140 179 /** … … 149 188 size_t cbPayload; 150 189 Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame)); 151 cbPayload = cbFrame - pGso->cbHdrs ;190 cbPayload = cbFrame - pGso->cbHdrsSeg; 152 191 return (uint32_t)((cbPayload + pGso->cbMaxSeg - 1) / pGso->cbMaxSeg); 153 192 } … … 186 225 { 187 226 PRTNETUDP pUdpHdr = (PRTNETUDP)&pbSegHdrs[offUdpHdr]; 188 pUdpHdr->uh_ulen = cbPayload + cbHdrs - offUdpHdr;227 pUdpHdr->uh_ulen = RT_H2N_U16(cbPayload + cbHdrs - offUdpHdr); 189 228 switch (enmCsumType) 190 229 { … … 202 241 break; 203 242 } 243 } 244 245 246 /** 247 * Update an UDP header after carving out an IP fragment 248 * 249 * @param u32PseudoSum The pseudo checksum. 250 * @param pbSegHdrs Pointer to the header bytes copy 251 * @param pbFrame Pointer to the frame start. 252 * @param offUdpHdr The offset into @a pbSegHdrs of the UDP header. 253 * 254 * @internal 255 */ 256 DECLINLINE(void) pdmNetGsoUpdateUdpHdrUfo(uint32_t u32PseudoSum, uint8_t *pbSegHdrs, const uint8_t *pbFrame, uint8_t offUdpHdr) 257 { 258 PCRTNETUDP pcUdpHdrOrig = (PCRTNETUDP)&pbFrame[offUdpHdr]; 259 PRTNETUDP pUdpHdr = (PRTNETUDP)&pbSegHdrs[offUdpHdr]; 260 pUdpHdr->uh_sum = RTNetUDPChecksum(u32PseudoSum, pcUdpHdrOrig); 204 261 } 205 262 … … 291 348 pIpHdr->ip_sum = RTNetIPv4HdrChecksum(pIpHdr); 292 349 return RTNetIPv4PseudoChecksum(pIpHdr); 350 } 351 352 353 /** 354 * Updates a IPv4 header after carving out an IP fragment. 355 * 356 * @param pbSegHdrs Pointer to the header bytes. 357 * @param offIpHdr The offset into @a pbSegHdrs of the IP header. 358 * @param cbSegPayload The amount of segmented payload. 359 * @param offFragment The offset of this fragment for reassembly. 360 * @param iSeg The segment index. 361 * @param cbHdrs The size of all the headers. 362 * @param fLastFragment True if this is the last fragment of datagram. 363 * @internal 364 */ 365 DECLINLINE(void) pdmNetGsoUpdateIPv4HdrUfo(uint8_t *pbSegHdrs, uint8_t offIpHdr, uint32_t cbSegPayload, 366 uint32_t offFragment, uint8_t cbHdrs, bool fLastFragment) 367 { 368 PRTNETIPV4 pIpHdr = (PRTNETIPV4)&pbSegHdrs[offIpHdr]; 369 pIpHdr->ip_len = RT_H2N_U16(cbHdrs - offIpHdr + cbSegPayload); 370 pIpHdr->ip_off = RT_H2N_U16((offFragment / 8) | (fLastFragment ? 0 : RTNETIPV4_FLAGS_MF)); 371 pIpHdr->ip_sum = RTNetIPv4HdrChecksum(pIpHdr); 293 372 } 294 373 … … 325 404 */ 326 405 uint8_t * const pbSegHdrs = pbFrame + pGso->cbMaxSeg * iSeg; 327 uint8_t * const pbSegPayload = pbSegHdrs + pGso->cbHdrs; 328 uint32_t const cbSegPayload = iSeg + 1 != cSegs 329 ? pGso->cbMaxSeg 330 : (uint32_t)(cbFrame - iSeg * pGso->cbMaxSeg - pGso->cbHdrs); 331 uint32_t const cbSegFrame = cbSegPayload + pGso->cbHdrs; 406 uint8_t * const pbSegPayload = pbSegHdrs + pGso->cbHdrsSeg; 407 uint32_t const cbSegPayload = pdmNetSegPayloadLen(pGso, iSeg, cSegs, cbFrame); 408 uint32_t const cbSegFrame = cbSegPayload + pGso->cbHdrsSeg; 332 409 333 410 /* … … 342 419 */ 343 420 if (iSeg != 0) 344 memcpy(pbSegHdrs, pbHdrScatch, pGso->cbHdrs );421 memcpy(pbSegHdrs, pbHdrScatch, pGso->cbHdrsSeg); 345 422 else 346 memcpy(pbHdrScatch, pbSegHdrs, pGso->cbHdrs );423 memcpy(pbHdrScatch, pbSegHdrs, pGso->cbHdrsSeg); /* There is no need to save UDP header */ 347 424 348 425 switch ((PDMNETWORKGSOTYPE)pGso->u8Type) 349 426 { 350 427 case PDMNETWORKGSOTYPE_IPV4_TCP: 351 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrs ),428 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrsSeg), 352 429 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, iSeg * pGso->cbMaxSeg, 353 pGso->cbHdrs , iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE);430 pGso->cbHdrsSeg, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE); 354 431 break; 355 432 case PDMNETWORKGSOTYPE_IPV4_UDP: 356 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrs), 357 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, pGso->cbHdrs, PDMNETCSUMTYPE_COMPLETE); 433 if (iSeg == 0) 434 pdmNetGsoUpdateUdpHdrUfo(RTNetIPv4PseudoChecksum((PRTNETIPV4)&pbFrame[pGso->offHdr1]), 435 pbSegHdrs, pbFrame, pGso->offHdr2); 436 pdmNetGsoUpdateIPv4HdrUfo(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg * pGso->cbMaxSeg, 437 pdmNetSegHdrLen(pGso, iSeg), iSeg + 1 == cSegs); 358 438 break; 359 439 case PDMNETWORKGSOTYPE_IPV6_TCP: 360 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, pGso->cbHdrs ,440 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, pGso->cbHdrsSeg, 361 441 pGso->offHdr2, RTNETIPV4_PROT_TCP), 362 442 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, iSeg * pGso->cbMaxSeg, 363 pGso->cbHdrs , iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE);443 pGso->cbHdrsSeg, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE); 364 444 break; 365 445 case PDMNETWORKGSOTYPE_IPV6_UDP: 366 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, pGso->cbHdrs ,446 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, pGso->cbHdrsSeg, 367 447 pGso->offHdr2, RTNETIPV4_PROT_UDP), 368 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, pGso->cbHdrs , PDMNETCSUMTYPE_COMPLETE);448 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, pGso->cbHdrsSeg, PDMNETCSUMTYPE_COMPLETE); 369 449 break; 370 450 case PDMNETWORKGSOTYPE_IPV4_IPV6_TCP: 371 pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrs );451 pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrsSeg); 372 452 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pgmNetGsoCalcIpv6Offset(pbSegHdrs, pGso->offHdr1), 373 cbSegPayload, pGso->cbHdrs , pGso->offHdr2, RTNETIPV4_PROT_TCP),453 cbSegPayload, pGso->cbHdrsSeg, pGso->offHdr2, RTNETIPV4_PROT_TCP), 374 454 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, iSeg * pGso->cbMaxSeg, 375 pGso->cbHdrs , iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE);455 pGso->cbHdrsSeg, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE); 376 456 break; 377 457 case PDMNETWORKGSOTYPE_IPV4_IPV6_UDP: 378 pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrs );458 pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrsSeg); 379 459 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pgmNetGsoCalcIpv6Offset(pbSegHdrs, pGso->offHdr1), 380 cbSegPayload, pGso->cbHdrs , pGso->offHdr2, RTNETIPV4_PROT_UDP),381 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, pGso->cbHdrs , PDMNETCSUMTYPE_COMPLETE);460 cbSegPayload, pGso->cbHdrsSeg, pGso->offHdr2, RTNETIPV4_PROT_UDP), 461 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, pGso->cbHdrsSeg, PDMNETCSUMTYPE_COMPLETE); 382 462 break; 383 463 case PDMNETWORKGSOTYPE_INVALID: … … 412 492 * least pGso->cbHdrs in size, using a 256 byte 413 493 * buffer is a recommended simplification. 494 * @param pcbSegHdrs Where to return the size of the returned 495 * segment headers. 414 496 * @param pcbSegPayload Where to return the size of the returned 415 497 * segment payload. 416 498 */ 417 499 DECLINLINE(uint32_t) PDMNetGsoCarveSegment(PCPDMNETWORKGSO pGso, const uint8_t *pbFrame, size_t cbFrame, 418 uint32_t iSeg, uint32_t cSegs, uint8_t *pbSegHdrs, uint32_t *pcbSegPayload) 500 uint32_t iSeg, uint32_t cSegs, uint8_t *pbSegHdrs, 501 uint32_t *pcbSegHdrs, uint32_t *pcbSegPayload) 419 502 { 420 503 /* … … 422 505 * do the protocol specific carving. 423 506 */ 424 uint8_t const * const pbSegPayload = pbFrame + pGso->cbHdrs + iSeg * pGso->cbMaxSeg; 425 uint32_t const cbSegPayload = iSeg + 1 != cSegs 426 ? pGso->cbMaxSeg 427 : (uint32_t)(cbFrame - iSeg * pGso->cbMaxSeg - pGso->cbHdrs); 507 uint32_t const cbSegHdrs = pdmNetSegHdrLen(pGso, iSeg); 508 uint8_t const * const pbSegPayload = pbFrame + cbSegHdrs + iSeg * pGso->cbMaxSeg; 509 uint32_t const cbSegPayload = pdmNetSegPayloadLen(pGso, iSeg, cSegs, cbFrame); 428 510 429 511 /* … … 437 519 * Copy the header and do the protocol specific massaging of it. 438 520 */ 439 memcpy(pbSegHdrs, pbFrame, pGso->cbHdrs );521 memcpy(pbSegHdrs, pbFrame, pGso->cbHdrsTotal); /* include UDP header */ 440 522 441 523 switch ((PDMNETWORKGSOTYPE)pGso->u8Type) 442 524 { 443 525 case PDMNETWORKGSOTYPE_IPV4_TCP: 444 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrs),526 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, cbSegHdrs), 445 527 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, iSeg * pGso->cbMaxSeg, 446 pGso->cbHdrs, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE);528 cbSegHdrs, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE); 447 529 break; 448 530 case PDMNETWORKGSOTYPE_IPV4_UDP: 449 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrs), 450 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, pGso->cbHdrs, PDMNETCSUMTYPE_COMPLETE); 531 if (iSeg == 0) 532 pdmNetGsoUpdateUdpHdrUfo(RTNetIPv4PseudoChecksum((PRTNETIPV4)&pbFrame[pGso->offHdr1]), 533 pbSegHdrs, pbFrame, pGso->offHdr2); 534 pdmNetGsoUpdateIPv4HdrUfo(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg * pGso->cbMaxSeg, 535 cbSegHdrs, iSeg + 1 == cSegs); 451 536 break; 452 537 case PDMNETWORKGSOTYPE_IPV6_TCP: 453 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, pGso->cbHdrs,538 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, cbSegHdrs, 454 539 pGso->offHdr2, RTNETIPV4_PROT_TCP), 455 540 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, iSeg * pGso->cbMaxSeg, 456 pGso->cbHdrs, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE);541 cbSegHdrs, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE); 457 542 break; 458 543 case PDMNETWORKGSOTYPE_IPV6_UDP: 459 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, pGso->cbHdrs,544 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, cbSegHdrs, 460 545 pGso->offHdr2, RTNETIPV4_PROT_UDP), 461 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, pGso->cbHdrs, PDMNETCSUMTYPE_COMPLETE);546 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, cbSegHdrs, PDMNETCSUMTYPE_COMPLETE); 462 547 break; 463 548 case PDMNETWORKGSOTYPE_IPV4_IPV6_TCP: 464 pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrs);549 pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, cbSegHdrs); 465 550 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pgmNetGsoCalcIpv6Offset(pbSegHdrs, pGso->offHdr1), 466 cbSegPayload, pGso->cbHdrs, pGso->offHdr2, RTNETIPV4_PROT_TCP),551 cbSegPayload, cbSegHdrs, pGso->offHdr2, RTNETIPV4_PROT_TCP), 467 552 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, iSeg * pGso->cbMaxSeg, 468 pGso->cbHdrs, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE);553 cbSegHdrs, iSeg + 1 == cSegs, PDMNETCSUMTYPE_COMPLETE); 469 554 break; 470 555 case PDMNETWORKGSOTYPE_IPV4_IPV6_UDP: 471 pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, pGso->cbHdrs);556 pdmNetGsoUpdateIPv4Hdr(pbSegHdrs, pGso->offHdr1, cbSegPayload, iSeg, cbSegHdrs); 472 557 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbSegHdrs, pgmNetGsoCalcIpv6Offset(pbSegHdrs, pGso->offHdr1), 473 cbSegPayload, pGso->cbHdrs, pGso->offHdr2, RTNETIPV4_PROT_UDP),474 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, pGso->cbHdrs, PDMNETCSUMTYPE_COMPLETE);558 cbSegPayload, cbSegHdrs, pGso->offHdr2, RTNETIPV4_PROT_UDP), 559 pbSegHdrs, pGso->offHdr2, pbSegPayload, cbSegPayload, cbSegHdrs, PDMNETCSUMTYPE_COMPLETE); 475 560 break; 476 561 case PDMNETWORKGSOTYPE_INVALID: … … 480 565 } 481 566 567 *pcbSegHdrs = cbSegHdrs; 482 568 *pcbSegPayload = cbSegPayload; 483 return pGso->cbHdrs + iSeg * pGso->cbMaxSeg;569 return cbSegHdrs + iSeg * pGso->cbMaxSeg; 484 570 } 485 571 … … 501 587 */ 502 588 uint8_t * const pbHdrs = (uint8_t *)pvFrame; 503 uint8_t * const pbPayload = pbHdrs + pGso->cbHdrs ;589 uint8_t * const pbPayload = pbHdrs + pGso->cbHdrsTotal; 504 590 uint32_t const cbFrame32 = (uint32_t)cbFrame; 505 uint32_t const cbPayload = cbFrame32 - pGso->cbHdrs ;591 uint32_t const cbPayload = cbFrame32 - pGso->cbHdrsTotal; 506 592 507 593 /* … … 516 602 { 517 603 case PDMNETWORKGSOTYPE_IPV4_TCP: 518 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv4Hdr(pbHdrs, pGso->offHdr1, cbFrame32 - pGso->cbHdrs , 0, pGso->cbHdrs),519 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, 0, pGso->cbHdrs , true, enmCsumType);604 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv4Hdr(pbHdrs, pGso->offHdr1, cbFrame32 - pGso->cbHdrsTotal, 0, pGso->cbHdrsTotal), 605 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, 0, pGso->cbHdrsTotal, true, enmCsumType); 520 606 break; 521 607 case PDMNETWORKGSOTYPE_IPV4_UDP: 522 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv4Hdr(pbHdrs, pGso->offHdr1, cbFrame32 - pGso->cbHdrs , 0, pGso->cbHdrs),523 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, pGso->cbHdrs , enmCsumType);608 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv4Hdr(pbHdrs, pGso->offHdr1, cbFrame32 - pGso->cbHdrsTotal, 0, pGso->cbHdrsTotal), 609 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, pGso->cbHdrsTotal, enmCsumType); 524 610 break; 525 611 case PDMNETWORKGSOTYPE_IPV6_TCP: 526 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbHdrs, pGso->offHdr1, cbPayload, pGso->cbHdrs ,612 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbHdrs, pGso->offHdr1, cbPayload, pGso->cbHdrsTotal, 527 613 pGso->offHdr2, RTNETIPV4_PROT_TCP), 528 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, 0, pGso->cbHdrs , true, enmCsumType);614 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, 0, pGso->cbHdrsTotal, true, enmCsumType); 529 615 break; 530 616 case PDMNETWORKGSOTYPE_IPV6_UDP: 531 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbHdrs, pGso->offHdr1, cbPayload, pGso->cbHdrs ,617 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbHdrs, pGso->offHdr1, cbPayload, pGso->cbHdrsTotal, 532 618 pGso->offHdr2, RTNETIPV4_PROT_UDP), 533 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, pGso->cbHdrs , enmCsumType);619 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, pGso->cbHdrsTotal, enmCsumType); 534 620 break; 535 621 case PDMNETWORKGSOTYPE_IPV4_IPV6_TCP: 536 pdmNetGsoUpdateIPv4Hdr(pbHdrs, pGso->offHdr1, cbPayload, 0, pGso->cbHdrs );622 pdmNetGsoUpdateIPv4Hdr(pbHdrs, pGso->offHdr1, cbPayload, 0, pGso->cbHdrsTotal); 537 623 pdmNetGsoUpdateTcpHdr(pdmNetGsoUpdateIPv6Hdr(pbHdrs, pgmNetGsoCalcIpv6Offset(pbHdrs, pGso->offHdr1), 538 cbPayload, pGso->cbHdrs , pGso->offHdr2, RTNETIPV4_PROT_TCP),539 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, 0, pGso->cbHdrs , true, enmCsumType);624 cbPayload, pGso->cbHdrsTotal, pGso->offHdr2, RTNETIPV4_PROT_TCP), 625 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, 0, pGso->cbHdrsTotal, true, enmCsumType); 540 626 break; 541 627 case PDMNETWORKGSOTYPE_IPV4_IPV6_UDP: 542 pdmNetGsoUpdateIPv4Hdr(pbHdrs, pGso->offHdr1, cbPayload, 0, pGso->cbHdrs );628 pdmNetGsoUpdateIPv4Hdr(pbHdrs, pGso->offHdr1, cbPayload, 0, pGso->cbHdrsTotal); 543 629 pdmNetGsoUpdateUdpHdr(pdmNetGsoUpdateIPv6Hdr(pbHdrs, pgmNetGsoCalcIpv6Offset(pbHdrs, pGso->offHdr1), 544 cbPayload, pGso->cbHdrs , pGso->offHdr2, RTNETIPV4_PROT_UDP),545 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, pGso->cbHdrs , enmCsumType);630 cbPayload, pGso->cbHdrsTotal, pGso->offHdr2, RTNETIPV4_PROT_UDP), 631 pbHdrs, pGso->offHdr2, pbPayload, cbPayload, pGso->cbHdrsTotal, enmCsumType); 546 632 break; 547 633 case PDMNETWORKGSOTYPE_INVALID: -
trunk/include/iprt/net.h
r28800 r38549 256 256 /** Boostrap Protocol / DHCP) Client. */ 257 257 #define RTNETIPV4_PORT_BOOTPC (68) 258 /** @} */ 259 260 /** @name IPv4 Flags 261 * @{ */ 262 /** IPv4: Don't fragment */ 263 #define RTNETIPV4_FLAGS_DF (0x4000) 264 /** IPv4: More fragments */ 265 #define RTNETIPV4_FLAGS_MF (0x2000) 258 266 /** @} */ 259 267
Note:
See TracChangeset
for help on using the changeset viewer.