Some fields in struct virtqueue are unused.
The maxsegsize argument to virtio_alloc_vq is unused.
OK bluhm@
-/* $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.
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;
}
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]);
-/* $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.
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;
}
-/* $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 <sf@sfritsch.de>
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;
}
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;
}
-/* $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 <jcs@openbsd.org>
/* 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;
}
-/* $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 $ */
/*
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++;
-/* $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 <sf@sfritsch.de>
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;
}
-/* $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.
*
}
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;
-/* $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 $ */
/*
*/
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;
-/* $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 $ */
/*
/* 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*);
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 *);