* [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
* [Qemu-devel] Re: [PATCH] e1000: clear EOP for multi-buffer descriptors
2011-02-07 12:30 [Qemu-devel] [PATCH] e1000: clear EOP for multi-buffer descriptors Michael S. Tsirkin
@ 2011-02-07 12:32 ` Juan Quintela
2011-02-07 13:36 ` Stefan Hajnoczi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Juan Quintela @ 2011-02-07 12:32 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Jes.Sorensen, Alex Williamson, agraf, stefanha
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> 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>
reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH] e1000: clear EOP for multi-buffer descriptors
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
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2011-02-07 13:36 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Jes.Sorensen, Alex Williamson, agraf, Juan Quintela
On Mon, Feb 07, 2011 at 02:30:26PM +0200, Michael S. Tsirkin wrote:
> 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(-)
This makes sense: if the guest didn't clear the end-of-packet bit but
we're receiving a multi-buffer packet, clear EOP for all but the last
descriptor.
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH] e1000: clear EOP for multi-buffer descriptors
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
3 siblings, 0 replies; 5+ messages in thread
From: Alex Williamson @ 2011-02-07 15:37 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Jes.Sorensen, Juan Quintela, agraf, stefanha
On Mon, 2011-02-07 at 14:30 +0200, Michael S. Tsirkin wrote:
> 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
Acked-by: Alex Williamson <alex.williamson@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH] e1000: clear EOP for multi-buffer descriptors
2011-02-07 12:30 [Qemu-devel] [PATCH] e1000: clear EOP for multi-buffer descriptors Michael S. Tsirkin
` (2 preceding siblings ...)
2011-02-07 15:37 ` Alex Williamson
@ 2011-02-07 17:59 ` Alex Williamson
3 siblings, 0 replies; 5+ messages in thread
From: Alex Williamson @ 2011-02-07 17:59 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Jes.Sorensen, Juan Quintela, agraf, stefanha
On Mon, 2011-02-07 at 14:30 +0200, Michael S. Tsirkin wrote:
> 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
Acked-by: Alex Williamson <alex.williamson@redhat.com>
^ permalink raw reply [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).