Module Name: src Committed By: msaitoh Date: Fri Nov 25 13:33:24 UTC 2016
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_osdep.h ixv.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/ixgbe_osdep.h cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.40 src/sys/dev/pci/ixgbe/ixgbe.c:1.41 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.40 Thu Oct 13 20:05:06 2016 +++ src/sys/dev/pci/ixgbe/ixgbe.c Fri Nov 25 13:33:24 2016 @@ -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 @@ static void ixgbe_setup_optics(struct ad /* 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_smart_speed = ixgbe_sma 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 @@ SYSCTL_INT("hw.ixgbe.enable_msix", &ixgb */ 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 @@ ixgbe_attach(device_t parent, device_t d 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 @@ ixgbe_legacy_irq(void *arg) } -#if defined(NETBSD_MSI_OR_MSIX) /********************************************************************* * * MSIX Queue Interrupt Service routine @@ -1862,7 +1857,6 @@ ixgbe_msix_link(void *arg) IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); return 1; } -#endif /********************************************************************* * @@ -2498,27 +2492,11 @@ ixgbe_allocate_legacy(struct adapter *ad #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 @@ alloc_retry: 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 @@ alloc_retry: 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 @@ ixgbe_allocate_msix(struct adapter *adap kcpuset_destroy(affinity); return (0); -#endif } /* @@ -2787,9 +2758,6 @@ ixgbe_allocate_msix(struct adapter *adap 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 @@ msi: msgs = 1; aprint_normal_dev(dev,"Using an MSI interrupt\n"); return (msgs); -#endif } @@ -2904,12 +2871,9 @@ map_err: 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 @@ ixgbe_free_pci_resources(struct adapter 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 @@ ixgbe_free_pci_resources(struct adapter 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, Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.h diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.10 src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.11 --- src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.10 Thu Aug 13 04:56:43 2015 +++ src/sys/dev/pci/ixgbe/ixgbe_osdep.h Fri Nov 25 13:33:24 2016 @@ -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 @@ typedef uint64_t u64; #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 @@ typedef uint64_t u64; #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__) Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.17 src/sys/dev/pci/ixgbe/ixv.c:1.18 --- src/sys/dev/pci/ixgbe/ixv.c:1.17 Fri Jun 10 13:27:15 2016 +++ src/sys/dev/pci/ixgbe/ixv.c Fri Nov 25 13:33:24 2016 @@ -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 @@ ixv_probe(device_t dev, cfdata_t cf, voi { 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 @@ ixv_identify_hardware(struct adapter *ad 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 @@ ixv_allocate_msix(struct adapter *adapte } return (0); -#endif } /* @@ -1788,9 +1788,6 @@ ixv_allocate_msix(struct adapter *adapte 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 @@ ixv_setup_msix(struct adapter *adapter) aprint_normal_dev(dev, "Using MSIX interrupts with %d vectors\n", msgs); return (want); -#endif } @@ -1867,8 +1863,6 @@ map_err: 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 @@ ixv_free_pci_resources(struct adapter * adapter->osdep.mem_size); } -#endif return; }