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 to allocate resources actuall used around in...



details:   https://anonhg.NetBSD.org/src/rev/ba128b3a63a4
branches:  trunk
changeset: 933567:ba128b3a63a4
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Wed May 27 11:24:31 2020 +0000

description:
Fix to allocate resources actuall used around interrupts

diffstat:

 sys/dev/pci/virtio_pci.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r b367ccfbe53f -r ba128b3a63a4 sys/dev/pci/virtio_pci.c
--- a/sys/dev/pci/virtio_pci.c  Wed May 27 11:02:52 2020 +0000
+++ b/sys/dev/pci/virtio_pci.c  Wed May 27 11:24:31 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.10 2020/05/25 07:52:16 yamaguchi Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.11 2020/05/27 11:24:31 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.10 2020/05/25 07:52:16 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.11 2020/05/27 11:24:31 yamaguchi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -677,10 +677,14 @@
                counts[PCI_INTR_TYPE_INTX] = 1;
        } else {
                /* Try MSI-X first and INTx second */
-               if (sc->sc_child_mq &&
-                   sc->sc_nvqs > (nmsix - VIRTIO_MSIX_QUEUE_VECTOR_INDEX)) {
+               if (sc->sc_nvqs + VIRTIO_MSIX_QUEUE_VECTOR_INDEX <= nmsix) {
+                       nmsix = sc->sc_nvqs + VIRTIO_MSIX_QUEUE_VECTOR_INDEX;
+               } else {
+                       sc->sc_child_mq = false;
+               }
+
+               if (sc->sc_child_mq == false) {
                        nmsix = 2;
-                       sc->sc_child_mq = false;
                }
 
                max_type = PCI_INTR_TYPE_MSIX;



Home | Main Index | Thread Index | Old Index