e1000: no need auto-negotiation if link was down

Commit b9d03e352c 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 <jasowang@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Amos Kong 2012-12-28 17:29:10 +08:00 committed by Stefan Hajnoczi
parent f30dbae63a
commit 84dd212024

View File

@ -166,6 +166,11 @@ static void
set_phy_ctrl(E1000State *s, int index, uint16_t val) set_phy_ctrl(E1000State *s, int index, uint16_t val)
{ {
if ((val & MII_CR_AUTO_NEG_EN) && (val & MII_CR_RESTART_AUTO_NEG)) { 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; s->nic->nc.link_down = true;
e1000_link_down(s); e1000_link_down(s);
s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE; s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;