Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/pci/ixgbe Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/42a13a61def9
branches:  netbsd-8
changeset: 366585:42a13a61def9
user:      martin <martin%NetBSD.org@localhost>
date:      Tue May 31 14:07:51 2022 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1745):

        sys/dev/pci/ixgbe/ix_txrx.c: revision 1.98
        sys/dev/pci/ixgbe/ixv.c: revision 1.181
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.315
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.86

bus_dmamem_unmap() before bus_dmamem_free(), otherwise we may give back meomry
which is still (and will stay) mapped.

Fixes one instance of "panic: HYPERVISOR_mmu_update failed" on Xen.
There may be others.

Fix a bug that the legacy interrupt doesn't work when MSI-X allocation failed.
Fixes PR kern/56857.

Remove unused adapter->msix_mem.

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c |   5 +++--
 sys/dev/pci/ixgbe/ixgbe.c   |  14 +++++++-------
 sys/dev/pci/ixgbe/ixgbe.h   |   3 +--
 sys/dev/pci/ixgbe/ixv.c     |   5 ++---
 4 files changed, 13 insertions(+), 14 deletions(-)

diffs (139 lines):

diff -r 5a84734c6dea -r 42a13a61def9 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Mon May 30 17:08:06 2022 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Tue May 31 14:07:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -2322,6 +2322,7 @@
        bus_dmamap_sync(dma->dma_tag->dt_dmat, dma->dma_map, 0, dma->dma_size,
            BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
        ixgbe_dmamap_unload(dma->dma_tag, dma->dma_map);
+       bus_dmamem_unmap(dma->dma_tag->dt_dmat, dma->dma_vaddr, dma->dma_size);
        bus_dmamem_free(dma->dma_tag->dt_dmat, &dma->dma_seg, 1);
        ixgbe_dma_tag_destroy(dma->dma_tag);
 } /* ixgbe_dma_free */
diff -r 5a84734c6dea -r 42a13a61def9 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Mon May 30 17:08:06 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Tue May 31 14:07:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.51 2022/05/31 14:07:51 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.51 2022/05/31 14:07:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1091,7 +1091,6 @@
                        ixgbe_free_queues(adapter);
 
                        /* Fallback to legacy interrupt */
-                       adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
                        if (adapter->feat_cap & IXGBE_FEATURE_MSI)
                                adapter->feat_en |= IXGBE_FEATURE_MSI;
                        adapter->num_queues = 1;
@@ -5033,7 +5032,7 @@
        IXGBE_WRITE_REG(hw, IXGBE_EIMS, mask);
 
        /* With MSI-X we use auto clear */
-       if (adapter->msix_mem) {
+       if ((adapter->feat_en & IXGBE_FEATURE_MSIX) != 0) {
                /*
                 * We use auto clear for RTX_QUEUE only. Don't use other
                 * interrupts (e.g. link interrupt). BTW, we don't use
@@ -5065,7 +5064,7 @@
        /* disable interrupts other than queues */
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~IXGBE_EIMC_RTX_QUEUE);
 
-       if (adapter->msix_mem)
+       if ((adapter->feat_en & IXGBE_FEATURE_MSIX) != 0)
                IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIAC, 0);
 
        for (int i = 0; i < adapter->num_queues; i++, que++)
@@ -6710,6 +6709,7 @@
            adapter->osdep.nintrs) != 0) {
                aprint_error_dev(dev,
                    "failed to allocate MSI-X interrupt\n");
+               adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
                return (ENXIO);
        }
 
@@ -6909,7 +6909,7 @@
        if (msgs < 2)
                goto msi;
 
-       adapter->msix_mem = (void *)1; /* XXX */
+       adapter->feat_en |= IXGBE_FEATURE_MSIX;
 
        /* Figure out a reasonable auto config value */
        queues = (ncpu > (msgs - 1)) ? (msgs - 1) : ncpu;
@@ -6963,7 +6963,7 @@
        adapter->feat_en  &= ~IXGBE_FEATURE_SRIOV;
 
        msgs = pci_msi_count(adapter->osdep.pc, adapter->osdep.tag);
-       adapter->msix_mem = NULL; /* XXX */
+       adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
        if (msgs > 1)
                msgs = 1;
        if (msgs != 0) {
diff -r 5a84734c6dea -r 42a13a61def9 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Mon May 30 17:08:06 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Tue May 31 14:07:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.24 2022/01/30 16:06:35 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.25 2022/05/31 14:07:52 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -479,7 +479,6 @@
        struct if_percpuq       *ipq;   /* softint-based input queues */
 
        struct resource         *pci_mem;
-       struct resource         *msix_mem;
 
        /* NetBSD: Interrupt resources are in osdep */
 
diff -r 5a84734c6dea -r 42a13a61def9 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Mon May 30 17:08:06 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Tue May 31 14:07:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.56.2.37 2022/05/30 17:05:51 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.56.2.38 2022/05/31 14:07:51 martin Exp $ */
 
 /******************************************************************************
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.56.2.37 2022/05/30 17:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.56.2.38 2022/05/31 14:07:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3401,7 +3401,6 @@
                return -1;
        }
 
-       adapter->msix_mem = (void *)1; /* XXX */
        aprint_normal_dev(dev,
            "Using MSI-X interrupts with %d vectors\n", msgs);
        adapter->num_queues = queues;



Home | Main Index | Thread Index | Old Index