Changeset 85117 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Jul 8, 2020 5:43:27 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r85116 r85117 446 446 STAMPROFILE StatTransmitSendR3; 447 447 STAMPROFILE StatTransmitSendRZ; 448 STAMPROFILEADV StatTxLenCalcRZ;449 STAMPROFILEADV StatTxLenCalcR3;450 448 STAMPROFILEADV StatTdtePollRZ; 451 449 STAMPROFILEADV StatTdtePollR3; … … 1881 1879 1882 1880 /** 1883 * Poll Transmit Descriptor Table Entry1884 * @return true if transmit descriptors available1885 */1886 static int pcnetCalcPacketLen(PPDMDEVINS pDevIns, PPCNETSTATE pThis, unsigned cb)1887 {1888 TMD tmd;1889 unsigned cbPacket = cb;1890 uint32_t iDesc = CSR_XMTRC(pThis);1891 uint32_t iFirstDesc = iDesc;1892 1893 STAM_PROFILE_ADV_START(&pThis->CTX_SUFF_Z(StatTxLenCalc), a);1894 do1895 {1896 /* Advance the ring counter */1897 if (iDesc < 2)1898 iDesc = CSR_XMTRL(pThis);1899 else1900 iDesc--;1901 1902 if (iDesc == iFirstDesc)1903 break;1904 1905 RTGCPHYS32 addrDesc = pcnetTdraAddr(pThis, iDesc);1906 1907 if (!pcnetTmdTryLoad(pDevIns, pThis, &tmd, PHYSADDR(pThis, addrDesc)))1908 {1909 STAM_PROFILE_ADV_STOP(&pThis->CTX_SUFF_Z(StatTxLenCalc), a);1910 /*1911 * No need to count further since this packet won't be sent anyway1912 * due to underflow.1913 */1914 Log3(("#%d pcnetCalcPacketLen: underflow, return %u\n", PCNET_INST_NR, cbPacket));1915 return cbPacket;1916 }1917 if (RT_UNLIKELY(tmd.tmd1.ones != 15))1918 {1919 STAM_PROFILE_ADV_STOP(&pThis->CTX_SUFF_Z(StatTxLenCalc), a);1920 LogRel(("PCnet#%d: BAD TMD XDA=%#010x\n",1921 PCNET_INST_NR, PHYSADDR(pThis, addrDesc)));1922 Log3(("#%d pcnetCalcPacketLen: bad TMD, return %u\n", PCNET_INST_NR, cbPacket));1923 return cbPacket;1924 }1925 Log3(("#%d pcnetCalcPacketLen: got valid TMD, cb=%u\n", PCNET_INST_NR, 4096 - tmd.tmd1.bcnt));1926 cbPacket += 4096 - tmd.tmd1.bcnt;1927 } while (!tmd.tmd1.enp);1928 STAM_PROFILE_ADV_STOP(&pThis->CTX_SUFF_Z(StatTxLenCalc), a);1929 1930 Log3(("#%d pcnetCalcPacketLen: return %u\n", PCNET_INST_NR, cbPacket));1931 return cbPacket;1932 }1933 1934 1935 /**1936 1881 * Write data into guest receive buffers. 1937 1882 */ … … 2664 2609 */ 2665 2610 unsigned cb = 4096 - tmd.tmd1.bcnt; 2666 rc = pcnetXmitAllocBuf(pThis, pThisCC, pcnetCalcPacketLen(pDevIns, pThis, cb), fLoopback, &SgLoop, &pSgBuf);2611 rc = pcnetXmitAllocBuf(pThis, pThisCC, RT_MAX(MAX_FRAME, cb), fLoopback, &SgLoop, &pSgBuf); 2667 2612 if (rc == VERR_TRY_AGAIN) 2668 2613 { … … 5459 5404 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitSendRZ, STAMTYPE_PROFILE, "Transmit/SendRZ", STAMUNIT_TICKS_PER_CALL, "Profiling PCnet send transmit in RZ"); 5460 5405 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitSendR3, STAMTYPE_PROFILE, "Transmit/SendR3", STAMUNIT_TICKS_PER_CALL, "Profiling PCnet send transmit in R3"); 5461 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTxLenCalcRZ, STAMTYPE_PROFILE, "Transmit/LenCalcRZ", STAMUNIT_TICKS_PER_CALL, "Profiling PCnet TX len calc in RZ");5462 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTxLenCalcR3, STAMTYPE_PROFILE, "Transmit/LenCalcR3", STAMUNIT_TICKS_PER_CALL, "Profiling PCnet TX len calc in R3");5463 5406 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTdtePollRZ, STAMTYPE_PROFILE, "TdtePollRZ", STAMUNIT_TICKS_PER_CALL, "Profiling PCnet TdtePoll in RZ"); 5464 5407 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTdtePollR3, STAMTYPE_PROFILE, "TdtePollR3", STAMUNIT_TICKS_PER_CALL, "Profiling PCnet TdtePoll in R3");
Note:
See TracChangeset
for help on using the changeset viewer.