qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 for 2.0] virtio-net: add vlan receive state t


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 for 2.0] virtio-net: add vlan receive state to RxFilterInfo
Date: Tue, 25 Mar 2014 10:24:33 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 03/25/2014 09:40 AM, Amos Kong wrote:
> Stefan Fritsch just fixed a virtio-net driver bug [1], virtio-net won't
> filter out VLAN-tagged packets if VIRTIO_NET_F_CTRL_VLAN isn't negotiated.
> 
> This patch added a new field to @RxFilterInfo to indicate vlan receive
> state ('normal', 'none', 'all'). If VIRTIO_NET_F_CTRL_VLAN isn't
> negotiated, vlan receive state will be 'all', then all VLAN-tagged packets
> will be received by guest.
> 
> [1] http://lists.nongnu.org/archive/html/qemu-devel/2014-02/msg02604.html
> 
> Signed-off-by: Amos Kong <address@hidden>
> ---
> V2: don't make vlan-table optional, add a flag to indicate
>     if vlan table is used by management
> V3: change the new filed to RxState
> ---
>  hw/net/virtio-net.c | 42 +++++++++++++++++++++++++++++-------------
>  qapi-schema.json    |  3 +++
>  qmp-commands.hx     |  2 ++
>  3 files changed, 34 insertions(+), 13 deletions(-)

Reviewed-by: Eric Blake <address@hidden>


> +
> +    list = NULL;
> +    for (i = 0; i < MAX_VLAN >> 5; i++) {
> +        for (j = 0; n->vlans[i] && j < 0x1f; j++) {

Pre-existing, but isn't this an off-by-one?  That is, don't you also
want the iteration for j==0x1f?  Or are there really only 31 instead of
32 vlan maps?

> -    int_list = NULL;
> -    for (i = 0; i < MAX_VLAN >> 5; i++) {
> -        for (j = 0; n->vlans[i] && j < 0x1f; j++) {
> -            if (n->vlans[i] & (1U << j)) {
> -                int_entry = g_malloc0(sizeof(*int_entry));
> -                int_entry->value = (i << 5) + j;


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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