diff options
author | Stefan Fritsch <sf@cvs.openbsd.org> | 2014-06-17 19:46:14 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@cvs.openbsd.org> | 2014-06-17 19:46:14 +0000 |
commit | f4c68172f3b2828addbb88ac963fa0fb50ebd5d2 (patch) | |
tree | f12d89b49fd79c97216d4410b93f90cf20b9aae7 | |
parent | 77ca4df22e358968cafd9df95d888acd06baff12 (diff) |
Add a configurable workaround for a bug in qemu < 2.0 that prevented VLANs
from working.
-rw-r--r-- | share/man/man4/vio.4 | 16 | ||||
-rw-r--r-- | sys/dev/pci/if_vio.c | 12 |
2 files changed, 19 insertions, 9 deletions
diff --git a/share/man/man4/vio.4 b/share/man/man4/vio.4 index a1c14d7aaa6..a4135d5fb92 100644 --- a/share/man/man4/vio.4 +++ b/share/man/man4/vio.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: vio.4,v 1.10 2014/05/09 14:44:56 sf Exp $ +.\" $OpenBSD: vio.4,v 1.11 2014/06/17 19:46:13 sf Exp $ .\" .\" Copyright (c) 2012 Stefan Fritsch <sf@sfritsch.de> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 9 2014 $ +.Dd $Mdocdate: June 17 2014 $ .Dt VIO 4 .Os .Sh NAME @@ -29,10 +29,15 @@ driver provides support for the .Xr virtio 4 network interface provided by bhyve, KVM, QEMU, and VirtualBox. .Pp -Setting flags to 0x02 disables the RingEventIndex feature. +Setting the bit 0x2 in the flags disables the RingEventIndex feature. This can be tried as a workaround for possible bugs in host implementations or .Nm at the cost of slightly reduced performance. +.Pp +Setting the bit 0x100 in the flags forces the interface to be always in +promiscous mode. +This can be used as a workaround for a bug in QEMU before version 2.0 that +prevents packets with a VLAN tag to be sent to the guest. .Sh SEE ALSO .Xr intro 4 , .Xr virtio 4 @@ -54,8 +59,3 @@ It is based on the .Nm vioif driver by .An Minoura Makoto . -.Sh BUGS -Due to a qemu bug, VLANs don't work with qemu versions before 2.0 unless the -interface is in promiscuous mode. -.Nm -should probably implement a workaround for this. diff --git a/sys/dev/pci/if_vio.c b/sys/dev/pci/if_vio.c index cd6d419b834..3621489679b 100644 --- a/sys/dev/pci/if_vio.c +++ b/sys/dev/pci/if_vio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vio.c,v 1.15 2014/01/19 20:49:02 bluhm Exp $ */ +/* $OpenBSD: if_vio.c,v 1.16 2014/06/17 19:46:13 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. @@ -91,6 +91,13 @@ #define VIRTIO_NET_F_CTRL_RX_EXTRA (1<<20) #define VIRTIO_NET_F_GUEST_ANNOUNCE (1<<21) +/* + * Config(8) flags. The lowest byte is reserved for generic virtio stuff. + */ + +/* Workaround for vlan related bug in qemu < version 2.0 */ +#define CONFFLAG_QEMU_VLAN_BUG (1<<8) + static const struct virtio_feature_name virtio_net_feature_names[] = { { VIRTIO_NET_F_CSUM, "CSum" }, { VIRTIO_NET_F_GUEST_CSUM, "GuestCSum" }, @@ -1395,6 +1402,9 @@ vio_iff(struct vio_softc *sc) return; } + if (sc->sc_dev.dv_cfdata->cf_flags & CONFFLAG_QEMU_VLAN_BUG) + ifp->if_flags |= IFF_PROMISC; + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0 || ac->ac_multicnt >= VIRTIO_NET_CTRL_MAC_MC_ENTRIES) { ifp->if_flags |= IFF_ALLMULTI; |