- Timestamp:
- Jun 14, 2016 9:44:53 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108049
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r60775 r61691 62 62 */ 63 63 #define E1K_LSC_ON_SLU 64 /** @def E1K_ITR_ENABLED65 * E1K_ITR_ENABLED reduces the number of interrupts generated by E1000 if a66 * guest driver requested it by writing non-zero value to the Interrupt67 * Throttling Register (see section 13.4.18 in "8254x Family of Gigabit68 * Ethernet Controllers Software Developer’s Manual").69 */70 //#define E1K_ITR_ENABLED71 64 /** @def E1K_TX_DELAY 72 65 * E1K_TX_DELAY aims to improve guest-host transfer rate for TCP streams by … … 181 174 182 175 #if 0 176 # define LOG_ENABLED 183 177 # define E1kLogRel(a) LogRel(a) 178 # undef Log6 179 # define Log6(a) LogRel(a) 184 180 #else 185 181 # define E1kLogRel(a) do { } while (0) … … 1085 1081 /** EMT: Compute Ethernet CRC for RX packets. */ 1086 1082 bool fEthernetCRC; 1087 1088 bool Alignment2[3]; 1083 /** All: throttle interrupts. */ 1084 bool fItrEnabled; 1085 /** All: throttle RX interrupts. */ 1086 bool fItrRxEnabled; 1087 1088 bool Alignment2; 1089 1089 /** Link up delay (in milliseconds). */ 1090 1090 uint32_t cMsLinkUpDelay; … … 1865 1865 1866 1866 /** 1867 * Raise an interrupt later. 1868 * 1869 * @param pThis The device state structure. 1870 */ 1871 inline void e1kPostponeInterrupt(PE1KSTATE pThis, uint64_t uNanoseconds) 1872 { 1873 if (!TMTimerIsActive(pThis->CTX_SUFF(pIntTimer))) 1874 TMTimerSetNano(pThis->CTX_SUFF(pIntTimer), uNanoseconds); 1875 } 1876 1877 /** 1867 1878 * Raise interrupt if not masked. 1868 1879 * … … 1879 1890 if (ICR & IMS) 1880 1891 { 1881 #if 01882 if (pThis->fDelayInts)1883 {1884 E1K_INC_ISTAT_CNT(pThis->uStatIntDly);1885 pThis->iStatIntLostOne = 1;1886 E1kLog2(("%s e1kRaiseInterrupt: Delayed. ICR=%08x\n",1887 pThis->szPrf, ICR));1888 #define E1K_LOST_IRQ_THRSLD 201889 //#define E1K_LOST_IRQ_THRSLD 2000000001890 if (pThis->iStatIntLost >= E1K_LOST_IRQ_THRSLD)1891 {1892 E1kLog2(("%s WARNING! Disabling delayed interrupt logic: delayed=%d, delivered=%d\n",1893 pThis->szPrf, pThis->uStatIntDly, pThis->uStatIntLate));1894 pThis->fIntMaskUsed = false;1895 pThis->uStatDisDly++;1896 }1897 }1898 else1899 #endif1900 1892 if (pThis->fIntRaised) 1901 1893 { … … 1906 1898 else 1907 1899 { 1908 #ifdef E1K_ITR_ENABLED 1909 uint64_t tstamp = TMTimerGet(pThis->CTX_SUFF(pIntTimer)); 1910 /* interrupts/sec = 1 / (256 * 10E-9 * ITR) */ 1911 E1kLog2(("%s e1kRaiseInterrupt: tstamp - pThis->u64AckedAt = %d, ITR * 256 = %d\n", 1912 pThis->szPrf, (uint32_t)(tstamp - pThis->u64AckedAt), ITR * 256)); 1913 //if (!!ITR && pThis->fIntMaskUsed && tstamp - pThis->u64AckedAt < ITR * 256) 1914 if (!!ITR && tstamp - pThis->u64AckedAt < ITR * 256 && !(ICR & ICR_RXT0)) 1900 uint64_t tsNow = TMTimerGet(pThis->CTX_SUFF(pIntTimer)); 1901 if (!!ITR && tsNow - pThis->u64AckedAt < ITR * 256 1902 && pThis->fItrEnabled && (pThis->fItrRxEnabled || !(ICR & ICR_RXT0))) 1915 1903 { 1916 1904 E1K_INC_ISTAT_CNT(pThis->uStatIntEarly); 1917 1905 E1kLog2(("%s e1kRaiseInterrupt: Too early to raise again: %d ns < %d ns.\n", 1918 pThis->szPrf, (uint32_t)(tstamp - pThis->u64AckedAt), ITR * 256)); 1906 pThis->szPrf, (uint32_t)(tsNow - pThis->u64AckedAt), ITR * 256)); 1907 e1kPostponeInterrupt(pThis, ITR * 256); 1919 1908 } 1920 1909 else 1921 #endif1922 1910 { 1923 1911 … … 2885 2873 if (RT_SUCCESS(rc)) 2886 2874 { 2875 /* Do not return masked bits. */ 2876 value &= IMS; 2887 2877 if (value) 2888 2878 { … … 2961 2951 E1kLogRel(("E1000: irq enabled, RDH=%x RDT=%x TDH=%x TDT=%x\n", RDH, RDT, TDH, TDT)); 2962 2952 E1kLog(("%s e1kRegWriteIMS: IRQ enabled\n", pThis->szPrf)); 2963 /* Mask changes, we need to raise pending interrupts. */ 2964 if ((ICR & IMS) && !pThis->fLocked) 2965 { 2966 E1kLog2(("%s e1kRegWriteIMS: IRQ pending (%08x), arming late int timer...\n", 2967 pThis->szPrf, ICR)); 2968 /* Raising an interrupt immediately causes win7 to hang upon NIC reconfiguration, see @bugref{5023}. */ 2969 TMTimerSet(pThis->CTX_SUFF(pIntTimer), TMTimerFromNano(pThis->CTX_SUFF(pIntTimer), ITR * 256) + 2970 TMTimerGet(pThis->CTX_SUFF(pIntTimer))); 2971 } 2953 e1kRaiseInterrupt(pThis, VINF_IOM_R3_MMIO_WRITE, 0); 2972 2954 2973 2955 return VINF_SUCCESS; … … 7473 7455 if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "AdapterType\0" 7474 7456 "LineSpeed\0" "GCEnabled\0" "R0Enabled\0" 7457 "ItrEnabled\0" "ItrRxEnabled\0" 7475 7458 "EthernetCRC\0" "GSOEnabled\0" "LinkUpDelay\0")) 7476 7459 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, … … 7479 7462 /** @todo: LineSpeed unused! */ 7480 7463 7481 pThis->fR0Enabled = true; 7482 pThis->fRCEnabled = true; 7483 pThis->fEthernetCRC = true; 7484 pThis->fGSOEnabled = true; 7464 pThis->fR0Enabled = true; 7465 pThis->fRCEnabled = true; 7466 pThis->fEthernetCRC = true; 7467 pThis->fGSOEnabled = true; 7468 pThis->fItrEnabled = true; 7469 pThis->fItrRxEnabled = true; 7485 7470 7486 7471 /* Get config params */ … … 7518 7503 N_("Configuration error: Failed to get the value of 'GSOEnabled'")); 7519 7504 7505 rc = CFGMR3QueryBoolDef(pCfg, "ItrEnabled", &pThis->fItrEnabled, true); 7506 if (RT_FAILURE(rc)) 7507 return PDMDEV_SET_ERROR(pDevIns, rc, 7508 N_("Configuration error: Failed to get the value of 'ItrEnabled'")); 7509 7510 rc = CFGMR3QueryBoolDef(pCfg, "ItrRxEnabled", &pThis->fItrRxEnabled, true); 7511 if (RT_FAILURE(rc)) 7512 return PDMDEV_SET_ERROR(pDevIns, rc, 7513 N_("Configuration error: Failed to get the value of 'ItrRxEnabled'")); 7514 7520 7515 rc = CFGMR3QueryU32Def(pCfg, "LinkUpDelay", (uint32_t*)&pThis->cMsLinkUpDelay, 5000); /* ms */ 7521 7516 if (RT_FAILURE(rc)) … … 7528 7523 LogRel(("%s WARNING! Link up delay is disabled!\n", pThis->szPrf)); 7529 7524 7530 E1kLog(("%s Chip=%s LinkUpDelay=%ums EthernetCRC=%s GSO=%s R0=%s GC=%s\n", pThis->szPrf,7525 LogRel(("%s Chip=%s LinkUpDelay=%ums EthernetCRC=%s GSO=%s Itr=%s ItrRx=%s R0=%s GC=%s\n", pThis->szPrf, 7531 7526 g_Chips[pThis->eChip].pcszName, pThis->cMsLinkUpDelay, 7532 7527 pThis->fEthernetCRC ? "on" : "off", 7533 7528 pThis->fGSOEnabled ? "enabled" : "disabled", 7529 pThis->fItrEnabled ? "enabled" : "disabled", 7530 pThis->fItrRxEnabled ? "enabled" : "disabled", 7534 7531 pThis->fR0Enabled ? "enabled" : "disabled", 7535 7532 pThis->fRCEnabled ? "enabled" : "disabled"));
Note:
See TracChangeset
for help on using the changeset viewer.