mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
Kernel: Update E1000 link state using interrupt
Calls to link_up() in the E1000 driver would read the link state directly from the hardware on every call. This had negative performance impact in high throughput situations since link_up() is called every time an IP packet's route is resolved. This patch takes inspiration from the RTL8139 network adapter where the link state is stored in a bool and only updated when the hardware generates an interrupt related to link state change. After this change I measured a ~9% increase in TCP Tx throughput using: cat /dev/zero | nc <host_IP> <host_port> from the Serenity VM to my host machine
This commit is contained in:
parent
d7f6635d55
commit
b6ba0f9fad
2 changed files with 7 additions and 6 deletions
|
@ -221,6 +221,9 @@ UNMAP_AFTER_INIT bool E1000NetworkAdapter::initialize()
|
|||
|
||||
setup_link();
|
||||
setup_interrupts();
|
||||
|
||||
m_link_up = ((in32(REG_STATUS) & STATUS_LU) != 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -249,6 +252,8 @@ bool E1000NetworkAdapter::handle_irq(const RegisterState&)
|
|||
if (status & INTERRUPT_LSC) {
|
||||
u32 flags = in32(REG_CTRL);
|
||||
out32(REG_CTRL, flags | ECTRL_SLU);
|
||||
|
||||
m_link_up = ((in32(REG_STATUS) & STATUS_LU) != 0);
|
||||
}
|
||||
if (status & INTERRUPT_RXDMT0) {
|
||||
// Threshold OK?
|
||||
|
@ -315,11 +320,6 @@ UNMAP_AFTER_INIT void E1000NetworkAdapter::read_mac_address()
|
|||
}
|
||||
}
|
||||
|
||||
bool E1000NetworkAdapter::link_up()
|
||||
{
|
||||
return (in32(REG_STATUS) & STATUS_LU);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void E1000NetworkAdapter::initialize_rx_descriptors()
|
||||
{
|
||||
auto* rx_descriptors = (e1000_tx_desc*)m_rx_descriptors_region->vaddr().as_ptr();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue