From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXNz0-0005q2-Lq for qemu-devel@nongnu.org; Thu, 16 Jun 2011 21:36:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXNyy-00034F-12 for qemu-devel@nongnu.org; Thu, 16 Jun 2011 21:36:26 -0400 Received: from [222.73.24.84] (port=59234 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXNyx-00033X-6u for qemu-devel@nongnu.org; Thu, 16 Jun 2011 21:36:23 -0400 Message-ID: <4DFAAF00.900@cn.fujitsu.com> Date: Fri, 17 Jun 2011 09:33:52 +0800 From: Wen Congyang MIME-Version: 1.0 References: <4DF9BD9C.1060307@cn.fujitsu.com> <4DF9DD77.5040401@redhat.com> <20110616124651.GD14583@redhat.com> In-Reply-To: <20110616124651.GD14583@redhat.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] [PATCH] do not send packet to nic if the packet will be dropped by nic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , Kevin Wolf , Aurelien Jarno , qemu-devel If !s->clock_enabled or !rtl8139_receiver_enabled(s), it means that the nic will drop all packets from host. So qemu will keep getting packets from host and wasting CPU on dropping packets. This seems worse than packets that should be dropped but aren't. Signed-off-by: Wen Congyang --- hw/rtl8139.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 2f8db58..9084678 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -810,9 +810,9 @@ static int rtl8139_can_receive(VLANClientState *nc) /* Receive (drop) packets if card is disabled. */ if (!s->clock_enabled) - return 1; + return 0; if (!rtl8139_receiver_enabled(s)) - return 1; + return 0; if (rtl8139_cp_receiver_enabled(s)) { /* ??? Flow control not implemented in c+ mode. -- 1.7.1