Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Fix dmamap_syncs more; the number of ring elemen...



details:   https://anonhg.NetBSD.org/src/rev/2c7d132b654d
branches:  trunk
changeset: 372855:2c7d132b654d
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Dec 30 21:38:13 2022 +0000

description:
Fix dmamap_syncs more; the number of ring elements is vq->vq_num, not
sc->sc_nvqs.

diffstat:

 sys/dev/pci/virtio.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r eaa5e20a62ae -r 2c7d132b654d sys/dev/pci/virtio.c
--- a/sys/dev/pci/virtio.c      Fri Dec 30 21:12:44 2022 +0000
+++ b/sys/dev/pci/virtio.c      Fri Dec 30 21:38:13 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtio.c,v 1.63 2022/10/31 13:00:34 simonb Exp $       */
+/*     $NetBSD: virtio.c,v 1.64 2022/12/30 21:38:13 jakllsch Exp $     */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.63 2022/10/31 13:00:34 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.64 2022/12/30 21:38:13 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -450,7 +450,7 @@
 vq_sync_aring_all(struct virtio_softc *sc, struct virtqueue *vq, int ops)
 {
        uint16_t hdrlen = offsetof(struct vring_avail, ring);
-       size_t payloadlen = sc->sc_nvqs * sizeof(uint16_t);
+       size_t payloadlen = vq->vq_num * sizeof(uint16_t);
        size_t usedlen = 0;
 
        if (sc->sc_active_features & VIRTIO_F_RING_EVENT_IDX)
@@ -472,7 +472,7 @@
 vq_sync_aring_payload(struct virtio_softc *sc, struct virtqueue *vq, int ops)
 {
        uint16_t hdrlen = offsetof(struct vring_avail, ring);
-       size_t payloadlen = sc->sc_nvqs * sizeof(uint16_t);
+       size_t payloadlen = vq->vq_num * sizeof(uint16_t);
 
        bus_dmamap_sync(sc->sc_dmat, vq->vq_dmamap,
            vq->vq_availoffset + hdrlen, payloadlen, ops);
@@ -482,7 +482,7 @@
 vq_sync_aring_used(struct virtio_softc *sc, struct virtqueue *vq, int ops)
 {
        uint16_t hdrlen = offsetof(struct vring_avail, ring);
-       size_t payloadlen = sc->sc_nvqs * sizeof(uint16_t);
+       size_t payloadlen = vq->vq_num * sizeof(uint16_t);
        size_t usedlen = sizeof(uint16_t);
 
        if ((sc->sc_active_features & VIRTIO_F_RING_EVENT_IDX) == 0)
@@ -495,7 +495,7 @@
 vq_sync_uring_all(struct virtio_softc *sc, struct virtqueue *vq, int ops)
 {
        uint16_t hdrlen = offsetof(struct vring_used, ring);
-       size_t payloadlen = sc->sc_nvqs * sizeof(struct vring_used_elem);
+       size_t payloadlen = vq->vq_num * sizeof(struct vring_used_elem);
        size_t availlen = 0;
 
        if (sc->sc_active_features & VIRTIO_F_RING_EVENT_IDX)
@@ -517,7 +517,7 @@
 vq_sync_uring_payload(struct virtio_softc *sc, struct virtqueue *vq, int ops)
 {
        uint16_t hdrlen = offsetof(struct vring_used, ring);
-       size_t payloadlen = sc->sc_nvqs * sizeof(struct vring_used_elem);
+       size_t payloadlen = vq->vq_num * sizeof(struct vring_used_elem);
 
        bus_dmamap_sync(sc->sc_dmat, vq->vq_dmamap,
            vq->vq_usedoffset + hdrlen, payloadlen, ops);
@@ -527,7 +527,7 @@
 vq_sync_uring_avail(struct virtio_softc *sc, struct virtqueue *vq, int ops)
 {
        uint16_t hdrlen = offsetof(struct vring_used, ring);
-       size_t payloadlen = sc->sc_nvqs * sizeof(struct vring_used_elem);
+       size_t payloadlen = vq->vq_num * sizeof(struct vring_used_elem);
        size_t availlen = sizeof(uint16_t);
 
        if ((sc->sc_active_features & VIRTIO_F_RING_EVENT_IDX) == 0)



Home | Main Index | Thread Index | Old Index