From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Cc: kwolf@redhat.com, Jes.Sorensen@redhat.com,
Alex Williamson <alex.williamson@redhat.com>,
agraf@suse.de, stefanha@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCHv2 2/3] e1000: clear EOP for multi-buffer descriptors
Date: Tue, 15 Feb 2011 18:27:52 +0200 [thread overview]
Message-ID: <c2974b54b25ab91c76603fc3a87ec2ad7ebe77dc.1297787220.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1297787220.git.mst@redhat.com>
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 | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/e1000.c b/hw/e1000.c
index 050ce02..2943a1a 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -698,11 +698,13 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
copy_size);
}
desc_offset += desc_size;
+ desc.length = cpu_to_le16(desc_size);
if (desc_offset >= total_size) {
- desc.length = cpu_to_le16(desc_size);
desc.status |= E1000_RXD_STAT_EOP | E1000_RXD_STAT_IXSM;
} else {
- desc.length = cpu_to_le16(desc_size);
+ /* Guest zeroing out status is not a hardware requirement.
+ Clear EOP in case guest didn't do it. */
+ desc.status &= ~E1000_RXD_STAT_EOP;
}
} else { // as per intel docs; skip descriptors with null buf addr
DBGOUT(RX, "Null RX descriptor!!\n");
--
1.7.3.2.91.g446ac
next prev parent reply other threads:[~2011-02-15 16:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-15 16:27 [Qemu-devel] [PATCHv2 0/3] e1000: multi-buffer packet support Michael S. Tsirkin
2011-02-15 16:27 ` [Qemu-devel] [PATCHv2 1/3] " Michael S. Tsirkin
2011-02-15 16:27 ` Michael S. Tsirkin [this message]
2011-02-15 16:27 ` [Qemu-devel] [PATCHv2 3/3] e1000: verify we have buffers, upfront Michael S. Tsirkin
2011-02-16 11:37 ` [Qemu-devel] Re: [PATCHv2 0/3] e1000: multi-buffer packet support Stefan Hajnoczi
2011-02-17 0:05 ` [Qemu-devel] " Alex Williamson
2011-02-17 12:04 ` [Qemu-devel] " Kevin Wolf
2011-02-20 14:29 ` [Qemu-devel] " Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2974b54b25ab91c76603fc3a87ec2ad7ebe77dc.1297787220.git.mst@redhat.com \
--to=mst@redhat.com \
--cc=Jes.Sorensen@redhat.com \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).