From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsWgr-0008Jk-9q for qemu-devel@nongnu.org; Tue, 08 Jan 2013 05:45:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsWgo-0006cD-2J for qemu-devel@nongnu.org; Tue, 08 Jan 2013 05:45:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsWgn-0006c8-QD for qemu-devel@nongnu.org; Tue, 08 Jan 2013 05:45:49 -0500 From: Stefan Hajnoczi Date: Tue, 8 Jan 2013 11:45:38 +0100 Message-Id: <1357641939-20030-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1357641939-20030-1-git-send-email-stefanha@redhat.com> References: <1357641939-20030-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 3/4] e1000: no need auto-negotiation if link was down List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Amos Kong , Jason Wang , Stefan Hajnoczi From: Amos Kong 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 Signed-off-by: Stefan Hajnoczi --- hw/e1000.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/e1000.c b/hw/e1000.c index 8fd1654..0f177ff 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -166,6 +166,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; -- 1.8.0.2