From: Amos Kong Date: Fri, 28 Dec 2012 09:29:10 +0000 (+0800) Subject: e1000: no need auto-negotiation if link was down X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=84dd2120247a7d25ff1bb337de21c0e76816ad2d;p=qemu.git e1000: no need auto-negotiation if link was down 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 --- diff --git a/hw/e1000.c b/hw/e1000.c index 8fd165456a..0f177ff844 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;