From: sf Date: Tue, 27 Aug 2024 18:44:12 +0000 (+0000) Subject: virtio: Remove some unused leftovers X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fdf28b391c259f3bfd9a0fbb6309196f51dc9635;p=openbsd virtio: Remove some unused leftovers Some fields in struct virtqueue are unused. The maxsegsize argument to virtio_alloc_vq is unused. OK bluhm@ --- diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c index ae805c6c78a..548c596ca63 100644 --- a/sys/dev/pv/if_vio.c +++ b/sys/dev/pv/if_vio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vio.c,v 1.48 2024/08/26 19:37:54 sf Exp $ */ +/* $OpenBSD: if_vio.c,v 1.49 2024/08/27 18:44:12 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. @@ -601,12 +601,11 @@ vio_attach(struct device *parent, struct device *self, void *aux) else ifp->if_hardmtu = MCLBYTES - sc->sc_hdr_size - ETHER_HDR_LEN; - if (virtio_alloc_vq(vsc, &sc->sc_vq[VQRX], 0, MCLBYTES, 2, "rx") != 0) + if (virtio_alloc_vq(vsc, &sc->sc_vq[VQRX], 0, 2, "rx") != 0) goto err; vsc->sc_nvqs = 1; sc->sc_vq[VQRX].vq_done = vio_rx_intr; if (virtio_alloc_vq(vsc, &sc->sc_vq[VQTX], 1, - sc->sc_hdr_size + ifp->if_hardmtu + ETHER_HDR_LEN, VIRTIO_NET_TX_MAXNSEGS + 1, "tx") != 0) { goto err; } @@ -618,7 +617,7 @@ vio_attach(struct device *parent, struct device *self, void *aux) else virtio_stop_vq_intr(vsc, &sc->sc_vq[VQTX]); if (virtio_has_feature(vsc, VIRTIO_NET_F_CTRL_VQ)) { - if (virtio_alloc_vq(vsc, &sc->sc_vq[VQCTL], 2, NBPG, 1, + if (virtio_alloc_vq(vsc, &sc->sc_vq[VQCTL], 2, 1, "control") == 0) { sc->sc_vq[VQCTL].vq_done = vio_ctrleof; virtio_start_vq_intr(vsc, &sc->sc_vq[VQCTL]); diff --git a/sys/dev/pv/vioblk.c b/sys/dev/pv/vioblk.c index 297d0b9aeea..153a2762170 100644 --- a/sys/dev/pv/vioblk.c +++ b/sys/dev/pv/vioblk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblk.c,v 1.42 2024/08/26 19:37:54 sf Exp $ */ +/* $OpenBSD: vioblk.c,v 1.43 2024/08/27 18:44:12 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch. @@ -208,8 +208,8 @@ vioblk_attach(struct device *parent, struct device *self, void *aux) sc->sc_capacity = virtio_read_device_config_8(vsc, VIRTIO_BLK_CONFIG_CAPACITY); - if (virtio_alloc_vq(vsc, &sc->sc_vq[0], 0, MAXPHYS, ALLOC_SEGS, - "I/O request") != 0) { + if (virtio_alloc_vq(vsc, &sc->sc_vq[0], 0, ALLOC_SEGS, "I/O request") + != 0) { printf("\nCan't alloc virtqueue\n"); goto err; } diff --git a/sys/dev/pv/viocon.c b/sys/dev/pv/viocon.c index 68e4155e678..681a842cd93 100644 --- a/sys/dev/pv/viocon.c +++ b/sys/dev/pv/viocon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viocon.c,v 1.14 2024/08/26 19:37:54 sf Exp $ */ +/* $OpenBSD: viocon.c,v 1.15 2024/08/27 18:44:12 sf Exp $ */ /* * Copyright (c) 2013-2015 Stefan Fritsch @@ -235,8 +235,7 @@ viocon_port_create(struct viocon_softc *sc, int portidx) txidx = rxidx + 1; snprintf(name, sizeof(name), "p%drx", portidx); - if (virtio_alloc_vq(vsc, &vsc->sc_vqs[rxidx], rxidx, BUFSIZE, 1, - name) != 0) { + if (virtio_alloc_vq(vsc, &vsc->sc_vqs[rxidx], rxidx, 1, name) != 0) { printf("\nCan't alloc %s virtqueue\n", name); goto err; } @@ -246,8 +245,7 @@ viocon_port_create(struct viocon_softc *sc, int portidx) DPRINTF("%s: rx: %p\n", __func__, vp->vp_rx); snprintf(name, sizeof(name), "p%dtx", portidx); - if (virtio_alloc_vq(vsc, &vsc->sc_vqs[txidx], txidx, BUFSIZE, 1, - name) != 0) { + if (virtio_alloc_vq(vsc, &vsc->sc_vqs[txidx], txidx, 1, name) != 0) { printf("\nCan't alloc %s virtqueue\n", name); goto err; } diff --git a/sys/dev/pv/viogpu.c b/sys/dev/pv/viogpu.c index 20e6afbac60..7f3be0954b9 100644 --- a/sys/dev/pv/viogpu.c +++ b/sys/dev/pv/viogpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viogpu.c,v 1.8 2024/08/26 19:37:54 sf Exp $ */ +/* $OpenBSD: viogpu.c,v 1.9 2024/08/27 18:44:12 sf Exp $ */ /* * Copyright (c) 2021-2023 joshua stein @@ -173,15 +173,13 @@ viogpu_attach(struct device *parent, struct device *self, void *aux) /* allocate command and cursor virtqueues */ vsc->sc_vqs = sc->sc_vqs; - if (virtio_alloc_vq(vsc, &sc->sc_vqs[VQCTRL], VQCTRL, NBPG, 1, - "control")) { + if (virtio_alloc_vq(vsc, &sc->sc_vqs[VQCTRL], VQCTRL, 1, "control")) { printf(": alloc_vq failed\n"); return; } sc->sc_vqs[VQCTRL].vq_done = viogpu_vq_done; - if (virtio_alloc_vq(vsc, &sc->sc_vqs[VQCURS], VQCURS, NBPG, 1, - "cursor")) { + if (virtio_alloc_vq(vsc, &sc->sc_vqs[VQCURS], VQCURS, 1, "cursor")) { printf(": alloc_vq failed\n"); return; } diff --git a/sys/dev/pv/viomb.c b/sys/dev/pv/viomb.c index 995968887d4..e8d16c58102 100644 --- a/sys/dev/pv/viomb.c +++ b/sys/dev/pv/viomb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viomb.c,v 1.11 2024/08/26 19:37:54 sf Exp $ */ +/* $OpenBSD: viomb.c,v 1.12 2024/08/27 18:44:12 sf Exp $ */ /* $NetBSD: viomb.c,v 1.1 2011/10/30 12:12:21 hannken Exp $ */ /* @@ -161,12 +161,12 @@ viomb_attach(struct device *parent, struct device *self, void *aux) if (virtio_negotiate_features(vsc, viomb_feature_names) != 0) goto err; - if ((virtio_alloc_vq(vsc, &sc->sc_vq[VQ_INFLATE], VQ_INFLATE, - sizeof(u_int32_t) * PGS_PER_REQ, 1, "inflate") != 0)) + if ((virtio_alloc_vq(vsc, &sc->sc_vq[VQ_INFLATE], VQ_INFLATE, 1, + "inflate") != 0)) goto err; vsc->sc_nvqs++; - if ((virtio_alloc_vq(vsc, &sc->sc_vq[VQ_DEFLATE], VQ_DEFLATE, - sizeof(u_int32_t) * PGS_PER_REQ, 1, "deflate") != 0)) + if ((virtio_alloc_vq(vsc, &sc->sc_vq[VQ_DEFLATE], VQ_DEFLATE, 1, + "deflate") != 0)) goto err; vsc->sc_nvqs++; diff --git a/sys/dev/pv/viornd.c b/sys/dev/pv/viornd.c index 67f6f380701..8139b4a6a27 100644 --- a/sys/dev/pv/viornd.c +++ b/sys/dev/pv/viornd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viornd.c,v 1.10 2024/08/26 19:37:54 sf Exp $ */ +/* $OpenBSD: viornd.c,v 1.11 2024/08/27 18:44:12 sf Exp $ */ /* * Copyright (c) 2014 Stefan Fritsch @@ -125,8 +125,7 @@ viornd_attach(struct device *parent, struct device *self, void *aux) goto err2; } - if (virtio_alloc_vq(vsc, &sc->sc_vq, 0, VIORND_BUFSIZE, 1, - "Entropy request") != 0) { + if (virtio_alloc_vq(vsc, &sc->sc_vq, 0, 1, "Entropy request") != 0) { printf(": Can't alloc virtqueue\n"); goto err2; } diff --git a/sys/dev/pv/vioscsi.c b/sys/dev/pv/vioscsi.c index 6eba242a420..41dbc113d0d 100644 --- a/sys/dev/pv/vioscsi.c +++ b/sys/dev/pv/vioscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioscsi.c,v 1.33 2024/08/26 19:37:54 sf Exp $ */ +/* $OpenBSD: vioscsi.c,v 1.34 2024/08/27 18:44:12 sf Exp $ */ /* * Copyright (c) 2013 Google Inc. * @@ -134,8 +134,8 @@ vioscsi_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < nitems(sc->sc_vqs); i++) { - rv = virtio_alloc_vq(vsc, &sc->sc_vqs[i], i, MAXPHYS, - ALLOC_SEGS, vioscsi_vq_names[i]); + rv = virtio_alloc_vq(vsc, &sc->sc_vqs[i], i, ALLOC_SEGS, + vioscsi_vq_names[i]); if (rv) { printf(": failed to allocate virtqueue %d\n", i); goto err; diff --git a/sys/dev/pv/virtio.c b/sys/dev/pv/virtio.c index 51725029fa8..394546ecf7f 100644 --- a/sys/dev/pv/virtio.c +++ b/sys/dev/pv/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.30 2024/08/13 08:47:28 sf Exp $ */ +/* $OpenBSD: virtio.c,v 1.31 2024/08/27 18:44:12 sf Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -329,7 +329,7 @@ virtio_init_vq(struct virtio_softc *sc, struct virtqueue *vq) */ int virtio_alloc_vq(struct virtio_softc *sc, struct virtqueue *vq, int index, - int maxsegsize, int maxnsegs, const char *name) + int maxnsegs, const char *name) { int vq_size, allocsize1, allocsize2, allocsize3, allocsize = 0; int rsegs, r, hdrlen; diff --git a/sys/dev/pv/virtiovar.h b/sys/dev/pv/virtiovar.h index 5dfe2ef4a91..c32fa17b9c0 100644 --- a/sys/dev/pv/virtiovar.h +++ b/sys/dev/pv/virtiovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: virtiovar.h,v 1.19 2024/08/26 19:37:54 sf Exp $ */ +/* $OpenBSD: virtiovar.h,v 1.20 2024/08/27 18:44:12 sf Exp $ */ /* $NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */ /* @@ -127,14 +127,11 @@ struct virtqueue { /* free entry management */ struct vq_entry *vq_entries; SLIST_HEAD(, vq_entry) vq_freelist; - struct mutex *vq_freelist_lock; /* enqueue/dequeue status */ uint16_t vq_avail_idx; uint16_t vq_used_idx; int vq_queued; - struct mutex *vq_aring_lock; - struct mutex *vq_uring_lock; /* interrupt handler */ int (*vq_done)(struct virtqueue*); @@ -216,7 +213,7 @@ virtio_has_feature(struct virtio_softc *sc, uint64_t fbit) return 0; } -int virtio_alloc_vq(struct virtio_softc*, struct virtqueue*, int, int, int, +int virtio_alloc_vq(struct virtio_softc*, struct virtqueue*, int, int, const char*); int virtio_free_vq(struct virtio_softc*, struct virtqueue*); void virtio_reset(struct virtio_softc *);