summaryrefslogtreecommitdiff
path: root/hw/net/e1000.c
diff options
context:
space:
mode:
authorGabriel L. Somlo <gsomlo@gmail.com>2014-06-19 11:55:34 -0400
committerMichael S. Tsirkin <mst@redhat.com>2014-06-23 17:38:00 +0300
commit6883b5914029fa8ffc42a43d2a2188493c27fd58 (patch)
tree21fe8ff4e1bf2b09d96fa2250cdad396c235bdf5 /hw/net/e1000.c
parent6a2acedb19221ddf5e6fd3fb3590ba636aa21007 (diff)
downloadqemu-6883b5914029fa8ffc42a43d2a2188493c27fd58.tar.gz
e1000: improve auto-negotiation reporting via mii-tool
Using mii-tool (on F20-live), the following output is produced: SIOCGMIIREG on ens3 failed: Input/output error ens3: no autonegotiation, 1000baseT-FD flow-control, link ok The first line (SIOCGMIIREG error) is due to mii-tool's inability to read the PHY auto-negotiation expansion register. On the second line, "no autonegotiation" is wrong, and caused by the absence of a flag in the link partner ability register which would indicate that our link partner has acked us. This flag is listed as "reserved" in the Intel e1000 manual, but mii-tool uses it as LPA_LPACK from /usr/include/linux/mii.h. This patch adds read access to PHY_AUTONEG_EXP and defines the link partner ack flag, allowing mii-tool to generate output as normally expected: ens3: negotiated 1000baseT-FD flow-control, link ok Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Alexander Graf <agraf@suse.de> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/net/e1000.c')
-rw-r--r--hw/net/e1000.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 9c6af069aa..d6ef802ce9 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -176,6 +176,7 @@ e1000_link_down(E1000State *s)
s->mac_reg[STATUS] &= ~E1000_STATUS_LU;
s->phy_reg[PHY_STATUS] &= ~MII_SR_LINK_STATUS;
s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;
+ s->phy_reg[PHY_LP_ABILITY] &= ~MII_LPAR_LPACK;
}
static void
@@ -209,6 +210,7 @@ e1000_autoneg_timer(void *opaque)
E1000State *s = opaque;
if (!qemu_get_queue(s->nic)->link_down) {
e1000_link_up(s);
+ s->phy_reg[PHY_LP_ABILITY] |= MII_LPAR_LPACK;
s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
DBGOUT(PHY, "Auto negotiation is completed\n");
}
@@ -227,7 +229,8 @@ static const char phy_regcap[0x20] = {
[PHY_CTRL] = PHY_RW, [PHY_1000T_CTRL] = PHY_RW,
[PHY_LP_ABILITY] = PHY_R, [PHY_1000T_STATUS] = PHY_R,
[PHY_AUTONEG_ADV] = PHY_RW, [M88E1000_RX_ERR_CNTR] = PHY_R,
- [PHY_ID2] = PHY_R, [M88E1000_PHY_SPEC_STATUS] = PHY_R
+ [PHY_ID2] = PHY_R, [M88E1000_PHY_SPEC_STATUS] = PHY_R,
+ [PHY_AUTONEG_EXP] = PHY_R,
};
/* PHY_ID2 documented in 8254x_GBe_SDM.pdf, pp. 250 */