- Timestamp:
- Jun 21, 2012 5:21:12 PM (13 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 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); -
trunk/src/VBox/VMM/VMMR3/PDMNetShaper.cpp
r41783 r41864 233 233 static void pdmNsBwGroupXmitPending(PPDMNSBWGROUP pBwGroup) 234 234 { 235 int rc = RTCritSectEnter(&pBwGroup->cs); AssertRC(rc); 235 /* 236 * We don't need to hold the bandwidth group lock to iterate over the list 237 * of filters since the filters are removed while the shaper lock is being 238 * held. 239 */ 240 AssertPtr(pBwGroup); 241 AssertPtr(pBwGroup->pShaper); 242 Assert(RTCritSectIsOwner(&pBwGroup->pShaper->cs)); 243 //int rc = RTCritSectEnter(&pBwGroup->cs); AssertRC(rc); 236 244 237 245 PPDMNSFILTER pFilter = pBwGroup->pFiltersHead; … … 249 257 } 250 258 251 rc = RTCritSectLeave(&pBwGroup->cs); AssertRC(rc);259 //rc = RTCritSectLeave(&pBwGroup->cs); AssertRC(rc); 252 260 } 253 261 … … 266 274 { 267 275 PPDMNSBWGROUP pBwGroup = pFilter->pBwGroupR3; 276 /* 277 * We need to make sure we hold the shaper lock since pdmNsBwGroupXmitPending() 278 * does not hold the bandwidth group lock while iterating over the list 279 * of group's filters. 280 */ 281 AssertPtr(pBwGroup); 282 AssertPtr(pBwGroup->pShaper); 283 Assert(RTCritSectIsOwner(&pBwGroup->pShaper->cs)); 268 284 int rc = RTCritSectEnter(&pBwGroup->cs); AssertRC(rc); 269 285
Note:
See TracChangeset
for help on using the changeset viewer.