From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=43675 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8Djh-0000bR-Qe for qemu-devel@nongnu.org; Tue, 19 Oct 2010 11:04:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8Diq-0005Tt-0i for qemu-devel@nongnu.org; Tue, 19 Oct 2010 11:04:19 -0400 Received: from goliath.siemens.de ([192.35.17.28]:18572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8Dip-0005TY-OO for qemu-devel@nongnu.org; Tue, 19 Oct 2010 11:03:27 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o9JF3P3U000455 for ; Tue, 19 Oct 2010 17:03:25 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o9JF3OFn002113 for ; Tue, 19 Oct 2010 17:03:24 +0200 Message-ID: <4CBDB33C.60002@siemens.com> Date: Tue, 19 Oct 2010 17:03:24 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH][RESEND] pcnet: Do not receive external frames in loopback mode List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel While not explicitly stated in the spec, it was observed on real systems that enabling loopback testing on the pcnet controller disables reception of external frames. And some legacy software relies on it, so provide this behavior. Signed-off-by: Jan Kiszka --- hw/pcnet.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/pcnet.c b/hw/pcnet.c index b52935a..f970bda 100644 --- a/hw/pcnet.c +++ b/hw/pcnet.c @@ -1048,9 +1048,10 @@ ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_) int crc_err = 0; int size = size_; - if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size) + if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size || + (CSR_LOOP(s) && !s->looptest)) { return -1; - + } #ifdef PCNET_DEBUG printf("pcnet_receive size=%d\n", size); #endif -- 1.7.1