Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Register an interrupt handler for virtqueue to t...



details:   https://anonhg.NetBSD.org/src/rev/c5979bea1383
branches:  trunk
changeset: 933346:c5979bea1383
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Mon May 25 07:37:47 2020 +0000

description:
Register an interrupt handler for virtqueue to that for pci
to reduce function call

diffstat:

 sys/dev/pci/virtio.c     |   7 ++++---
 sys/dev/pci/virtio_pci.c |  19 +++++--------------
 sys/dev/pci/virtiovar.h  |   4 ++--
 3 files changed, 11 insertions(+), 19 deletions(-)

diffs (115 lines):

diff -r fc532dceb11f -r c5979bea1383 sys/dev/pci/virtio.c
--- a/sys/dev/pci/virtio.c      Mon May 25 07:29:52 2020 +0000
+++ b/sys/dev/pci/virtio.c      Mon May 25 07:37:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtio.c,v 1.39 2020/05/25 07:29:52 yamaguchi Exp $    */
+/*     $NetBSD: virtio.c,v 1.40 2020/05/25 07:37:47 yamaguchi Exp $    */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.39 2020/05/25 07:29:52 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.40 2020/05/25 07:37:47 yamaguchi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -277,8 +277,9 @@
 }
 
 static int
-virtio_vq_mq_intr(struct virtqueue *vq)
+virtio_vq_mq_intr(void *arg)
 {
+       struct virtqueue *vq = arg;
 
        return virtio_vq_intr_common(vq);
 }
diff -r fc532dceb11f -r c5979bea1383 sys/dev/pci/virtio_pci.c
--- a/sys/dev/pci/virtio_pci.c  Mon May 25 07:29:52 2020 +0000
+++ b/sys/dev/pci/virtio_pci.c  Mon May 25 07:37:47 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.8 2020/05/25 07:29:52 yamaguchi Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.9 2020/05/25 07:37:47 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.8 2020/05/25 07:29:52 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.9 2020/05/25 07:37:47 yamaguchi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -80,7 +80,6 @@
 
 static int     virtio_pci_intr(void *arg);
 static int     virtio_pci_msix_queue_intr(void *);
-static int     virtio_pci_msix_vq_intr(void *);
 static int     virtio_pci_msix_config_intr(void *);
 static int     virtio_pci_setup_msix_vectors(struct virtio_softc *);
 static int     virtio_pci_setup_msix_interrupts(struct virtio_softc *,
@@ -511,6 +510,7 @@
        struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
        device_t self = sc->sc_dev;
        pci_chipset_tag_t pc = pa->pa_pc;
+       struct virtqueue *vq;
        char intrbuf[PCI_INTRSTR_LEN];
        char intr_xname[INTRDEVNAMEBUF];
        char const *intrstr;
@@ -534,6 +534,7 @@
        if (sc->sc_child_mq) {
                for (qid = 0; qid < sc->sc_nvqs; qid++) {
                        n = idx + qid;
+                       vq = &sc->sc_vqs[qid];
 
                        snprintf(intr_xname, sizeof(intr_xname), "%s vq#%d",
                            device_xname(sc->sc_dev), qid);
@@ -544,8 +545,7 @@
                        }
 
                        psc->sc_ihs[n] = pci_intr_establish_xname(pc, psc->sc_ihp[n],
-                           sc->sc_ipl, virtio_pci_msix_vq_intr, &sc->sc_vqs[qid],
-                           intr_xname);
+                           sc->sc_ipl, vq->vq_intrhand, vq, intr_xname);
                        if (psc->sc_ihs[n] == NULL) {
                                aprint_error_dev(self, "couldn't establish MSI-X for a vq\n");
                                goto error;
@@ -798,15 +798,6 @@
 }
 
 static int
-virtio_pci_msix_vq_intr(void *arg)
-{
-       struct virtqueue *vq = arg;
-
-       KASSERT(vq->vq_intrhand != NULL);
-       return vq->vq_intrhand(vq);
-}
-
-static int
 virtio_pci_msix_config_intr(void *arg)
 {
        struct virtio_softc *sc = arg;
diff -r fc532dceb11f -r c5979bea1383 sys/dev/pci/virtiovar.h
--- a/sys/dev/pci/virtiovar.h   Mon May 25 07:29:52 2020 +0000
+++ b/sys/dev/pci/virtiovar.h   Mon May 25 07:37:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtiovar.h,v 1.14 2020/05/25 07:29:52 yamaguchi Exp $ */
+/*     $NetBSD: virtiovar.h,v 1.15 2020/05/25 07:37:47 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -117,7 +117,7 @@
        /* interrupt handler */
        int                     (*vq_done)(struct virtqueue*);
        void                    *vq_done_ctx;
-       int                     (*vq_intrhand)(struct virtqueue*);
+       int                     (*vq_intrhand)(void *);
 };
 
 struct virtio_attach_args {



Home | Main Index | Thread Index | Old Index