qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3] rtl8139: implement 8139cp link status


From: Amos Kong
Subject: Re: [Qemu-devel] [PATCH v3] rtl8139: implement 8139cp link status
Date: Fri, 14 Sep 2012 17:20:24 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

On 14/09/12 16:36, Paolo Bonzini wrote:
Il 14/09/2012 04:16, Amos Kong ha scritto:
+            /* The LinkDown bit of MediaStatus is inverse with link status */
+            ret = 0xd0 | (s->nic->nc.link_down ? MSR_LinkDown : 0);
              DPRINTF("MediaStatus read 0x%x\n", ret);
              break;

@@ -3453,12 +3466,27 @@ static void pci_rtl8139_uninit(PCIDevice *dev)
      qemu_del_net_client(&s->nic->nc);
  }

+static void rtl8139_set_link_status(NetClientState *nc)
+{
+    RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque;
+
+    if (nc->link_down) {
+        s->BasicModeStatus &= ~0x0004;
+    } else {
+        s->BasicModeStatus |= 0x0004;
+    }
+
+    s->IntrStatus |= RxUnderrun;
+    rtl8139_update_irq(s);
+}
+

Actually, this is worse than v2 because then one bit is migrated and the
other is not.

I think v2 is correct and, on top of it, you have to check in post_load
whether nc->link_down matches the loaded BMSR value.  If not, you need
to either set the link status in NetClientState, or generate an
RxUnderrun interrupt.


If correct link_down in rtl8139_post_load(), both v2 and v3 will work.

  s->nic->nc.link_down = (s->BasicModeStatus & 0x04) == 0;

s->BasicModeStatus is really migrated, s->nic->nc.link_down is inferred.
so I will continually work on v2.


An alternative is to add a get_link_status callback and call it after
migration for all NIC NetClientStates.

Paolo

Thanks.

--
                        Amos.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]