Changeset 41864 in vbox for trunk/src/VBox/Devices/Network/DevPCNet.cpp
- Timestamp:
- Jun 21, 2012 5:21:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r41774 r41864 296 296 STAMPROFILE StatTransmitSendR3; 297 297 STAMPROFILE StatTransmitSendRZ; 298 STAMPROFILEADV StatTxLenCalcRZ; 299 STAMPROFILEADV StatTxLenCalcR3; 298 300 STAMPROFILEADV StatTdtePollRZ; 299 301 STAMPROFILEADV StatTdtePollR3; … … 1821 1823 1822 1824 /** 1825 * Poll Transmit Descriptor Table Entry 1826 * @return true if transmit descriptors available 1827 */ 1828 static int pcnetCalcPacketLen(PCNetState *pThis, unsigned cb) 1829 { 1830 TMD tmd; 1831 unsigned cbPacket = cb; 1832 uint32_t iDesc = CSR_XMTRC(pThis); 1833 1834 STAM_PROFILE_ADV_START(&pThis->CTX_SUFF_Z(StatTxLenCalc), a); 1835 do 1836 { 1837 /* Advance the ring counter */ 1838 if (iDesc < 2) 1839 iDesc = CSR_XMTRL(pThis); 1840 else 1841 iDesc--; 1842 1843 RTGCPHYS32 addrDesc = pcnetTdraAddr(pThis, iDesc); 1844 1845 if (!pcnetTmdLoad(pThis, &tmd, PHYSADDR(pThis, addrDesc), true)) 1846 { 1847 STAM_PROFILE_ADV_STOP(&pThis->CTX_SUFF_Z(StatTxLenCalc), a); 1848 /* 1849 * No need to count further since this packet won't be sent anyway 1850 * due to underflow. 1851 */ 1852 Log3(("#%d pcnetCalcPacketLen: underflow, return %u\n", PCNET_INST_NR, cbPacket)); 1853 return cbPacket; 1854 } 1855 if (RT_UNLIKELY(tmd.tmd1.ones != 15)) 1856 { 1857 STAM_PROFILE_ADV_STOP(&pThis->CTX_SUFF_Z(StatTxLenCalc), a); 1858 LogRel(("PCNet#%d: BAD TMD XDA=%#010x\n", 1859 PCNET_INST_NR, PHYSADDR(pThis, addrDesc))); 1860 Log3(("#%d pcnetCalcPacketLen: bad TMD, return %u\n", PCNET_INST_NR, cbPacket)); 1861 return cbPacket; 1862 } 1863 Log3(("#%d pcnetCalcPacketLen: got valid TMD, cb=%u\n", PCNET_INST_NR, 4096 - tmd.tmd1.bcnt)); 1864 cbPacket += 4096 - tmd.tmd1.bcnt; 1865 } while (!tmd.tmd1.enp); 1866 STAM_PROFILE_ADV_STOP(&pThis->CTX_SUFF_Z(StatTxLenCalc), a); 1867 1868 Log3(("#%d pcnetCalcPacketLen: return %u\n", PCNET_INST_NR, cbPacket)); 1869 return cbPacket; 1870 } 1871 1872 1873 /** 1823 1874 * Write data into guest receive buffers. 1824 1875 */ … … 2503 2554 */ 2504 2555 unsigned cb = 4096 - tmd.tmd1.bcnt; 2505 rc = pcnetXmitAllocBuf(pThis, RT_MAX(MAX_FRAME, cb), fLoopback, &SgLoop, &pSgBuf);2556 rc = pcnetXmitAllocBuf(pThis, pcnetCalcPacketLen(pThis, cb), fLoopback, &SgLoop, &pSgBuf); 2506 2557 if (rc == VERR_TRY_AGAIN) 2507 2558 { … … 5331 5382 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitSendRZ, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling PCNet send transmit in RZ","/Devices/PCNet%d/Transmit/SendRZ", iInstance); 5332 5383 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitSendR3, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling PCNet send transmit in R3","/Devices/PCNet%d/Transmit/SendR3", iInstance); 5384 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTxLenCalcRZ, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling PCNet TX len calc in RZ", "/Devices/PCNet%d/Transmit/LenCalcRZ", iInstance); 5385 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTxLenCalcR3, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling PCNet TX len calc in R3", "/Devices/PCNet%d/Transmit/LenCalcR3", iInstance); 5333 5386 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTdtePollRZ, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling PCNet TdtePoll in RZ", "/Devices/PCNet%d/TdtePollRZ", iInstance); 5334 5387 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTdtePollR3, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling PCNet TdtePoll in R3", "/Devices/PCNet%d/TdtePollR3", iInstance);
Note:
See TracChangeset
for help on using the changeset viewer.