PERFORCE change 126138 for review

Marius Strobl marius at FreeBSD.org
Thu Sep 6 15:39:24 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126138

Change 126138 by marius at flak on 2007/09/06 22:39:12

	IFC in order to get the CVS version of the sparc64 INTR_FILTER
	changes.

Affected files ...

.. //depot/projects/usiii/arm/xscale/i80321/i80321.c#2 integrate
.. //depot/projects/usiii/contrib/opensolaris/uts/common/fs/zfs/arc.c#2 integrate
.. //depot/projects/usiii/dev/acpica/acpi_cpu.c#2 integrate
.. //depot/projects/usiii/dev/ath/if_ath.c#2 integrate
.. //depot/projects/usiii/dev/awi/awi.c#2 integrate
.. //depot/projects/usiii/dev/ipw/if_ipw.c#2 integrate
.. //depot/projects/usiii/dev/iwi/if_iwi.c#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe.c#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe.h#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_82598.c#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_api.c#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_api.h#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_common.c#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_common.h#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_osdep.h#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_phy.c#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_phy.h#2 integrate
.. //depot/projects/usiii/dev/ixgbe/ixgbe_type.h#2 integrate
.. //depot/projects/usiii/dev/ral/rt2560.c#2 integrate
.. //depot/projects/usiii/dev/ral/rt2661.c#2 integrate
.. //depot/projects/usiii/dev/ray/if_ray.c#2 integrate
.. //depot/projects/usiii/dev/usb/if_rum.c#2 integrate
.. //depot/projects/usiii/dev/usb/if_ural.c#2 integrate
.. //depot/projects/usiii/dev/usb/if_zyd.c#1 branch
.. //depot/projects/usiii/dev/usb/if_zydfw.h#1 branch
.. //depot/projects/usiii/dev/usb/if_zydreg.h#1 branch
.. //depot/projects/usiii/dev/usb/usbdevs#2 integrate
.. //depot/projects/usiii/dev/wi/if_wi.c#2 integrate
.. //depot/projects/usiii/fs/msdosfs/direntry.h#2 integrate
.. //depot/projects/usiii/fs/msdosfs/msdosfs_conv.c#2 integrate
.. //depot/projects/usiii/fs/msdosfs/msdosfs_lookup.c#2 integrate
.. //depot/projects/usiii/fs/msdosfs/msdosfs_vnops.c#2 integrate
.. //depot/projects/usiii/geom/eli/g_eli.h#2 integrate
.. //depot/projects/usiii/geom/eli/g_eli_crypto.c#2 integrate
.. //depot/projects/usiii/i386/isa/isa.c#2 integrate
.. //depot/projects/usiii/kern/kern_acct.c#2 integrate
.. //depot/projects/usiii/kern/kern_ktrace.c#2 integrate
.. //depot/projects/usiii/kern/kern_sysctl.c#2 integrate
.. //depot/projects/usiii/kern/kern_timeout.c#2 integrate
.. //depot/projects/usiii/modules/ixgbe/Makefile#1 branch
.. //depot/projects/usiii/modules/zyd/Makefile#1 branch
.. //depot/projects/usiii/net/if_lagg.c#2 integrate
.. //depot/projects/usiii/net80211/_ieee80211.h#2 integrate
.. //depot/projects/usiii/net80211/ieee80211.h#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_freebsd.h#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_ht.c#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_input.c#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_ioctl.c#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_ioctl.h#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_node.c#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_proto.c#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_proto.h#2 integrate
.. //depot/projects/usiii/net80211/ieee80211_var.h#2 integrate
.. //depot/projects/usiii/netinet/ip_fw2.c#2 integrate
.. //depot/projects/usiii/sparc64/fhc/fhc.c#3 integrate
.. //depot/projects/usiii/sparc64/include/bus_common.h#2 integrate
.. //depot/projects/usiii/sparc64/include/intr_machdep.h#3 integrate
.. //depot/projects/usiii/sparc64/pci/psycho.c#3 integrate
.. //depot/projects/usiii/sparc64/pci/psychoreg.h#3 integrate
.. //depot/projects/usiii/sparc64/sbus/sbus.c#3 integrate
.. //depot/projects/usiii/sparc64/sbus/sbusreg.h#3 integrate
.. //depot/projects/usiii/sparc64/sparc64/exception.S#3 integrate
.. //depot/projects/usiii/sparc64/sparc64/intr_machdep.c#3 integrate
.. //depot/projects/usiii/sparc64/sparc64/tick.c#3 integrate
.. //depot/projects/usiii/sparc64/sparc64/upa.c#3 integrate

Differences ...

==== //depot/projects/usiii/arm/xscale/i80321/i80321.c#2 (text+ko) ====

@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/i80321.c,v 1.6 2006/07/25 01:08:41 kevlo Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/i80321.c,v 1.7 2007/09/04 18:45:27 cognet Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -213,8 +213,6 @@
 		    PCIM_CMD_SERRESPEN;
 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
 		    PCIR_COMMAND, preg);
-		preg = bus_space_read_4(sc->sc_st, sc->sc_atu_sh,
-		    PCIR_COMMAND);
 	}
 	/* Initialize the bus space tags. */
 	i80321_io_bs_init(&sc->sc_pci_iot, sc);

==== //depot/projects/usiii/contrib/opensolaris/uts/common/fs/zfs/arc.c#2 (text+ko) ====

@@ -155,9 +155,9 @@
 TUNABLE_ULONG("vfs.zfs.arc_max", &zfs_arc_max);
 TUNABLE_ULONG("vfs.zfs.arc_min", &zfs_arc_min);
 SYSCTL_DECL(_vfs_zfs);
-SYSCTL_ULONG(_vfs_zfs, OID_AUTO, arc_max, CTLFLAG_RD, &zfs_arc_max, 0,
+SYSCTL_ULONG(_vfs_zfs, OID_AUTO, arc_max, CTLFLAG_RDTUN, &zfs_arc_max, 0,
     "Maximum ARC size");
-SYSCTL_ULONG(_vfs_zfs, OID_AUTO, arc_min, CTLFLAG_RD, &zfs_arc_min, 0,
+SYSCTL_ULONG(_vfs_zfs, OID_AUTO, arc_min, CTLFLAG_RDTUN, &zfs_arc_min, 0,
     "Minimum ARC size");
 
 /*

==== //depot/projects/usiii/dev/acpica/acpi_cpu.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.66 2007/06/03 00:40:56 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.67 2007/08/30 21:18:42 njl Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -257,7 +257,7 @@
 acpi_cpu_attach(device_t dev)
 {
     ACPI_BUFFER		   buf;
-    ACPI_OBJECT		   arg, *obj;
+    ACPI_OBJECT		   arg[4], *obj;
     ACPI_OBJECT_LIST	   arglist;
     struct pcpu		   *pcpu_data;
     struct acpi_cpu_softc *sc;
@@ -268,6 +268,11 @@
     driver_t 		  **drivers;
     uint32_t		   cap_set[3];
 
+    /* UUID needed by _OSC evaluation */
+    static uint8_t cpu_oscuuid[16] = { 0x16, 0xA6, 0x77, 0x40, 0x0C, 0x29,
+				       0xBE, 0x47, 0x9E, 0xBD, 0xD8, 0x70,
+				       0x58, 0x71, 0x39, 0x53 };
+
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
     sc = device_get_softc(dev);
@@ -334,19 +339,39 @@
     /*
      * CPU capabilities are specified as a buffer of 32-bit integers:
      * revision, count, and one or more capabilities.  The revision of
-     * "1" is not specified anywhere but seems to match Linux.  We should
-     * also support _OSC here.
+     * "1" is not specified anywhere but seems to match Linux.
      */
     if (sc->cpu_features) {
-	arglist.Pointer = &arg;
+	arglist.Pointer = arg;
 	arglist.Count = 1;
-	arg.Type = ACPI_TYPE_BUFFER;
-	arg.Buffer.Length = sizeof(cap_set);
-	arg.Buffer.Pointer = (uint8_t *)cap_set;
+	arg[0].Type = ACPI_TYPE_BUFFER;
+	arg[0].Buffer.Length = sizeof(cap_set);
+	arg[0].Buffer.Pointer = (uint8_t *)cap_set;
 	cap_set[0] = 1; /* revision */
 	cap_set[1] = 1; /* number of capabilities integers */
 	cap_set[2] = sc->cpu_features;
 	AcpiEvaluateObject(sc->cpu_handle, "_PDC", &arglist, NULL);
+
+	/*
+	 * On some systems we need to evaluate _OSC so that the ASL
+	 * loads the _PSS and/or _PDC methods at runtime.
+	 *
+	 * TODO: evaluate failure of _OSC.
+	 */
+	arglist.Pointer = arg;
+	arglist.Count = 4;
+	arg[0].Type = ACPI_TYPE_BUFFER;
+	arg[0].Buffer.Length = sizeof(cpu_oscuuid);
+	arg[0].Buffer.Pointer = cpu_oscuuid;	/* UUID */
+	arg[1].Type = ACPI_TYPE_INTEGER;
+	arg[1].Integer.Value = 1;		/* revision */
+	arg[2].Type = ACPI_TYPE_INTEGER;
+	arg[2].Integer.Value = 1;		/* count */
+	arg[3].Type = ACPI_TYPE_BUFFER;
+	arg[3].Buffer.Length = sizeof(cap_set);	/* Capabilities buffer */
+	arg[3].Buffer.Pointer = (uint8_t *)cap_set;
+	cap_set[0] = 0;
+	AcpiEvaluateObject(sc->cpu_handle, "_OSC", &arglist, NULL);
     }
 
     /* Probe for Cx state support. */

==== //depot/projects/usiii/dev/ath/if_ath.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.173 2007/08/06 14:25:59 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.174 2007/09/05 23:00:26 sam Exp $");
 
 /*
  * Driver for the Atheros Wireless LAN controller.
@@ -1579,6 +1579,12 @@
 				ATH_TXBUF_UNLOCK(sc);
 				break;
 			}
+			/*
+			 * Cancel any background scan.
+			 */
+			if (ic->ic_flags & IEEE80211_F_SCAN)
+				ieee80211_cancel_scan(ic);
+
 			STAILQ_INIT(&frags);
 			/*
 			 * Find the node for the destination so we can do
@@ -1605,15 +1611,6 @@
 				 * the frame back when the time is right.
 				 */
 				ieee80211_pwrsave(ni, m);
-				/*
-				 * If we're in power save mode 'cuz of a bg
-				 * scan cancel it so the traffic can flow.
-				 * The packet we just queued will automatically
-				 * get sent when we drop out of power save.
-				 * XXX locking
-				 */
-				if (ic->ic_flags & IEEE80211_F_SCAN)
-					ieee80211_cancel_scan(ic);
 				goto reclaim;
 			}
 			/* calculate priority so we can find the tx queue */
@@ -1752,6 +1749,7 @@
 		}
 
 		ifp->if_timer = 5;
+		ic->ic_lastdata = ticks;
 #if 0
 		/*
 		 * Flush stale frames from the fast-frame staging queue.

==== //depot/projects/usiii/dev/awi/awi.c#2 (text+ko) ====

@@ -89,7 +89,7 @@
 __KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.62 2004/01/16 14:13:15 onoe Exp $");
 #endif
 #ifdef __FreeBSD__
-__FBSDID("$FreeBSD: src/sys/dev/awi/awi.c,v 1.44 2007/06/11 03:36:51 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/awi/awi.c,v 1.45 2007/09/05 21:31:31 sam Exp $");
 #endif
 
 #include "opt_inet.h"
@@ -1919,6 +1919,8 @@
 		else
 			awi_drvstate(sc, AWI_DRV_INFASSOC);
 		break;
+	default:
+		break;
 	}
 
 	if (nstate == IEEE80211_S_INIT) {
@@ -1954,6 +1956,8 @@
 			case IEEE80211_S_SCAN:
 				/* scan next */
 				break;
+			default:
+				break;
 			}
 			if (ic->ic_flags & IEEE80211_F_ASCAN)
 				newmode = AWI_SCAN_ACTIVE;

==== //depot/projects/usiii/dev/ipw/if_ipw.c#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.29 2007/07/05 15:06:49 avatar Exp $	*/
+/*	$FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.30 2007/09/05 21:31:31 sam Exp $	*/
 
 /*-
  * Copyright (c) 2004-2006
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.29 2007/07/05 15:06:49 avatar Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.30 2007/09/05 21:31:31 sam Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -839,6 +839,7 @@
 	case IEEE80211_S_SCAN:
 	case IEEE80211_S_AUTH:
 	case IEEE80211_S_ASSOC:
+	default:
 		break;
 	}
 

==== //depot/projects/usiii/dev/iwi/if_iwi.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.55 2007/06/25 20:56:33 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.57 2007/09/05 23:00:26 sam Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -957,7 +957,6 @@
 	struct iwi_softc *sc = ifp->if_softc;
 	int error = 0;
 
-	IWI_LOCK_ASSERT(sc);
 	DPRINTF(("%s: %s -> %s flags 0x%x\n", __func__,
 		ieee80211_state_name[ic->ic_state],
 		ieee80211_state_name[nstate], sc->flags));
@@ -1918,6 +1917,11 @@
 			IFQ_DRV_DEQUEUE(&ifp->if_snd, m0);
 			if (m0 == NULL)
 				break;
+			/*
+			 * Cancel any background scan.
+			 */
+			if (ic->ic_flags & IEEE80211_F_SCAN)
+				ieee80211_cancel_scan(ic);
 
 			if (m0->m_len < sizeof (struct ether_header) &&
 			    (m0 = m_pullup(m0, sizeof (struct ether_header))) == NULL) {
@@ -1979,6 +1983,7 @@
 		}
 
 		sc->sc_tx_timer = 5;
+		ic->ic_lastdata = ticks;
 	}
 
 	IWI_UNLOCK(sc);

==== //depot/projects/usiii/dev/ixgbe/ixgbe.c#2 (text+ko) ====

@@ -30,7 +30,7 @@
 POSSIBILITY OF SUCH DAMAGE.
 
 ***************************************************************************/
-/* $FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.3 2007/07/12 19:04:11 jfv Exp $ */
+/* $FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.4 2007/09/04 02:31:34 jfv Exp $ */
 
 #ifdef HAVE_KERNEL_OPTION_HEADERS
 #include "opt_device_polling.h"
@@ -46,7 +46,7 @@
 /*********************************************************************
  *  Driver version
  *********************************************************************/
-char ixgbe_driver_version[] = "1.1.3";
+char ixgbe_driver_version[] = "1.2.6";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -60,10 +60,9 @@
 
 static ixgbe_vendor_info_t ixgbe_vendor_info_array[] =
 {
-	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598, 0, 0, 0},
 	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AF_DUAL_PORT, 0, 0, 0},
 	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AF_SINGLE_PORT, 0, 0, 0},
-	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AT_DUAL_PORT, 0, 0, 0},
+	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598EB_CX4, 0, 0, 0},
 	/* required last entry */
 	{0, 0, 0, 0, 0}
 };
@@ -100,8 +99,9 @@
 static void     ixgbe_setup_interface(device_t, struct adapter *);
 static int	ixgbe_allocate_queues(struct adapter *);
 static int	ixgbe_allocate_msix_resources(struct adapter *);
+#if __FreeBSD_version >= 700000
 static int	ixgbe_setup_msix(struct adapter *);
-
+#endif
 static int      ixgbe_allocate_transmit_buffers(struct tx_ring *);
 static int	ixgbe_setup_transmit_structures(struct adapter *);
 static void	ixgbe_setup_transmit_ring(struct tx_ring *);
@@ -119,7 +119,7 @@
 static void     ixgbe_enable_intr(struct adapter *);
 static void     ixgbe_disable_intr(struct adapter *);
 static void     ixgbe_update_stats_counters(struct adapter *);
-static boolean_t ixgbe_txeof(struct tx_ring *);
+static bool	ixgbe_txeof(struct tx_ring *);
 static int      ixgbe_rxeof(struct rx_ring *, int);
 static void	ixgbe_rx_checksum(struct adapter *, uint32_t, struct mbuf *);
 static void     ixgbe_set_promisc(struct adapter *);
@@ -133,6 +133,7 @@
 static int      ixgbe_encap(struct adapter *, struct mbuf **);
 static int      ixgbe_sysctl_stats(SYSCTL_HANDLER_ARGS);
 static int	ixgbe_sysctl_debug(SYSCTL_HANDLER_ARGS);
+static int	ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS);
 static int	ixgbe_dma_malloc(struct adapter *, bus_size_t,
 		    struct ixgbe_dma_alloc *, int);
 static void     ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *);
@@ -143,14 +144,23 @@
 static void	ixgbe_set_ivar(struct adapter *, u16, u8);
 static void	ixgbe_configure_ivars(struct adapter *);
 
-/* Legacy Interrupt handler */
-static void     ixgbe_intr(void *);
+/* Legacy Fast Interrupt routine and handlers */
+#if __FreeBSD_version >= 700000
+static int	ixgbe_fast_irq(void *);
+/* The MSI/X Interrupt handlers */
+static void	ixgbe_msix_tx(void *);
+static void	ixgbe_msix_rx(void *);
+static void	ixgbe_msix_link(void *);
+#else
+static void	ixgbe_fast_irq(void *);
+#endif
 
-/* The MSI/X Interrupt handlers */
-static void     ixgbe_txint(void *);
-static void     ixgbe_rxint(void *);
-static void     ixgbe_linkint(void *);
+static void	ixgbe_rxtx(void *context, int pending);
+static void	ixgbe_link(void *context, int pending);
 
+#ifndef NO_82598_A0_SUPPORT
+static void	desc_flip(void *);
+#endif
 
 /*********************************************************************
  *  FreeBSD Device Interface Entry Points
@@ -175,26 +185,40 @@
 MODULE_DEPEND(ixgbe, pci, 1, 1, 1);
 MODULE_DEPEND(ixgbe, ether, 1, 1, 1);
 
+/*
+** TUNEABLE PARAMETERS:
+*/
+
 /* How many packets rxeof tries to clean at a time */
 static int ixgbe_rx_process_limit = 100;
 TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit);
 
-/*
- * Should the driver do MSI/X and RSS/MQ?
- *	- default to MSI/X and RSS enabled
- */
-static int ixgbe_disable_msix = 0;
-TUNABLE_INT("hw.ixgbe.disable_msix", &ixgbe_disable_msix);
+/* Flow control setting, default to full */
+static int ixgbe_flow_control = 3;
+TUNABLE_INT("hw.ixgbe.flow_control", &ixgbe_flow_control);
+
+/* Number of TX Queues, note multi tx is not working */
+static int ixgbe_tx_queues = 1;
+TUNABLE_INT("hw.ixgbe.tx_queues", &ixgbe_tx_queues);
+
+/* Number of RX Queues */
+static int ixgbe_rx_queues = 8;
+TUNABLE_INT("hw.ixgbe.rx_queues", &ixgbe_rx_queues);
+
+/* Number of Other Queues, this is used for link interrupts */
+static int ixgbe_other_queues = 1;
+TUNABLE_INT("hw.ixgbe.other_queues", &ixgbe_other_queues);
+
+/* Number of TX descriptors per ring */
+static int ixgbe_txd = DEFAULT_TXD;
+TUNABLE_INT("hw.ixgbe.txd", &ixgbe_txd);
+
+/* Number of RX descriptors per ring */
+static int ixgbe_rxd = DEFAULT_RXD;
+TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd);
 
-/*
-** Flow control tuneable:
-** 	0 - off
-**	1 - rx pause
-**	2 - tx pause
-**	3 - full
-*/
-static int ixgbe_flow_control = 0;
-TUNABLE_INT("hw.ixgbe.flow_control", &ixgbe_flow_control);
+/* Total number of Interfaces - need for config sanity check */
+static int ixgbe_total_ports;
 
 /*********************************************************************
  *  Device identification routine
@@ -239,6 +263,15 @@
 			sprintf(adapter_name, "%s, Version - %s",
 				ixgbe_strings[ent->index],
 				ixgbe_driver_version);
+			switch (pci_device_id) {
+				case IXGBE_DEV_ID_82598AF_DUAL_PORT :
+					ixgbe_total_ports += 2;
+					break;
+				case IXGBE_DEV_ID_82598AF_SINGLE_PORT :
+					ixgbe_total_ports += 1;
+				default:
+					break;
+			}
 			device_set_desc_copy(dev, adapter_name);
 			return (0);
 		}
@@ -264,13 +297,17 @@
 	struct adapter *adapter;
 	int             error = 0;
 	uint32_t	ctrl_ext;
+	char		name_string[16];
 
 	INIT_DEBUGOUT("ixgbe_attach: begin");
 
 	/* Allocate, clear, and link in our adapter structure */
 	adapter = device_get_softc(dev);
 	adapter->dev = adapter->osdep.dev = dev;
-	IXGBE_LOCK_INIT(adapter, device_get_nameunit(dev));
+	/* General Lock Init*/
+	snprintf(name_string, sizeof(name_string), "%s:core",
+	    device_get_nameunit(dev));
+	mtx_init(&adapter->core_mtx, name_string, NULL, MTX_DEF);
 
 	/* SYSCTL APIs */
 	SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
@@ -283,25 +320,17 @@
 			OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RW,
 			adapter, 0, ixgbe_sysctl_debug, "I", "Debug Info");
 
-	SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+	SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
 			SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-			OID_AUTO, "flow control", CTLFLAG_RW,
-			&ixgbe_flow_control, 0, "Flow Control");
+			OID_AUTO, "flow_control", CTLTYPE_INT | CTLFLAG_RW,
+			adapter, 0, ixgbe_set_flowcntl, "I", "Flow Control");
 
 	/* Set up the timer callout */
-	callout_init_mtx(&adapter->timer, &adapter->mtx, 0);
+	callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0);
 
 	/* Determine hardware revision */
 	ixgbe_identify_hardware(adapter);
 
-	/*
-	** Descriptors: (configurable by user), note these are
-	** constant for all rings, I saw no reason to vary 
-	** them, but perhaps someone later would.
-	*/
-	adapter->num_tx_desc = DEFAULT_TXD;
-	adapter->num_rx_desc = DEFAULT_RXD;
-
 	/* Indicate to RX setup to use Jumbo Clusters */
 	adapter->bigbufs = TRUE;
 
@@ -312,17 +341,50 @@
 		goto err_out;
 	}
 
+	/* Do descriptor calc and sanity checks */
+	if (((ixgbe_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
+	    ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) {
+		device_printf(dev, "TXD config issue, using default!\n");
+		adapter->num_tx_desc = DEFAULT_TXD;
+	} else
+		adapter->num_tx_desc = ixgbe_txd;
+
+	/*
+	** With many RX rings it is easy to exceed the
+	** system mbuf allocation. Tuning nmbclusters
+	** can alleviate this.
+	*/
+	if ((adapter->num_rx_queues > 1) && (nmbclusters > 0 )){
+		int s;
+		/* Calculate the total RX mbuf needs */
+		s = (ixgbe_rxd * adapter->num_rx_queues) * ixgbe_total_ports;
+		if (s > nmbclusters) {
+			device_printf(dev, "RX Descriptors exceed "
+			    "system mbuf max, using default instead!\n");
+			ixgbe_rxd = DEFAULT_RXD;
+		}
+	}
+
+	if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
+	    ixgbe_rxd < MIN_TXD || ixgbe_rxd > MAX_TXD) {
+		device_printf(dev, "RXD config issue, using default!\n");
+		adapter->num_rx_desc = DEFAULT_RXD;
+	} else
+		adapter->num_rx_desc = ixgbe_rxd;
+
 	/* Allocate our TX/RX Queues */
 	if (ixgbe_allocate_queues(adapter)) {
 		error = ENOMEM;
 		goto err_out;
 	}
 
+#if __FreeBSD_version >= 700000
 	if (adapter->msix) {
 		error = ixgbe_setup_msix(adapter); 
 		if (error) 
 			goto err_out;
 	}
+#endif
 
 	/* Initialize the shared code */
 	if (ixgbe_init_shared_code(&adapter->hw)) {
@@ -382,14 +444,25 @@
 	INIT_DEBUGOUT("ixgbe_detach: begin");
 
 	/* Make sure VLANS are not using driver */
+#if __FreeBSD_version >= 700000
 	if (adapter->ifp->if_vlantrunk != NULL) {
+#else
+	if (adapter->ifp->if_nvlans != 0) {
+#endif
 		device_printf(dev,"Vlan in use, detach first\n");
 		return (EBUSY);
 	}
 
-	IXGBE_LOCK(adapter);
+	mtx_lock(&adapter->core_mtx);
 	ixgbe_stop(adapter);
-	IXGBE_UNLOCK(adapter);
+	mtx_unlock(&adapter->core_mtx);
+
+	if (adapter->tq != NULL) {
+		taskqueue_drain(adapter->tq, &adapter->rxtx_task);
+		taskqueue_drain(taskqueue_fast, &adapter->link_task);
+		taskqueue_free(adapter->tq);
+		adapter->tq = NULL;
+	}
 
 	/* let hardware know driver is unloading */
 	ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT);
@@ -405,7 +478,7 @@
 	ixgbe_free_transmit_structures(adapter);
 	ixgbe_free_receive_structures(adapter);
 
-	IXGBE_LOCK_DESTROY(adapter);
+	mtx_destroy(&adapter->core_mtx);
 	return (0);
 }
 
@@ -419,9 +492,9 @@
 ixgbe_shutdown(device_t dev)
 {
 	struct adapter *adapter = device_get_softc(dev);
-	IXGBE_LOCK(adapter);
+	mtx_lock(&adapter->core_mtx);
 	ixgbe_stop(adapter);
-	IXGBE_UNLOCK(adapter);
+	mtx_unlock(&adapter->core_mtx);
 	return (0);
 }
 
@@ -442,7 +515,7 @@
 	struct mbuf    *m_head;
 	struct adapter *adapter = ifp->if_softc;
 
-	IXGBE_LOCK_ASSERT(adapter);
+	mtx_assert(&adapter->tx_mtx, MA_OWNED);
 
 	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
 	    IFF_DRV_RUNNING)
@@ -464,7 +537,7 @@
 			break;
 		}
 		/* Send a copy of the frame to the BPF listener */
-		BPF_MTAP(ifp, m_head);
+		ETHER_BPF_MTAP(ifp, m_head);
 
 		/* Set timeout in case hardware has problems transmitting */
 		adapter->watchdog_timer = IXGBE_TX_TIMEOUT;
@@ -478,10 +551,10 @@
 {
 	struct adapter *adapter = ifp->if_softc;
 
-	IXGBE_LOCK(adapter);
+	mtx_lock(&adapter->tx_mtx);
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 		ixgbe_start_locked(ifp);
-	IXGBE_UNLOCK(adapter);
+	mtx_unlock(&adapter->tx_mtx);
 	return;
 }
 
@@ -508,9 +581,9 @@
 		if (ifa->ifa_addr->sa_family == AF_INET) {
 			ifp->if_flags |= IFF_UP;
 			if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
-				IXGBE_LOCK(adapter);
+				mtx_lock(&adapter->core_mtx);
 				ixgbe_init_locked(adapter);
-				IXGBE_UNLOCK(adapter);
+				mtx_unlock(&adapter->core_mtx);
 			}
 			arp_ifinit(ifp, ifa);
                 } else
@@ -521,17 +594,17 @@
 		if (ifr->ifr_mtu > IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN) {
 			error = EINVAL;
 		} else {
-			IXGBE_LOCK(adapter);
+			mtx_lock(&adapter->core_mtx);
 			ifp->if_mtu = ifr->ifr_mtu;
 			adapter->max_frame_size =
 				ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
 			ixgbe_init_locked(adapter);
-			IXGBE_UNLOCK(adapter);
+			mtx_unlock(&adapter->core_mtx);
 		}
 		break;
 	case SIOCSIFFLAGS:
 		IOCTL_DEBUGOUT("ioctl: SIOCSIFFLAGS (Set Interface Flags)");
-		IXGBE_LOCK(adapter);
+		mtx_lock(&adapter->core_mtx);
 		if (ifp->if_flags & IFF_UP) {
 			if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 				if ((ifp->if_flags ^ adapter->if_flags) &
@@ -545,17 +618,17 @@
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 				ixgbe_stop(adapter);
 		adapter->if_flags = ifp->if_flags;
-		IXGBE_UNLOCK(adapter);
+		mtx_unlock(&adapter->core_mtx);
 		break;
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		IOCTL_DEBUGOUT("ioctl: SIOC(ADD|DEL)MULTI");
 		if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-			IXGBE_LOCK(adapter);
+			mtx_lock(&adapter->core_mtx);
 			ixgbe_disable_intr(adapter);
 			ixgbe_set_multi(adapter);
 			ixgbe_enable_intr(adapter);
-			IXGBE_UNLOCK(adapter);
+			mtx_unlock(&adapter->core_mtx);
 		}
 		break;
 	case SIOCSIFMEDIA:
@@ -575,7 +648,9 @@
 			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
 		if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 			ixgbe_init(adapter);
+#if __FreeBSD_version >= 700000
 		VLAN_CAPABILITIES(ifp);
+#endif
 		break;
 	}
 	default:
@@ -598,7 +673,7 @@
 ixgbe_watchdog(struct adapter *adapter)
 {
 
-	IXGBE_LOCK_ASSERT(adapter);
+	mtx_assert(&adapter->core_mtx, MA_OWNED);
 
         /*
          * The timer is set to 5 every time ixgbe_start() queues a packet.
@@ -651,13 +726,15 @@
 
 	INIT_DEBUGOUT("ixgbe_init: begin");
 
-	IXGBE_LOCK_ASSERT(adapter);
+	mtx_assert(&adapter->core_mtx, MA_OWNED);
 
 	ixgbe_stop(adapter);
 
 	/* Get the latest mac address, User can use a LAA */
 	bcopy(IF_LLADDR(adapter->ifp), adapter->hw.mac.addr,
 	      IXGBE_ETH_LENGTH_OF_ADDRESS);
+	ixgbe_set_rar(&adapter->hw, 0, adapter->hw.mac.addr, 0, 1);
+	adapter->hw.addr_ctrl.rar_used_count = 1;
 
 	/* Initialize the hardware */
 	if (ixgbe_hardware_init(adapter)) {
@@ -756,60 +833,91 @@
 {
 	struct adapter *adapter = arg;
 
-	IXGBE_LOCK(adapter);
+	mtx_lock(&adapter->core_mtx);
 	ixgbe_init_locked(adapter);
-	IXGBE_UNLOCK(adapter);
+	mtx_unlock(&adapter->core_mtx);
 	return;
 }
 
 
+static void
+ixgbe_link(void *context, int pending)
+{
+        struct adapter  *adapter = context;
+        struct ifnet *ifp = adapter->ifp;
+
+        mtx_lock(&adapter->core_mtx);
+        if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+                mtx_unlock(&adapter->core_mtx);
+                return;
+        }
+
+        callout_stop(&adapter->timer);
+        ixgbe_update_link_status(adapter);
+        callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter);
+        mtx_unlock(&adapter->core_mtx);
+}
+
+/*
+** MSI and Legacy Deferred Handler
+**	- note this runs without the general lock
+*/
+static void
+ixgbe_rxtx(void *context, int pending)
+{
+        struct adapter  *adapter = context;
+        struct ifnet    *ifp = adapter->ifp;
+	/* For legacy there is only one of each */
+	struct rx_ring *rxr = adapter->rx_rings;
+	struct tx_ring *txr = adapter->tx_rings;
+
+        if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+                if (ixgbe_rxeof(rxr, adapter->rx_process_limit) != 0)
+                        taskqueue_enqueue(adapter->tq, &adapter->rxtx_task);
+                mtx_lock(&adapter->tx_mtx);
+                ixgbe_txeof(txr);
+
+                if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+                        ixgbe_start_locked(ifp);
+                mtx_unlock(&adapter->tx_mtx);
+        }
+
+        ixgbe_enable_intr(adapter);
+}
+
+
 /*********************************************************************
  *
  *  Legacy Interrupt Service routine
  *
  **********************************************************************/
 
+#if __FreeBSD_version >= 700000
+static int
+#else
 static void
-ixgbe_intr(void *arg)
+#endif
+ixgbe_fast_irq(void *arg)
 {
-	u32       loop_cnt = MAX_INTR;
 	u32       reg_eicr;
 	struct adapter *adapter = arg;
-	struct ifnet   *ifp = adapter->ifp;
-	struct rx_ring *rxr = adapter->rx_rings;
-	struct tx_ring *txr = adapter->tx_rings;
 
-	IXGBE_LOCK(adapter);
+	reg_eicr = IXGBE_READ_REG(&adapter->hw, IXGBE_EICR);
+	if (reg_eicr == 0)
+		return FILTER_STRAY;
 
-	reg_eicr = IXGBE_READ_REG(&adapter->hw, IXGBE_EICR);
-	if (reg_eicr == 0) {
-		IXGBE_UNLOCK(adapter);
-		return;
-	}
+        ixgbe_disable_intr(adapter);
+        taskqueue_enqueue(adapter->tq, &adapter->rxtx_task);
 
 	/* Link status change */
-	if (reg_eicr & IXGBE_EICR_LSC) {
-		callout_stop(&adapter->timer);
-		ixgbe_update_link_status(adapter);
-		callout_reset(&adapter->timer, hz,
-		    ixgbe_local_timer, adapter);
-	}
+	if (reg_eicr & IXGBE_EICR_LSC)
+        	taskqueue_enqueue(taskqueue_fast, &adapter->link_task);
 
-	while ((--loop_cnt > 0) && 
-	    (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
-			ixgbe_rxeof(rxr, adapter->rx_process_limit);
-			ixgbe_txeof(txr);
-	}
-
-	if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
-	    ifp->if_snd.ifq_head != NULL)
-		ixgbe_start_locked(ifp);
-
-	IXGBE_UNLOCK(adapter);
-	return;
+	return FILTER_HANDLED;
 }
 
 
+#if __FreeBSD_version >= 700000
 /*********************************************************************
  *
  *  MSI TX Interrupt Service routine
@@ -817,14 +925,14 @@
  **********************************************************************/
 
 void
-ixgbe_txint(void *arg)
+ixgbe_msix_tx(void *arg)
 {
 	struct tx_ring *txr = arg;
 	struct adapter *adapter = txr->adapter;
 	struct ifnet   *ifp = adapter->ifp;
 	uint32_t       loop_cnt = MAX_INTR;
 
-	IXGBE_LOCK(adapter);
+	mtx_lock(&adapter->tx_mtx);
 
 	while (loop_cnt > 0) {
 		if (__predict_false(!ixgbe_txeof(txr)))
@@ -836,7 +944,7 @@
 	    ifp->if_snd.ifq_head != NULL)
 		ixgbe_start_locked(ifp);
 	ixgbe_enable_intr(adapter);
-	IXGBE_UNLOCK(adapter);
+	mtx_unlock(&adapter->tx_mtx);
 	return;
 }
 
@@ -847,31 +955,27 @@
  **********************************************************************/
 
 static void
-ixgbe_rxint(void *arg)
+ixgbe_msix_rx(void *arg)
 {
 	struct rx_ring	*rxr = arg;
 	struct adapter	*adapter = rxr->adapter;
 	struct ifnet	*ifp = adapter->ifp;
-	//uint32_t       reg_eicr, loop = MAX_INTR;
 	uint32_t	loop = MAX_INTR;
 
 
-	IXGBE_LOCK(adapter);
-
 	while ((loop-- > 0) && (ifp->if_drv_flags & IFF_DRV_RUNNING))
 		ixgbe_rxeof(rxr, adapter->rx_process_limit);
 
 	ixgbe_enable_intr(adapter);
-	IXGBE_UNLOCK(adapter);
 }
 
 static void
-ixgbe_linkint(void *arg)
+ixgbe_msix_link(void *arg)
 {
 	struct adapter	*adapter = arg;
 	uint32_t       reg_eicr;
 
-	IXGBE_LOCK(adapter);
+	mtx_lock(&adapter->core_mtx);
 
 	reg_eicr = IXGBE_READ_REG(&adapter->hw, IXGBE_EICR);
 
@@ -884,8 +988,9 @@
 
 	IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_OTHER);
 	ixgbe_enable_intr(adapter);
-	IXGBE_UNLOCK(adapter);
+	mtx_unlock(&adapter->core_mtx);
 }
+#endif /*  __FreeBSD_version >= 700000 */
 
 /*********************************************************************
  *
@@ -966,6 +1071,7 @@
 	/* Basic descriptor defines */
         cmd_type_len |= IXGBE_ADVTXD_DTYP_DATA;
         cmd_type_len |= IXGBE_ADVTXD_DCMD_IFCS | IXGBE_ADVTXD_DCMD_DEXT;
+
 	if (m_head->m_flags & M_VLANTAG)
         	cmd_type_len |= IXGBE_ADVTXD_DCMD_VLE;
 
@@ -1086,6 +1192,10 @@
 		if (j == (nsegs -1)) /* Last descriptor gets EOP and RS */
 			txd->read.cmd_type_len |=
 			    htole32(IXGBE_TXD_CMD_EOP | IXGBE_TXD_CMD_RS);
+#ifndef NO_82598_A0_SUPPORT
+		if (adapter->hw.revision_id == 0)
+			desc_flip(txd);
+#endif
 	}
 
 	txr->tx_avail -= nsegs;
@@ -1211,7 +1321,7 @@
 	struct adapter *adapter = arg;
 	struct ifnet   *ifp = adapter->ifp;
 
-	IXGBE_LOCK_ASSERT(adapter);
+	mtx_assert(&adapter->core_mtx, MA_OWNED);
 
 	ixgbe_update_link_status(adapter);
 	ixgbe_update_stats_counters(adapter);
@@ -1273,7 +1383,7 @@
 	struct adapter *adapter = arg;
 	ifp = adapter->ifp;
 
-	IXGBE_LOCK_ASSERT(adapter);
+	mtx_assert(&adapter->core_mtx, MA_OWNED);
 
 	INIT_DEBUGOUT("ixgbe_stop: begin\n");
 	ixgbe_disable_intr(adapter);
@@ -1286,7 +1396,8 @@

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list