qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] e1000: clear EOP for multi-buffer descriptors
@ 2011-02-07 12:30 Michael S. Tsirkin
  2011-02-07 12:32 ` [Qemu-devel] " Juan Quintela
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2011-02-07 12:30 UTC (permalink / raw)
  To: agraf, Jes.Sorensen, Alex Williamson, stefanha, Juan Quintela; +Cc: qemu-devel

The e1000 spec says: if software statically allocates
buffers, and uses memory read to check for completed descriptors, it
simply has to zero the status byte in the descriptor to make it ready
for reuse by hardware. This is not a hardware requirement (moving the
hardware tail pointer is), but is necessary for performing an in–memory
scan.

Thus the guest does not have to clear the status byte.  In case it
doesn't we need to clear EOP for all descriptors
except the last.  While I don't know of any such guests,
it's probably a good idea to stick to the spec.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>

---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index 3427ff3..7853c12 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -694,6 +694,9 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
                 desc.length = cpu_to_le16(desc_size + fcs_len(s));
                 desc.status |= E1000_RXD_STAT_EOP | E1000_RXD_STAT_IXSM;
             } else {
+                /* Guest zeroing out status is not a hardware requirement.
+                   Clear EOP in case guest didn't do it. */
+                desc.status &= ~E1000_RXD_STAT_EOP;
                 desc.length = cpu_to_le16(desc_size);
             }
         } else { // as per intel docs; skip descriptors with null buf addr
-- 
1.7.3.2.91.g446ac

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-07 21:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-07 12:30 [Qemu-devel] [PATCH] e1000: clear EOP for multi-buffer descriptors Michael S. Tsirkin
2011-02-07 12:32 ` [Qemu-devel] " Juan Quintela
2011-02-07 13:36 ` Stefan Hajnoczi
2011-02-07 15:37 ` Alex Williamson
2011-02-07 17:59 ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).