[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/23] e1000: improve auto-negotiation reporting via
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 08/23] e1000: improve auto-negotiation reporting via mii-tool |
Date: |
Mon, 23 Jun 2014 18:53:29 +0300 |
From: "Gabriel L. Somlo" <address@hidden>
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 <address@hidden>
Reviewed-by: Alexander Graf <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/net/e1000_regs.h | 3 +++
hw/net/e1000.c | 5 ++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/hw/net/e1000_regs.h b/hw/net/e1000_regs.h
index 13ac671..60b96aa 100644
--- a/hw/net/e1000_regs.h
+++ b/hw/net/e1000_regs.h
@@ -384,6 +384,9 @@
#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */
#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */
+/* PHY Link Partner Ability Register */
+#define MII_LPAR_LPACK 0x4000 /* Acked by link partner */
+
/* Interrupt Cause Read */
#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */
#define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 9c6af06..d6ef802 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 */
--
MST
- [Qemu-devel] [PULL 00/23] pc,pci,vhost,net fixes, enhancements, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 01/23] vhost: block migration if backend does not log memory, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 02/23] vhost: fix resource leak in error handling, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 03/23] qapi/hmp: use 'backend' instead of 'device' with memory backend, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 04/23] libqemustub: add more stubs for qemu-char, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 05/23] qtest: fix qtest for vhost-user, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 06/23] qtest: fix vhost-user-test unbalanced mutex locks, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 08/23] e1000: improve auto-negotiation reporting via mii-tool,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 07/23] e1000: emulate auto-negotiation during external link status change, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 09/23] e1000: signal guest on successful link auto-negotiation, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 10/23] e1000: move e1000_autoneg_timer() to after set_ics(), Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 11/23] e1000: factor out checking for auto-negotiation availability, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 13/23] qemu-char: fix qemu_chr_fe_get_msgfd(), Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 12/23] qapi/string-output-visitor: fix human output, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 14/23] qemu-char: avoid leaking unused fds in tcp_get_msgfds(), Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 15/23] virtio-pci: Report an error when msix vectors init fails, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 16/23] q35: Use PC_Q35_COMPAT_1_4 on pc-q35-1.4 compat_props, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 17/23] hw/pcie: correct debug message, Michael S. Tsirkin, 2014/06/23