- Timestamp:
- Apr 12, 2019 7:43:08 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r76553 r78115 3800 3800 pSg->fFlags = PDMSCATTERGATHER_FLAGS_MAGIC | PDMSCATTERGATHER_FLAGS_OWNER_3; 3801 3801 pSg->cbUsed = 0; 3802 pSg->cbAvailable = 0;3802 pSg->cbAvailable = sizeof(pThis->aTxPacketFallback); 3803 3803 pSg->pvAllocator = pThis; 3804 3804 pSg->pvUser = NULL; /* No GSO here. */ … … 4239 4239 Assert(pThis->u32PayRemain + pThis->u16HdrRemain > 0); 4240 4240 4241 PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), PhysAddr, 4242 pThis->aTxPacketFallback + pThis->u16TxPktLen, u16Len); 4241 if (pThis->u16TxPktLen + u16Len <= sizeof(pThis->aTxPacketFallback)) 4242 PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), PhysAddr, 4243 pThis->aTxPacketFallback + pThis->u16TxPktLen, u16Len); 4244 else 4245 E1kLog(("%s e1kFallbackAddSegment: writing beyond aTxPacketFallback, u16TxPktLen=%d(0x%x) + u16Len=%d(0x%x) > %d\n", 4246 pThis->szPrf, pThis->u16TxPktLen, pThis->u16TxPktLen, u16Len, u16Len, sizeof(pThis->aTxPacketFallback))); 4243 4247 E1kLog3(("%s Dump of the segment:\n" 4244 4248 "%.*Rhxd\n" … … 4312 4316 if (pThis->CTX_SUFF(pTxSg)) 4313 4317 { 4314 Assert(pThis->u16TxPktLen <= pThis->CTX_SUFF(pTxSg)->cbAvailable); 4318 /* Make sure the packet fits into the allocated buffer */ 4319 size_t cbCopy = RT_MIN(pThis->u16TxPktLen, pThis->CTX_SUFF(pTxSg)->cbAvailable); 4320 #ifdef DEBUG 4321 if (pThis->u16TxPktLen > pThis->CTX_SUFF(pTxSg)->cbAvailable) 4322 E1kLog(("%s e1kFallbackAddSegment: truncating packet, u16TxPktLen=%d(0x%x) > cbAvailable=%d(0x%x)\n", 4323 pThis->szPrf, pThis->u16TxPktLen, pThis->u16TxPktLen, 4324 pThis->CTX_SUFF(pTxSg)->cbAvailable, pThis->CTX_SUFF(pTxSg)->cbAvailable)); 4325 #endif /* DEBUG */ 4315 4326 Assert(pThis->CTX_SUFF(pTxSg)->cSegs == 1); 4316 4327 if (pThis->CTX_SUFF(pTxSg)->aSegs[0].pvSeg != pThis->aTxPacketFallback) 4317 memcpy(pThis->CTX_SUFF(pTxSg)->aSegs[0].pvSeg, pThis->aTxPacketFallback, pThis->u16TxPktLen);4318 pThis->CTX_SUFF(pTxSg)->cbUsed = pThis->u16TxPktLen;4319 pThis->CTX_SUFF(pTxSg)->aSegs[0].cbSeg = pThis->u16TxPktLen;4328 memcpy(pThis->CTX_SUFF(pTxSg)->aSegs[0].pvSeg, pThis->aTxPacketFallback, cbCopy); 4329 pThis->CTX_SUFF(pTxSg)->cbUsed = cbCopy; 4330 pThis->CTX_SUFF(pTxSg)->aSegs[0].cbSeg = cbCopy; 4320 4331 } 4321 4332 e1kTransmitFrame(pThis, fOnWorkerThread); … … 4495 4506 uint32_t const cbNewPkt = cbFragment + pThis->u16TxPktLen; 4496 4507 4508 LogFlow(("%s e1kAddToFrame: ENTER cbFragment=%d u16TxPktLen=%d cbUsed=%d cbAvailable=%d fGSO=%s\n", 4509 pThis->szPrf, cbFragment, pThis->u16TxPktLen, pTxSg->cbUsed, pTxSg->cbAvailable, 4510 fGso ? "true" : "false")); 4497 4511 if (RT_UNLIKELY( !fGso && cbNewPkt > E1K_MAX_TX_PKT_SIZE )) 4498 4512 { … … 4500 4514 return false; 4501 4515 } 4502 if (RT_UNLIKELY( fGso &&cbNewPkt > pTxSg->cbAvailable ))4503 { 4504 E1kLog(("%s Transmit packet is too large: %u > %u(max) /GSO\n", pThis->szPrf, cbNewPkt, pTxSg->cbAvailable));4516 if (RT_UNLIKELY( cbNewPkt > pTxSg->cbAvailable )) 4517 { 4518 E1kLog(("%s Transmit packet is too large: %u > %u(max)\n", pThis->szPrf, cbNewPkt, pTxSg->cbAvailable)); 4505 4519 return false; 4506 4520 } … … 4509 4523 { 4510 4524 Assert(pTxSg->cSegs == 1); 4511 Assert(pTxSg->cbUsed == pThis->u16TxPktLen); 4525 if (pTxSg->cbUsed != pThis->u16TxPktLen) 4526 E1kLog(("%s e1kAddToFrame: pTxSg->cbUsed=%d(0x%x) != u16TxPktLen=%d(0x%x)\n", 4527 pThis->szPrf, pTxSg->cbUsed, pTxSg->cbUsed, pThis->u16TxPktLen, pThis->u16TxPktLen)); 4512 4528 4513 4529 PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), PhysAddr, … … 4886 4902 4887 4903 e1kPrintTDesc(pThis, pDesc, "vvv"); 4904 4905 if (pDesc->legacy.dw3.fDD) 4906 { 4907 E1kLog(("%s e1kXmitDesc: skipping bad descriptor ^^^\n", pThis->szPrf)); 4908 e1kDescReport(pThis, pDesc, addr); 4909 return VINF_SUCCESS; 4910 } 4888 4911 4889 4912 //#ifdef E1K_USE_TX_TIMERS … … 5088 5111 { 5089 5112 case E1K_DTYP_CONTEXT: 5090 e1kUpdateTxContext(pThis, pDesc); 5113 if (cbPacket == 0) 5114 e1kUpdateTxContext(pThis, pDesc); 5115 else 5116 E1kLog(("%s e1kLocateTxPacket: ignoring a context descriptor in the middle of a packet, cbPacket=%d\n", 5117 pThis->szPrf, cbPacket)); 5091 5118 continue; 5092 5119 case E1K_DTYP_LEGACY: 5120 /* Skip invalid descriptors. */ 5121 if (cbPacket > 0 && (pThis->fGSO || fTSE)) 5122 { 5123 E1kLog(("%s e1kLocateTxPacket: ignoring a legacy descriptor in the segmentation context, cbPacket=%d\n", 5124 pThis->szPrf, cbPacket)); 5125 pDesc->legacy.dw3.fDD = true; /* Make sure it is skipped by processing */ 5126 continue; 5127 } 5093 5128 /* Skip empty descriptors. */ 5094 5129 if (!pDesc->legacy.u64BufAddr || !pDesc->legacy.cmd.u16Length) … … 5098 5133 break; 5099 5134 case E1K_DTYP_DATA: 5135 /* Skip invalid descriptors. */ 5136 if (cbPacket > 0 && (bool)pDesc->data.cmd.fTSE != fTSE) 5137 { 5138 E1kLog(("%s e1kLocateTxPacket: ignoring %sTSE descriptor in the %ssegmentation context, cbPacket=%d\n", 5139 pThis->szPrf, pDesc->data.cmd.fTSE ? "" : "non-", fTSE ? "" : "non-", cbPacket)); 5140 pDesc->data.dw3.fDD = true; /* Make sure it is skipped by processing */ 5141 continue; 5142 } 5100 5143 /* Skip empty descriptors. */ 5101 5144 if (!pDesc->data.u64BufAddr || !pDesc->data.cmd.u20DTALEN) … … 5146 5189 if (pThis->fVTag) 5147 5190 pThis->cbTxAlloc += 4; 5148 LogFlow(("%s e1kLocateTxPacket: RET true cbTxAlloc=%d\n", 5149 pThis->szPrf, pThis->cbTxAlloc)); 5191 LogFlow(("%s e1kLocateTxPacket: RET true cbTxAlloc=%d cbPacket=%d%s%s\n", 5192 pThis->szPrf, pThis->cbTxAlloc, cbPacket, 5193 pThis->fGSO ? " GSO" : "", fTSE ? " TSE" : "")); 5150 5194 return true; 5151 5195 } … … 5159 5203 return true; 5160 5204 } 5161 LogFlow(("%s e1kLocateTxPacket: RET false cbTxAlloc=%d \n",5162 pThis->szPrf, pThis->cbTxAlloc ));5205 LogFlow(("%s e1kLocateTxPacket: RET false cbTxAlloc=%d cbPacket=%d\n", 5206 pThis->szPrf, pThis->cbTxAlloc, cbPacket)); 5163 5207 return false; 5164 5208 } … … 6936 6980 //SSMR3GetBool(pSSM, pThis->fIntMaskUsed); 6937 6981 SSMR3GetU16(pSSM, &pThis->u16TxPktLen); 6982 if (pThis->u16TxPktLen > sizeof(pThis->aTxPacketFallback)) 6983 pThis->u16TxPktLen = sizeof(pThis->aTxPacketFallback); 6938 6984 SSMR3GetMem(pSSM, &pThis->aTxPacketFallback[0], pThis->u16TxPktLen); 6939 6985 SSMR3GetBool(pSSM, &pThis->fIPcsum);
Note:
See TracChangeset
for help on using the changeset viewer.