qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] hub: change hub can_receive() strategy


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 2/2] hub: change hub can_receive() strategy
Date: Fri, 24 Aug 2012 11:11:24 +0100

On Fri, Aug 24, 2012 at 9:33 AM, Rongqing Li <address@hidden> wrote:
>
>
> On 2012年08月24日 16:20, Paolo Bonzini wrote:
>>
>> A link-down NIC should always return 1 from can_receive (and will drop
>> the packet).  Is that the real bug here?
>>
>
> A link-down NIC always return 0 from can_receive.
>
> Yes, it is a bug.

The code says something different.  link_down isn't taken into account
by netc.:qemu_can_send_packet():

int qemu_can_send_packet(NetClientState *sender)
{
    if (!sender->peer) {
        return 1;
    }

    if (sender->peer->receive_disabled) {
        return 0;
    } else if (sender->peer->info->can_receive &&
               !sender->peer->info->can_receive(sender->peer)) {
        return 0;
    }
    return 1;
}

If the net client has no ->can_receive then we return 1.  Otherwise we
return ->can_receive().

Were you thinking of a specific NIC where .can_receive() returns 0
when link_down=1?

Stefan



reply via email to

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