I'll try to look at this later this week and provide some feedback.
Interesting though (I looked at the diff)... processing rxInterrupt even though related rx status bits in IntrStatus are not set?!
Basically it boils down to reverting the effect of interrupt mitigation while operating with moderate load as there are much more transmitter than receiver interrupts. If the rx interrupt bit isn't set this doesn't necessarily mean that no packets have been received yet and checking the receiver ring once is cheap as we are already in the interrupt routine. Instead of periodically calculating the average interrupt rate I'm now working with a modified algorithm measuring the time interval between interrupts with kFastIntrTreshhold set to 200µs.
void RTL8111::interruptOccurred(OSObject *client, IOInterruptEventSource *src, int count)
UInt64 time, abstime;
status = ReadReg16(IntrStatus);
/* hotplug/major error/no more work/shared irq */
if ((status == 0xFFFF) || !status)
/* Calculate time since last interrupt. */
rxMask = ((time - lastIntrTime) < kFastIntrTreshhold) ? (RxOK | RxDescUnavail | RxFIFOOver) : (RxOK | RxDescUnavail | RxFIFOOver | TxOK);
lastIntrTime = time;
if (status & SYSErr)
/* Rx interrupt */
if (status & rxMask)
/* Tx interrupt */
if (status & (TxOK | TxErr | TxDescUnavail))
if (status & LinkChg)
/* Check if a statistics dump has been completed. */
if (needsUpdate && !(ReadReg32(CounterAddrLow) & CounterDump))
Maybe this will open up a new perspective with adaptive receiver interrupt mitigation, with low values like 0x51 for moderate load and 0x58 for heavy load. I don't know if this is possible but it might be worth a try. I was able to get good performance with this version while communicating with the 2006 MacBook Pro (Marvell Yukon) running Win XP without changing it's maximum interrupt rate from 5000 to 10000 as I had to do with version 1.1.1 for a reasonable performance.
By the way the inspiration for the change comes from the documentation of the Broadcom BCM57785 which has a quite sophisticated interrupt mitigation logic.