e1000e: A few fixes for RX data path
cover e1000e: A few fixes for RX data path
This series contains a few RX logic fixes for e1000e.
These fixes improve compliance to HW device specification and fix occasional interruptions of RX traffic with the latest linux driver.
Dmitry Fleytman (7):
e1000e: Flush all receive queues on receive enable
e1000e: Flush receive queue on link up
e1000e: Fix CTRL_EXT.EIAME behavior
e1000e: Fix PBACLR implementation
e1000e: Fix OTHER interupts processing for MSI-X
e1000e: Fix spurious RX TCP ACK interrupts
e1000e: Fix EIAC register implementation
hw/net/e1000e.c | 2 +- hw/net/e1000e_core.c | 30 +++++++++++++++++++----------- hw/net/e1000e_core.h | 3 +++ hw/net/trace-events | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-)
Signature · 1 line
2.7.4
PATCH 2/7 e1000e: Flush receive queues on link up
--- hw/net/e1000e_core.c | 3 +++ 1 file changed, 3 insertions(+)
hw/net/e1000e_core.c +3 -0
@@ -1807,6 +1807,7 @@ e1000e_core_set_link_status(E1000ECore *core) core->autoneg_timer); }else {e1000x_update_regs_on_link_up (core->mac, core->phy[0 ]); +e1000e_start_recv (core); } }
@@ -2187,6 +2188,8 @@ e1000e_autoneg_timer(void *opaque)E1000ECore *core = opaque;if (!qemu_get_queue (core->owner_nic)->link_down) {e1000x_update_regs_on_autoneg_done (core->mac, core->phy[0 ]); +e1000e_start_recv (core); +e1000e_update_flowctl_status (core);/* signal link status change to the guest */ e1000e_set_interrupt_cause (core,E1000_ICR_LSC );
Signature · 1 line
2.7.4
PATCH 1/7 e1000e: Flush all receive queues on receive enable
In reply to Dmitry FleytmanBefore this patch first netdev queue only was flushed.
--- hw/net/e1000e.c | 2 +- hw/net/e1000e_core.c | 2 +- hw/net/e1000e_core.h | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-)
hw/net/e1000e.c +1 -1
@@ -400,7 +400,7 @@ static void e1000e_write_config(PCIDevice *pci_dev, uint32_t address,if (range_covers_byte (address, len,PCI_COMMAND ) && (pci_dev->config[PCI_COMMAND ] &PCI_COMMAND_MASTER )) { -qemu_flush_queued_packets (qemu_get_queue (s->nic)); +e1000e_start_recv (&s->core); } }
hw/net/e1000e_core.c +1 -1
@@ -953,7 +953,7 @@ e1000e_has_rxbufs(E1000ECore *core, const E1000E_RingInfo *r, core->rx_desc_buf_size; } -static inline void +void e1000e_start_recv (E1000ECore *core) {int i;
hw/net/e1000e_core.h +3 -0
@@ -144,3 +144,6 @@ e1000e_receive(E1000ECore *core, const uint8_t *buf, size_t size);ssize_t e1000e_receive_iov (E1000ECore *core,const struct iovec *iov,int iovcnt); + +void +e1000e_start_recv (E1000ECore *core);
Signature · 1 line
2.7.4
PATCH 3/7 e1000e: Fix CTRL_EXT.EIAME behavior
In reply to Dmitry FleytmanCTRL_EXT.EIAME bit controls clearing of IAM bits,
but current code clears IMS bits instead.
See spec. 10.2.2.5 Extended Device Control Register.
--- hw/net/e1000e_core.c | 4 ++-- hw/net/trace-events | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/net/e1000e_core.c +2 -2
@@ -2008,8 +2008,8 @@ e1000e_msix_notify_one(E1000ECore *core, uint32_t cause, uint32_t int_cfg) }if (core->mac[CTRL_EXT ] &E1000_CTRL_EXT_EIAME ) { -trace_e1000e_irq_ims_clear_eiame (core->mac[IAM ], cause); -e1000e_clear_ims_bits (core, core->mac[IAM ] & cause); +trace_e1000e_irq_iam_clear_eiame (core->mac[IAM ], cause); + core->mac[IAM ] &= ~cause; }trace_e1000e_irq_icr_clear_eiac (core->mac[ICR ], core->mac[EIAC ]);
hw/net/trace-events +1 -1
@@ -223,7 +223,7 @@ e1000e_irq_icr_read_entry(uint32_t icr) "Starting ICR read. Current ICR: 0x%x" e1000e_irq_icr_read_exit(uint32_t icr) "Ending ICR read. Current ICR: 0x%x" e1000e_irq_icr_clear_zero_ims(void) "Clearing ICR on read due to zero IMS" e1000e_irq_icr_clear_iame(void) "Clearing ICR on read due to IAME" -e1000e_irq_ims_clear_eiame(uint32_t iam, uint32_t cause) "Clearing IMS due to EIAME, IAM: 0x%X, cause: 0x%X" +e1000e_irq_iam_clear_eiame(uint32_t iam, uint32_t cause) "Clearing IMS due to EIAME, IAM: 0x%X, cause: 0x%X" e1000e_irq_icr_clear_eiac(uint32_t icr, uint32_t eiac) "Clearing ICR bits due to EIAC, ICR: 0x%X, EIAC: 0x%X" e1000e_irq_ims_clear_set_imc(uint32_t val) "Clearing IMS bits due to IMC write 0x%x" e1000e_irq_fire_delayed_interrupts(void) "Firing delayed interrupts"
Signature · 1 line
2.7.4
PATCH 4/7 e1000e: Fix PBACLR implementation
In reply to Dmitry FleytmanThis patch fixes incorrect check for
interrypt type being used.
PBSCLR register is valid for MSI-X only.
See spec. 10.2.3.13 MSI—X PBA Clear
--- hw/net/e1000e_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/e1000e_core.c +1 -1
@@ -2347,7 +2347,7 @@ e1000e_set_pbaclr(E1000ECore *core, int index, uint32_t val) core->mac[PBACLR ] = val &E1000_PBACLR_VALID_MASK ; -if (msix_enabled (core->owner)) { +if (!msix_enabled (core->owner)) {return ; }
Signature · 1 line
2.7.4
PATCH 5/7 e1000e: Fix OTHER interrupts processing for MSI-X
In reply to Dmitry FleytmanInterrupt mask for legacy OTHER causes should
not apply to MSI-X OTHER cause.
--- hw/net/e1000e_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/e1000e_core.c +1 -1
@@ -2131,7 +2131,7 @@ e1000e_update_interrupt_state(E1000ECore *core)/* Set ICR[OTHER] for MSI-X */ if (is_msix) { -if (core->mac[ICR ] & core->mac[IMS ] &E1000_ICR_OTHER_CAUSES ) { +if (core->mac[ICR ] &E1000_ICR_OTHER_CAUSES ) { core->mac[ICR ] |=E1000_ICR_OTHER ;trace_e1000e_irq_add_msi_other (core->mac[ICR ]); }
Signature · 1 line
2.7.4
PATCH 6/7 e1000e: Fix spurious RX TCP ACK interrupts
In reply to Dmitry FleytmanDo not raise ACK interrupts when
RFCTL.ACKDIS bit is set (see spec. 10.2.5.16).
--- hw/net/e1000e_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/net/e1000e_core.c +2 -1
@@ -1710,7 +1710,8 @@ e1000e_receive_iov(E1000ECore *core, const struct iovec *iov, int iovcnt) }/* Perform ACK receive detection */ -if (e1000e_is_tcp_ack (core, core->rx_pkt)) { +if (!(core->mac[RFCTL ] &E1000_RFCTL_ACK_DIS ) && + (e1000e_is_tcp_ack (core, core->rx_pkt))) { n |=E1000_ICS_ACK ; }
Signature · 1 line
2.7.4
PATCH 7/7 e1000e: Fix EIAC register implementation
In reply to Dmitry FleytmanThis patch fixes 2 issues:
1. Bits set in EIAC register should be cleared from IMS when EIAM is not used.
2. Only bit that corresonds to the interrupt being raised should be cleared.
See spec. 10.2.4.7 Interrupt Auto Clear
--- hw/net/e1000e_core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
hw/net/e1000e_core.c +9 -5
@@ -2015,13 +2015,17 @@ e1000e_msix_notify_one(E1000ECore *core, uint32_t cause, uint32_t int_cfg)trace_e1000e_irq_icr_clear_eiac (core->mac[ICR ], core->mac[EIAC ]); -if (core->mac[EIAC ] &E1000_ICR_OTHER ) { - effective_eiac = (core->mac[EIAC ] &E1000_EIAC_MASK ) | -E1000_ICR_OTHER_CAUSES ; - }else { - effective_eiac = core->mac[EIAC ] &E1000_EIAC_MASK ; + effective_eiac = core->mac[EIAC ] & cause; + +if (effective_eiac ==E1000_ICR_OTHER ) { + effective_eiac |=E1000_ICR_OTHER_CAUSES ; } + core->mac[ICR ] &= ~effective_eiac; + +if (!(core->mac[CTRL_EXT ] &E1000_CTRL_EXT_IAME )) { + core->mac[IMS ] &= ~effective_eiac; + } } static void
Signature · 1 line
2.7.4
Hi qemu-devel,
Ping.
~Dmitry
Quoted 26 lines · Dmitry Fleytman
This series contains a few RX logic fixes for e1000e.
These fixes improve compliance to HW device specification and fix occasional interruptions of RX traffic with the latest linux driver.
Dmitry Fleytman (7):
e1000e: Flush all receive queues on receive enable
e1000e: Flush receive queue on link up
e1000e: Fix CTRL_EXT.EIAME behavior
e1000e: Fix PBACLR implementation
e1000e: Fix OTHER interupts processing for MSI-X
e1000e: Fix spurious RX TCP ACK interrupts
e1000e: Fix EIAC register implementationhw/net/e1000e.c | 2 +- hw/net/e1000e_core.c | 30 +++++++++++++++++++----------- hw/net/e1000e_core.h | 3 +++ hw/net/trace-events | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-)Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH 4/7] e1000e: Fix PBACLR implementation
In reply to Dmitry FleytmanQuoted 17 lines · Dmitry Fleytman
This patch fixes incorrect check for
interrypt type being used.PBSCLR register is valid for MSI-X only.
See spec. 10.2.3.13 MSI—X PBA Clear
Signed-off-by Dmitry Fleytman <[email protected]>--- hw/net/e1000e_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/net/e1000e_core.c +0
-0
hw/net/e1000e_core.c e1000e_set_pbaclr(E1000ECore *core, int index, uint32_t val) · line 2353
Quoted 8 lines
hw/net/e1000e_core.c +1
-1@@ -2347,7 +2347,7 @@ e1000e_set_pbaclr(E1000ECore *core, int index, uint32_t val) core->mac[PBACLR ] = val &E1000_PBACLR_VALID_MASK ; -if (msix_enabled (core->owner)) { +if (!msix_enabled (core->owner)) {return ; }
Spec also said "writing 0b has no effect". So we'd better implement this behavior too?
Re: [Qemu-devel] [PATCH 4/7] e1000e: Fix PBACLR implementation
Quoted 18 lines · Jason Wang
Quoted 12 lines · Dmitry Fleytman
This patch fixes incorrect check for
interrypt type being used.PBSCLR register is valid for MSI-X only.
See spec. 10.2.3.13 MSI—X PBA Clear
Signed-off-by Dmitry Fleytman <[email protected]>--- hw/net/e1000e_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
hw/net/e1000e_core.c e1000e_set_pbaclr(E1000ECore *core, int index, uint32_t val) · line 2352
Quoted 11 lines
hw/net/e1000e_core.c +1
-0@@ -2347,7 +2347,7 @@ e1000e_set_pbaclr(E1000ECore *core, int index, uint32_t val) core->mac[PBACLR ] = val &E1000_PBACLR_VALID_MASK ; - if (msix_enabled(core->owner)) { +if (!msix_enabled (core->owner)) {return ; }Spec also said "writing 0b has no effect". So we'd better implement this behavior too?
Hi Jason,
Not sure I understand you correctly.
With current implementation, writing 0b does nothing except that it changes value of PBACLR being read.
I just verified that physical device behaves exactly like this.
Is this what you meant?
~Dmitry
Re: [Qemu-devel] [PATCH 4/7] e1000e: Fix PBACLR implementation
Quoted 34 lines · Dmitry Fleytman
Quoted 17 lines · Jason Wang
Quoted 12 lines · Dmitry Fleytman
This patch fixes incorrect check for
interrypt type being used.PBSCLR register is valid for MSI-X only.
See spec. 10.2.3.13 MSI—X PBA Clear
Signed-off-by Dmitry Fleytman <[email protected]>--- hw/net/e1000e_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 12 lines
hw/net/e1000e_core.c e1000e_set_pbaclr(E1000ECore *core, int index, uint32_t val) · line 2352
Quoted 11 lines
hw/net/e1000e_core.c +1
-0@@ -2347,7 +2347,7 @@ e1000e_set_pbaclr(E1000ECore *core, int index, uint32_t val) core->mac[PBACLR ] = val &E1000_PBACLR_VALID_MASK ; - if (msix_enabled(core->owner)) { +if (!msix_enabled (core->owner)) {return ; }Spec also said "writing 0b has no effect". So we'd better implement this behavior too?
Hi Jason,
Not sure I understand you correctly.
Quoted 9 lines
With current implementation, writing 0b does nothing except that it changes value of PBACLR being read.
I just verified that physical device behaves exactly like this.
Is this what you meant?
~Dmitry
Yes, then it looks fine to me.
Thanks
Jason Wang
AppliedQuoted 15 lines · Dmitry Fleytman
This series contains a few RX logic fixes for e1000e.
These fixes improve compliance to HW device specification and fix occasional interruptions of RX traffic with the latest linux driver.
Dmitry Fleytman (7):
e1000e: Flush all receive queues on receive enable
e1000e: Flush receive queue on link up
e1000e: Fix CTRL_EXT.EIAME behavior
e1000e: Fix PBACLR implementation
e1000e: Fix OTHER interupts processing for MSI-X
e1000e: Fix spurious RX TCP ACK interrupts
e1000e: Fix EIAC register implementation
Quoted 6 lines
hw/net/e1000e.c | 2 +- hw/net/e1000e_core.c | 30 +++++++++++++++++++----------- hw/net/e1000e_core.h | 3 +++ hw/net/trace-events | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-)
Applied, thanks.