From patchwork Fri Dec 28 09:29:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 208426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 81C712C0131 for ; Fri, 28 Dec 2012 20:30:01 +1100 (EST) Received: from localhost ([::1]:38283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToWGN-0000R9-Jo for incoming@patchwork.ozlabs.org; Fri, 28 Dec 2012 04:29:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToWFu-0007su-2E for qemu-devel@nongnu.org; Fri, 28 Dec 2012 04:29:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ToWFt-0002UA-0S for qemu-devel@nongnu.org; Fri, 28 Dec 2012 04:29:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToWFs-0002Tz-Pw for qemu-devel@nongnu.org; Fri, 28 Dec 2012 04:29:28 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBS9TQq9006767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Dec 2012 04:29:28 -0500 Received: from dhcp-8-167.nay.redhat.com ([10.66.7.126]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBS9TEE3030608; Fri, 28 Dec 2012 04:29:22 -0500 From: Amos Kong To: qemu-devel@nongnu.org Date: Fri, 28 Dec 2012 17:29:10 +0800 Message-Id: <1356686951-20305-2-git-send-email-akong@redhat.com> In-Reply-To: <1356686951-20305-1-git-send-email-akong@redhat.com> References: <1356686951-20305-1-git-send-email-akong@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: jan.kiszka@siemens.com, jasowang@redhat.com, Amos Kong , stefanha@redhat.com Subject: [Qemu-devel] [PATCH 1/2] e1000: no need auto-negotiation if link was down X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Commit b9d03e352cb6b31a66545763f6a1e20c9abf0c2c added link auto-negotiation emulation, it would always set link up by callback function. Problem exists if original link status was down, link status should not be changed in auto-negotiation. Signed-off-by: Jason Wang Signed-off-by: Amos Kong --- hw/e1000.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/e1000.c b/hw/e1000.c index 92fb00a..eebcd1d 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -164,6 +164,11 @@ static void set_phy_ctrl(E1000State *s, int index, uint16_t val) { if ((val & MII_CR_AUTO_NEG_EN) && (val & MII_CR_RESTART_AUTO_NEG)) { + /* no need auto-negotiation if link was down */ + if (s->nic->nc.link_down) { + s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE; + return; + } s->nic->nc.link_down = true; e1000_link_down(s); s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;