From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRNr-00078C-Tt for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:36:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCRNm-0005Yp-0j for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:36:19 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:45154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRNl-0005XA-Qy for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:36:13 -0400 Received: by pbbrp12 with SMTP id rp12so5521323pbb.4 for ; Fri, 14 Sep 2012 01:36:12 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5052EC74.7000803@redhat.com> Date: Fri, 14 Sep 2012 10:36:04 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <504DA1A9.2000908@redhat.com> <1347588966-20350-1-git-send-email-akong@redhat.com> In-Reply-To: <1347588966-20350-1-git-send-email-akong@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] rtl8139: implement 8139cp link status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: jasowang@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com, mst@redhat.com 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. An alternative is to add a get_link_status callback and call it after migration for all NIC NetClientStates. Paolo