Hi,
Here is a small rewrite for consistency in vio_attach() error handling path,
also a fix for dmesg message "vlan2: initialized with non-standard mtu
1496 (parent vio0)",
while creating vlan
Index: if_vio.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_vio.c,v
retrieving revision 1.3
diff -u -r1.3 if_vio.c
--- sys/dev/pci/if_vio.c 31 Oct 2012 00:07:21 -0000 1.3
+++ sys/dev/pci/if_vio.c 6 Nov 2012 05:50:16 -0000
@@ -485,6 +485,7 @@
struct vio_softc *sc = (struct vio_softc *)self;
struct virtio_softc *vsc = (struct virtio_softc *)parent;
uint32_t features;
+ int i;
struct ifnet *ifp = &sc->sc_ac.ac_if;
if (vsc->sc_child != NULL) {
@@ -559,7 +560,7 @@
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_start = vio_start;
ifp->if_ioctl = vio_ioctl;
- ifp->if_capabilities = 0;
+ ifp->if_capabilities = IFCAP_VLAN_MTU;
IFQ_SET_MAXLEN(&ifp->if_snd, vsc->sc_vqs[1].vq_num - 1);
IFQ_SET_READY(&ifp->if_snd);
ifmedia_init(&sc->sc_media, 0, vio_media_change, vio_media_status);
@@ -575,18 +576,9 @@
return;
err:
- if (vsc->sc_nvqs == 3) {
- virtio_free_vq(vsc, &sc->sc_vq[2]);
- vsc->sc_nvqs = 2;
- }
- if (vsc->sc_nvqs == 2) {
- virtio_free_vq(vsc, &sc->sc_vq[1]);
- vsc->sc_nvqs = 1;
- }
- if (vsc->sc_nvqs == 1) {
- virtio_free_vq(vsc, &sc->sc_vq[0]);
- vsc->sc_nvqs = 0;
- }
+ for (i = 0; i < vsc->sc_nvqs; i++)
+ virtio_free_vq(vsc, &sc->sc_vq[i]);
+ vsc->sc_nvqs = 0;
vsc->sc_child = VIRTIO_CHILD_ERROR;
return;
}