Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/ixgbe Remove #ifdef NETBSD_MSI_OR_MSIX to be sim...



details:   https://anonhg.NetBSD.org/src/rev/7dd88151169e
branches:  trunk
changeset: 349146:7dd88151169e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Nov 25 13:33:24 2016 +0000

description:
Remove #ifdef NETBSD_MSI_OR_MSIX to be simple. ixv(4) isn't attached if
__HAVE_PCI_MSI_MSIX isn't set because MSI-X must be used.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c       |  43 +---------------------------------------
 sys/dev/pci/ixgbe/ixgbe_osdep.h |   7 +-----
 sys/dev/pci/ixgbe/ixv.c         |  17 ++++-----------
 3 files changed, 8 insertions(+), 59 deletions(-)

diffs (284 lines):

diff -r 7041cdea9108 -r 7dd88151169e sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Nov 25 12:56:29 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Nov 25 13:33:24 2016 +0000
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 279805 2015-03-09 10:29:15Z araujo $*/
-/*$NetBSD: ixgbe.c,v 1.40 2016/10/13 20:05:06 jdolecek Exp $*/
+/*$NetBSD: ixgbe.c,v 1.41 2016/11/25 13:33:24 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -230,11 +230,9 @@
 /* Legacy (single vector interrupt handler */
 static int     ixgbe_legacy_irq(void *);
 
-#if defined(NETBSD_MSI_OR_MSIX)
 /* The MSI/X Interrupt handlers */
 static int     ixgbe_msix_que(void *);
 static int     ixgbe_msix_link(void *);
-#endif
 
 /* Software interrupts for deferred work */
 static void    ixgbe_handle_que(void *);
@@ -310,7 +308,6 @@
 static int ixgbe_enable_msix = 1;
 SYSCTL_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix);
 
-#if defined(NETBSD_MSI_OR_MSIX)
 /*
  * Number of Queues, can be set to 0,
  * it then autoconfigures based on the
@@ -319,7 +316,6 @@
  */
 static int ixgbe_num_queues = 1;
 SYSCTL_INT("hw.ixgbe.num_queues", &ixgbe_num_queues);
-#endif
 
 /*
 ** Number of TX descriptors per ring,
@@ -512,7 +508,7 @@
        u16             csum;
        u32             ctrl_ext;
        ixgbe_vendor_info_t *ent;
-       const struct pci_attach_args *pa = aux;
+       struct pci_attach_args *pa = aux;
 
        INIT_DEBUGOUT("ixgbe_attach: begin");
 
@@ -1693,7 +1689,6 @@
 }
 
 
-#if defined(NETBSD_MSI_OR_MSIX)
 /*********************************************************************
  *
  *  MSIX Queue Interrupt Service routine
@@ -1862,7 +1857,6 @@
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_OTHER);
        return 1;
 }
-#endif
 
 /*********************************************************************
  *
@@ -2498,27 +2492,11 @@
 #ifndef IXGBE_LEGACY_TX
        struct tx_ring          *txr = adapter->tx_rings;
 #endif
-#ifndef NETBSD_MSI_OR_MSIX
-       pci_intr_handle_t       ih;
-#else
        int             counts[PCI_INTR_TYPE_SIZE];
        pci_intr_type_t intr_type, max_type;
-#endif
        char intrbuf[PCI_INTRSTR_LEN];
        const char      *intrstr = NULL;
  
-#ifndef NETBSD_MSI_OR_MSIX
-       /* We allocate a single interrupt resource */
-       if (pci_intr_map(pa, &ih) != 0) {
-               aprint_error_dev(dev, "unable to map interrupt\n");
-               return ENXIO;
-       } else {
-               intrstr = pci_intr_string(adapter->osdep.pc, ih, intrbuf,
-                   sizeof(intrbuf));
-       }
-       adapter->osdep.ihs[0] = pci_intr_establish_xname(adapter->osdep.pc, ih,
-           IPL_NET, ixgbe_legacy_irq, que, device_xname(dev));
-#else
        /* Allocation settings */
        max_type = PCI_INTR_TYPE_MSI;
        counts[PCI_INTR_TYPE_MSIX] = 0;
@@ -2554,14 +2532,11 @@
                        break;
                }
        }
-#endif
        if (adapter->osdep.ihs[0] == NULL) {
                aprint_error_dev(dev,
                    "couldn't establish interrupt%s%s\n",
                    intrstr ? " at " : "", intrstr ? intrstr : "");
-#ifdef NETBSD_MSI_OR_MSIX
                pci_intr_release(adapter->osdep.pc, adapter->osdep.intrs, 1);
-#endif
                return ENXIO;
        }
        aprint_normal_dev(dev, "interrupting at %s\n", intrstr);
@@ -2614,9 +2589,6 @@
 static int
 ixgbe_allocate_msix(struct adapter *adapter, const struct pci_attach_args *pa)
 {
-#if !defined(NETBSD_MSI_OR_MSIX)
-       return 0;
-#else
        device_t        dev = adapter->dev;
        struct          ix_queue *que = adapter->queues;
        struct          tx_ring *txr = adapter->tx_rings;
@@ -2778,7 +2750,6 @@
 
        kcpuset_destroy(affinity);
        return (0);
-#endif
 }
 
 /*
@@ -2787,9 +2758,6 @@
 static int
 ixgbe_setup_msix(struct adapter *adapter)
 {
-#if !defined(NETBSD_MSI_OR_MSIX)
-       return 0;
-#else
        device_t dev = adapter->dev;
        int want, queues, msgs;
 
@@ -2849,7 +2817,6 @@
                msgs = 1;
        aprint_normal_dev(dev,"Using an MSI interrupt\n");
        return (msgs);
-#endif
 }
 
 
@@ -2904,12 +2871,9 @@
 static void
 ixgbe_free_pci_resources(struct adapter * adapter)
 {
-#if defined(NETBSD_MSI_OR_MSIX)
        struct          ix_queue *que = adapter->queues;
-#endif
        int             rid;
 
-#if defined(NETBSD_MSI_OR_MSIX)
        /*
        **  Release all msix queue resources:
        */
@@ -2918,7 +2882,6 @@
                        pci_intr_disestablish(adapter->osdep.pc,
                            adapter->osdep.ihs[i]);
        }
-#endif
 
        /* Clean the Legacy or Link interrupt last */
        if (adapter->linkvec) /* we are doing MSIX */
@@ -2932,10 +2895,8 @@
                adapter->osdep.ihs[rid] = NULL;
        }
 
-#if defined(NETBSD_MSI_OR_MSIX)
        pci_intr_release(adapter->osdep.pc, adapter->osdep.intrs,
            adapter->osdep.nintrs);
-#endif
 
        if (adapter->osdep.mem_size != 0) {
                bus_space_unmap(adapter->osdep.mem_bus_space_tag,
diff -r 7041cdea9108 -r 7dd88151169e sys/dev/pci/ixgbe/ixgbe_osdep.h
--- a/sys/dev/pci/ixgbe/ixgbe_osdep.h   Fri Nov 25 12:56:29 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_osdep.h   Fri Nov 25 13:33:24 2016 +0000
@@ -31,7 +31,7 @@
 
 ******************************************************************************/
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.h 251964 2013-06-18 21:28:19Z jfv $*/
-/*$NetBSD: ixgbe_osdep.h,v 1.10 2015/08/13 04:56:43 msaitoh Exp $*/
+/*$NetBSD: ixgbe_osdep.h,v 1.11 2016/11/25 13:33:24 msaitoh Exp $*/
 
 #ifndef _IXGBE_OS_H_
 #define _IXGBE_OS_H_
@@ -125,8 +125,6 @@
 
 #define le16_to_cpu 
 
-#ifdef __HAVE_PCI_MSI_MSIX
-#define NETBSD_MSI_OR_MSIX
 /*
  * This device driver divides interrupt to TX, RX and link state.
  * Each MSI-X vector indexes are below.
@@ -135,9 +133,6 @@
 #define IXG_MSIX_TXRXINTR_IDX  0
 #define IXG_MSIX_LINKINTR_IDX  1
 #define IXG_MAX_NINTR          IXG_MSIX_NINTR
-#else
-#define IXG_MAX_NINTR          1
-#endif
 
 #if __FreeBSD_version < 800000
 #if defined(__i386__) || defined(__amd64__)
diff -r 7041cdea9108 -r 7dd88151169e sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Fri Nov 25 12:56:29 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Fri Nov 25 13:33:24 2016 +0000
@@ -31,7 +31,7 @@
 
 ******************************************************************************/
 /*$FreeBSD: head/sys/dev/ixgbe/ixv.c 275358 2014-12-01 11:45:24Z hselasky $*/
-/*$NetBSD: ixv.c,v 1.17 2016/06/10 13:27:15 ozaki-r Exp $*/
+/*$NetBSD: ixv.c,v 1.18 2016/11/25 13:33:24 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -266,7 +266,11 @@
 {
        const struct pci_attach_args *pa = aux;
 
+#ifdef __HAVE_PCI_MSI_MSIX
        return (ixv_lookup(pa) != NULL) ? 1 : 0;
+#else
+       return 0;
+#endif
 }
 
 static ixv_vendor_info_t *
@@ -1668,9 +1672,6 @@
 static int
 ixv_allocate_msix(struct adapter *adapter, const struct pci_attach_args *pa)
 {
-#if !defined(NETBSD_MSI_OR_MSIX)
-       return 0;
-#else
        device_t        dev = adapter->dev;
        struct ix_queue *que = adapter->queues;
        int             error, rid, vector = 0;
@@ -1778,7 +1779,6 @@
        }
 
        return (0);
-#endif
 }
 
 /*
@@ -1788,9 +1788,6 @@
 static int
 ixv_setup_msix(struct adapter *adapter)
 {
-#if !defined(NETBSD_MSI_OR_MSIX)
-       return 0;
-#else
        device_t dev = adapter->dev;
        int want, msgs;
 
@@ -1809,7 +1806,6 @@
        aprint_normal_dev(dev,
            "Using MSIX interrupts with %d vectors\n", msgs);
        return (want);
-#endif
 }
 
 
@@ -1867,8 +1863,6 @@
 static void
 ixv_free_pci_resources(struct adapter * adapter)
 {
-#if !defined(NETBSD_MSI_OR_MSIX)
-#else
        struct          ix_queue *que = adapter->queues;
        int             rid;
 
@@ -1905,7 +1899,6 @@
                    adapter->osdep.mem_size);
        }
 
-#endif
        return;
 }
 



Home | Main Index | Thread Index | Old Index