diff options
author | Stefan Fritsch <sf@cvs.openbsd.org> | 2012-11-10 18:53:33 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@cvs.openbsd.org> | 2012-11-10 18:53:33 +0000 |
commit | a134f8876ab88404aad8a25ef4a6566f88701455 (patch) | |
tree | a54541dcb80fc03d8a48fc5fc0609ce295b939ee | |
parent | 8e990b45f5ab1002d46a25205d1619aab29f365b (diff) |
Simplify error handling, add IFCAP_VLAN_MTU
Patch by Dinar Talypov t.dinar.m AT gmail.com
OK claudio@, mikeb@
-rw-r--r-- | sys/dev/pci/if_vio.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/sys/dev/pci/if_vio.c b/sys/dev/pci/if_vio.c index 2f94db72fea..9dbeef56b07 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.3 2012/10/31 00:07:21 brad Exp $ */ +/* $OpenBSD: if_vio.c,v 1.4 2012/11/10 18:53:32 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. @@ -485,6 +485,7 @@ vio_attach(struct device *parent, struct device *self, void *aux) 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 @@ vio_attach(struct device *parent, struct device *self, void *aux) 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 @@ vio_attach(struct device *parent, struct device *self, void *aux) 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; } |