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: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v3] rtl8139: implement 8139cp link status
Date: Fri, 14 Sep 2012 10:36:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

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



reply via email to

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