aboutsummaryrefslogtreecommitdiff
path: root/hw/e1000.c
diff options
context:
space:
mode:
authorAmos Kong <akong@redhat.com>2012-12-28 17:29:10 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2013-01-07 10:43:21 +0100
commit84dd2120247a7d25ff1bb337de21c0e76816ad2d (patch)
treec58803c34d662e1c5ef0393a05ca1656669ed112 /hw/e1000.c
parentf30dbae63a46f23116715dff8d130c7d01ff02be (diff)
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 <jasowang@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/e1000.c')
-rw-r--r--hw/e1000.c5
1 files changed, 5 insertions, 0 deletions
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;