All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes
@ 2014-06-19 15:55 Gabriel L. Somlo
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 1/4] e1000: emulate auto-negotiation during external link status change Gabriel L. Somlo
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Gabriel L. Somlo @ 2014-06-19 15:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: romain, mst, agraf, stefanha, pbonzini, afaerber

New in v2:

  - checking for E1000_FLAG_AUTONEG in s->compat_flags when deciding
    whether to run the auto-negotiation timer vs. simply forcing the
    link up during e1000_set_link_status()

  - grouped E1000_FLAG_AUTONEG check in s->compat_flags tighter with
    the rest of the auto-negotiation checks in the two other locations
    they appear in the source code (hopefully improving clarity).

  - added patch to move the auto-negotiation timer function past set_ics()
    to avoid the need for a forward declaration.


This series contains a few fixes and improvements in the emulation
of link auto-negotiation:

  - use auto-negotiation when the link is bounced externally (e.g. via
    set_link <foo> down/up on the qemu monitor command line).

  - allow mii_tool on linux access to all the phy registers and flags
    it requires in order to report a successfully auto-negotiated link.

  - inject LSC interrupt upon successful link auto-negotiation (required
    by stock OS X e1000 driver).

Gabriel L. Somlo (4):
  e1000: emulate auto-negotiation during external link status change
  e1000: improve auto-negotiation reporting via mii-tool
  e1000: move e1000_autoneg_timer() to after set_ics()
  e1000: signal guest on successful link auto-negotiation

 hw/net/e1000.c      | 59 ++++++++++++++++++++++++++++++-----------------------
 hw/net/e1000_regs.h |  3 +++
 2 files changed, 36 insertions(+), 26 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v2 1/4] e1000: emulate auto-negotiation during external link status change
  2014-06-19 15:55 [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Gabriel L. Somlo
@ 2014-06-19 15:55 ` Gabriel L. Somlo
  2014-06-19 16:26   ` Michael S. Tsirkin
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 2/4] e1000: improve auto-negotiation reporting via mii-tool Gabriel L. Somlo
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Gabriel L. Somlo @ 2014-06-19 15:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: romain, mst, agraf, stefanha, pbonzini, afaerber

This patch emulates auto-negotiation when the network link status
is modified externally (i.e. via "set_link <id> off/on").

Also, a couple of cleanup items:
  - unset PHY status reg. AUTONEG_COMPLETE during link_down()
  - set PHY status reg. AUTONEG_COMPLETE during autoneg_timer() only
    if we actually brought the link up.
  - group all checks for "can we, and should we autonegotiate?"
    together for more clarity.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/net/e1000.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 57bdffd..9c6af06 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -175,6 +175,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;
 }
 
 static void
@@ -197,7 +198,6 @@ set_phy_ctrl(E1000State *s, int index, uint16_t val)
     }
     if ((val & MII_CR_AUTO_NEG_EN) && (val & MII_CR_RESTART_AUTO_NEG)) {
         e1000_link_down(s);
-        s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;
         DBGOUT(PHY, "Start link auto negotiation\n");
         timer_mod(s->autoneg_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
     }
@@ -209,9 +209,9 @@ e1000_autoneg_timer(void *opaque)
     E1000State *s = opaque;
     if (!qemu_get_queue(s->nic)->link_down) {
         e1000_link_up(s);
+        s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
+        DBGOUT(PHY, "Auto negotiation is completed\n");
     }
-    s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
-    DBGOUT(PHY, "Auto negotiation is completed\n");
 }
 
 static void (*phyreg_writeops[])(E1000State *, int, uint16_t) = {
@@ -853,7 +853,16 @@ e1000_set_link_status(NetClientState *nc)
     if (nc->link_down) {
         e1000_link_down(s);
     } else {
-        e1000_link_up(s);
+        if (s->compat_flags & E1000_FLAG_AUTONEG &&
+            s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
+            s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&
+            !(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {
+            /* emulate auto-negotiation if supported */
+            timer_mod(s->autoneg_timer,
+                      qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
+        } else {
+            e1000_link_up(s);
+        }
     }
 
     if (s->mac_reg[STATUS] != old_status)
@@ -1279,16 +1288,13 @@ static void e1000_pre_save(void *opaque)
         e1000_mit_timer(s);
     }
 
-    if (!(s->compat_flags & E1000_FLAG_AUTONEG)) {
-        return;
-    }
-
     /*
-     * If link is down and auto-negotiation is ongoing, complete
-     * auto-negotiation immediately.  This allows is to look at
-     * MII_SR_AUTONEG_COMPLETE to infer link status on load.
+     * If link is down and auto-negotiation is supported and ongoing,
+     * complete auto-negotiation immediately. This allows us to look
+     * at MII_SR_AUTONEG_COMPLETE to infer link status on load.
      */
     if (nc->link_down &&
+        s->compat_flags & E1000_FLAG_AUTONEG &&
         s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
         s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG) {
          s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
@@ -1313,11 +1319,8 @@ static int e1000_post_load(void *opaque, int version_id)
      * Alternatively, restart link negotiation if it was in progress. */
     nc->link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0;
 
-    if (!(s->compat_flags & E1000_FLAG_AUTONEG)) {
-        return 0;
-    }
-
-    if (s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
+    if (s->compat_flags & E1000_FLAG_AUTONEG &&
+        s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
         s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&
         !(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {
         nc->link_down = false;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v2 2/4] e1000: improve auto-negotiation reporting via mii-tool
  2014-06-19 15:55 [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Gabriel L. Somlo
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 1/4] e1000: emulate auto-negotiation during external link status change Gabriel L. Somlo
@ 2014-06-19 15:55 ` Gabriel L. Somlo
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 3/4] e1000: move e1000_autoneg_timer() to after set_ics() Gabriel L. Somlo
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Gabriel L. Somlo @ 2014-06-19 15:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: romain, mst, agraf, stefanha, pbonzini, afaerber

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>
---
 hw/net/e1000.c      | 5 ++++-
 hw/net/e1000_regs.h | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

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 */
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 */
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v2 3/4] e1000: move e1000_autoneg_timer() to after set_ics()
  2014-06-19 15:55 [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Gabriel L. Somlo
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 1/4] e1000: emulate auto-negotiation during external link status change Gabriel L. Somlo
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 2/4] e1000: improve auto-negotiation reporting via mii-tool Gabriel L. Somlo
@ 2014-06-19 15:55 ` Gabriel L. Somlo
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 4/4] e1000: signal guest on successful link auto-negotiation Gabriel L. Somlo
  2014-06-19 16:29 ` [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Michael S. Tsirkin
  4 siblings, 0 replies; 7+ messages in thread
From: Gabriel L. Somlo @ 2014-06-19 15:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: romain, mst, agraf, stefanha, pbonzini, afaerber

Enable calling set_ics() from within e1000_autoneg_timer() without
the need for a forward declaration.

This patch contains no functional changes.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
---
 hw/net/e1000.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index d6ef802..fd9b9be 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -204,18 +204,6 @@ set_phy_ctrl(E1000State *s, int index, uint16_t val)
     }
 }
 
-static void
-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");
-    }
-}
-
 static void (*phyreg_writeops[])(E1000State *, int, uint16_t) = {
     [PHY_CTRL] = set_phy_ctrl,
 };
@@ -347,6 +335,18 @@ set_ics(E1000State *s, int index, uint32_t val)
     set_interrupt_cause(s, 0, val | s->mac_reg[ICR]);
 }
 
+static void
+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");
+    }
+}
+
 static int
 rxbufsize(uint32_t v)
 {
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v2 4/4] e1000: signal guest on successful link auto-negotiation
  2014-06-19 15:55 [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Gabriel L. Somlo
                   ` (2 preceding siblings ...)
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 3/4] e1000: move e1000_autoneg_timer() to after set_ics() Gabriel L. Somlo
@ 2014-06-19 15:55 ` Gabriel L. Somlo
  2014-06-19 16:29 ` [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Michael S. Tsirkin
  4 siblings, 0 replies; 7+ messages in thread
From: Gabriel L. Somlo @ 2014-06-19 15:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: romain, mst, agraf, stefanha, pbonzini, afaerber

Generate a link status change interrupt once link auto-netotiation
is successfully completed. This does not affect Linux and Windows
(XP and 7 tested) in any way, but is needed by the stock OS X driver
(AppleIntel8254XEthernet.kext), which would otherwise fail to notice
the link status change event.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/net/e1000.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index fd9b9be..8ee5225 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -344,6 +344,7 @@ e1000_autoneg_timer(void *opaque)
         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");
+        set_ics(s, 0, E1000_ICS_LSC); /* signal link status change to guest */
     }
 }
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/4] e1000: emulate auto-negotiation during external link status change
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 1/4] e1000: emulate auto-negotiation during external link status change Gabriel L. Somlo
@ 2014-06-19 16:26   ` Michael S. Tsirkin
  0 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-19 16:26 UTC (permalink / raw)
  To: Gabriel L. Somlo; +Cc: romain, agraf, qemu-devel, stefanha, pbonzini, afaerber

On Thu, Jun 19, 2014 at 11:55:33AM -0400, Gabriel L. Somlo wrote:
> This patch emulates auto-negotiation when the network link status
> is modified externally (i.e. via "set_link <id> off/on").
> 
> Also, a couple of cleanup items:
>   - unset PHY status reg. AUTONEG_COMPLETE during link_down()
>   - set PHY status reg. AUTONEG_COMPLETE during autoneg_timer() only
>     if we actually brought the link up.
>   - group all checks for "can we, and should we autonegotiate?"
>     together for more clarity.
> 
> Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
> Reviewed-by: Alexander Graf <agraf@suse.de>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Now you did this cleanup, let's have a function
to check autonegotiation in a single place.

Can be patch on top.

> ---
>  hw/net/e1000.c | 35 +++++++++++++++++++----------------
>  1 file changed, 19 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/net/e1000.c b/hw/net/e1000.c
> index 57bdffd..9c6af06 100644
> --- a/hw/net/e1000.c
> +++ b/hw/net/e1000.c
> @@ -175,6 +175,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;
>  }
>  
>  static void
> @@ -197,7 +198,6 @@ set_phy_ctrl(E1000State *s, int index, uint16_t val)
>      }
>      if ((val & MII_CR_AUTO_NEG_EN) && (val & MII_CR_RESTART_AUTO_NEG)) {
>          e1000_link_down(s);
> -        s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;
>          DBGOUT(PHY, "Start link auto negotiation\n");
>          timer_mod(s->autoneg_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
>      }
> @@ -209,9 +209,9 @@ e1000_autoneg_timer(void *opaque)
>      E1000State *s = opaque;
>      if (!qemu_get_queue(s->nic)->link_down) {
>          e1000_link_up(s);
> +        s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
> +        DBGOUT(PHY, "Auto negotiation is completed\n");
>      }
> -    s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
> -    DBGOUT(PHY, "Auto negotiation is completed\n");
>  }
>  
>  static void (*phyreg_writeops[])(E1000State *, int, uint16_t) = {
> @@ -853,7 +853,16 @@ e1000_set_link_status(NetClientState *nc)
>      if (nc->link_down) {
>          e1000_link_down(s);
>      } else {
> -        e1000_link_up(s);
> +        if (s->compat_flags & E1000_FLAG_AUTONEG &&
> +            s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
> +            s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&
> +            !(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {
> +            /* emulate auto-negotiation if supported */
> +            timer_mod(s->autoneg_timer,
> +                      qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
> +        } else {
> +            e1000_link_up(s);
> +        }
>      }
>  
>      if (s->mac_reg[STATUS] != old_status)
> @@ -1279,16 +1288,13 @@ static void e1000_pre_save(void *opaque)
>          e1000_mit_timer(s);
>      }
>  
> -    if (!(s->compat_flags & E1000_FLAG_AUTONEG)) {
> -        return;
> -    }
> -
>      /*
> -     * If link is down and auto-negotiation is ongoing, complete
> -     * auto-negotiation immediately.  This allows is to look at
> -     * MII_SR_AUTONEG_COMPLETE to infer link status on load.
> +     * If link is down and auto-negotiation is supported and ongoing,
> +     * complete auto-negotiation immediately. This allows us to look
> +     * at MII_SR_AUTONEG_COMPLETE to infer link status on load.
>       */
>      if (nc->link_down &&
> +        s->compat_flags & E1000_FLAG_AUTONEG &&
>          s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
>          s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG) {
>           s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
> @@ -1313,11 +1319,8 @@ static int e1000_post_load(void *opaque, int version_id)
>       * Alternatively, restart link negotiation if it was in progress. */
>      nc->link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0;
>  
> -    if (!(s->compat_flags & E1000_FLAG_AUTONEG)) {
> -        return 0;
> -    }
> -
> -    if (s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
> +    if (s->compat_flags & E1000_FLAG_AUTONEG &&
> +        s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
>          s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&
>          !(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {
>          nc->link_down = false;
> -- 
> 1.9.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes
  2014-06-19 15:55 [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Gabriel L. Somlo
                   ` (3 preceding siblings ...)
  2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 4/4] e1000: signal guest on successful link auto-negotiation Gabriel L. Somlo
@ 2014-06-19 16:29 ` Michael S. Tsirkin
  4 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-19 16:29 UTC (permalink / raw)
  To: Gabriel L. Somlo; +Cc: romain, agraf, qemu-devel, stefanha, pbonzini, afaerber

On Thu, Jun 19, 2014 at 11:55:32AM -0400, Gabriel L. Somlo wrote:
> New in v2:
> 
>   - checking for E1000_FLAG_AUTONEG in s->compat_flags when deciding
>     whether to run the auto-negotiation timer vs. simply forcing the
>     link up during e1000_set_link_status()
> 
>   - grouped E1000_FLAG_AUTONEG check in s->compat_flags tighter with
>     the rest of the auto-negotiation checks in the two other locations
>     they appear in the source code (hopefully improving clarity).
> 
>   - added patch to move the auto-negotiation timer function past set_ics()
>     to avoid the need for a forward declaration.
> 


Applied, thanks everyone.

> This series contains a few fixes and improvements in the emulation
> of link auto-negotiation:
> 
>   - use auto-negotiation when the link is bounced externally (e.g. via
>     set_link <foo> down/up on the qemu monitor command line).
> 
>   - allow mii_tool on linux access to all the phy registers and flags
>     it requires in order to report a successfully auto-negotiated link.
> 
>   - inject LSC interrupt upon successful link auto-negotiation (required
>     by stock OS X e1000 driver).
> 
> Gabriel L. Somlo (4):
>   e1000: emulate auto-negotiation during external link status change
>   e1000: improve auto-negotiation reporting via mii-tool
>   e1000: move e1000_autoneg_timer() to after set_ics()
>   e1000: signal guest on successful link auto-negotiation
> 
>  hw/net/e1000.c      | 59 ++++++++++++++++++++++++++++++-----------------------
>  hw/net/e1000_regs.h |  3 +++
>  2 files changed, 36 insertions(+), 26 deletions(-)
> 
> -- 
> 1.9.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-19 16:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-19 15:55 [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Gabriel L. Somlo
2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 1/4] e1000: emulate auto-negotiation during external link status change Gabriel L. Somlo
2014-06-19 16:26   ` Michael S. Tsirkin
2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 2/4] e1000: improve auto-negotiation reporting via mii-tool Gabriel L. Somlo
2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 3/4] e1000: move e1000_autoneg_timer() to after set_ics() Gabriel L. Somlo
2014-06-19 15:55 ` [Qemu-devel] [PATCH v2 4/4] e1000: signal guest on successful link auto-negotiation Gabriel L. Somlo
2014-06-19 16:29 ` [Qemu-devel] [PATCH v2 0/4] e1000: link auto-negotiation fixes Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.