From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60253 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmQF2-0006hx-KO for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:30:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmQF1-0006Fd-3Q for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:30:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmQF0-0006F8-SC for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:30:51 -0500 Date: Mon, 7 Feb 2011 14:30:26 +0200 From: "Michael S. Tsirkin" Message-ID: <20110207123026.GA18830@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] e1000: clear EOP for multi-buffer descriptors List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: agraf@suse.de, Jes.Sorensen@redhat.com, Alex Williamson , stefanha@linux.vnet.ibm.com, Juan Quintela Cc: qemu-devel@nongnu.org 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=E2=80=93= 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 Reported-by: Juan Quintela --- 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 =3D cpu_to_le16(desc_size + fcs_len(s)); desc.status |=3D E1000_RXD_STAT_EOP | E1000_RXD_STAT_IXS= M; } else { + /* Guest zeroing out status is not a hardware requiremen= t. + Clear EOP in case guest didn't do it. */ + desc.status &=3D ~E1000_RXD_STAT_EOP; desc.length =3D cpu_to_le16(desc_size); } } else { // as per intel docs; skip descriptors with null buf ad= dr --=20 1.7.3.2.91.g446ac