qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_


From: Stefan Fritsch
Subject: Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN
Date: Mon, 17 Feb 2014 22:31:05 +0100 (CET)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

On Sun, 16 Feb 2014, Michael S. Tsirkin wrote:

> On Wed, Feb 12, 2014 at 10:46:28PM +0100, Stefan Fritsch wrote:
> > If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all
> > VLAN-tagged packets but send them to the guest.
> > 
> > Signed-off-by: Stefan Fritsch <address@hidden>
> 
> Thanks for the patch.
> I think there are still some issues after this
> patch: we need to notify management when
> this bit state changes.
> And I think libvirt still does not look at the filter info
> so it's probably not too late, and cleaner to simply tell it:
> "all-vlans".
> that is, add
>     '*vlan':          'RxState',
> to the schema.

I am not familiar with these interfaces and can't comment on that.

> > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > index 3626608..0ae9a91 100644
> > --- a/hw/net/virtio-net.c
> > +++ b/hw/net/virtio-net.c
> > @@ -315,7 +315,11 @@ static void virtio_net_reset(VirtIODevice *vdev)
> >      memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
> >      memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
> >      qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
> > -    memset(n->vlans, 0, MAX_VLAN >> 3);
> > +    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
> > +        memset(n->vlans, 0, MAX_VLAN >> 3);
> > +    } else {
> > +        memset(n->vlans, 0xff, MAX_VLAN >> 3);
> > +    }
> >  }
> >  
> >  static void peer_test_vnet_hdr(VirtIONet *n)
> 
> This chunk doesn't make sense to me.
> features are never set at reset, are they?

You are right. This chunk is not necessary. I have checked that the second 
chunk alone fixes the issue.

> > @@ -515,6 +519,12 @@ static void virtio_net_set_features(VirtIODevice 
> > *vdev, uint32_t features)
> >          }
> >          vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
> >      }
> > +
> > +    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
> > +        memset(n->vlans, 0, MAX_VLAN >> 3);
> > +    } else {
> > +        memset(n->vlans, 0xff, MAX_VLAN >> 3);
> > +    }
> >  }
> >  
> >  static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
> > -- 
> > 1.7.10.4
> 

Cheers,
Stefan




reply via email to

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