PERFORCE change 131465 for review

Robert Watson rwatson at FreeBSD.org
Sun Dec 23 04:02:24 PST 2007


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

Change 131465 by rwatson at rwatson_cinnamon on 2007/12/23 12:02:03

	Integrate zcopybpf branch.

Affected files ...

.. //depot/projects/zcopybpf/src/sys/arm/at91/at91.c#5 integrate
.. //depot/projects/zcopybpf/src/sys/boot/forth/support.4th#2 integrate
.. //depot/projects/zcopybpf/src/sys/conf/files.powerpc#7 integrate
.. //depot/projects/zcopybpf/src/sys/dev/aac/aac.c#5 integrate
.. //depot/projects/zcopybpf/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/dev/mfi/mfi.c#7 integrate
.. //depot/projects/zcopybpf/src/sys/dev/mfi/mfi_pci.c#5 integrate
.. //depot/projects/zcopybpf/src/sys/dev/ofw/openpromio.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/dev/powermac_nvram/powermac_nvram.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/dev/re/if_re.c#9 integrate
.. //depot/projects/zcopybpf/src/sys/dev/uart/uart_cpu_powerpc.c#3 integrate
.. //depot/projects/zcopybpf/src/sys/i386/pci/pci_pir.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/kern/init_main.c#7 integrate
.. //depot/projects/zcopybpf/src/sys/kern/kern_thread.c#9 integrate
.. //depot/projects/zcopybpf/src/sys/kern/sched_ule.c#11 integrate
.. //depot/projects/zcopybpf/src/sys/kern/subr_bus.c#6 integrate
.. //depot/projects/zcopybpf/src/sys/modules/cxgb/tom/Makefile#2 integrate
.. //depot/projects/zcopybpf/src/sys/netgraph/ng_car.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/netgraph/ng_car.h#2 integrate
.. //depot/projects/zcopybpf/src/sys/netinet/in_pcb.c#8 integrate
.. //depot/projects/zcopybpf/src/sys/netinet/tcp_offload.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/netinet/tcp_offload.h#2 integrate
.. //depot/projects/zcopybpf/src/sys/netinet/tcp_subr.c#12 integrate
.. //depot/projects/zcopybpf/src/sys/netinet/tcp_syncache.c#12 integrate
.. //depot/projects/zcopybpf/src/sys/netinet/tcp_usrreq.c#10 integrate
.. //depot/projects/zcopybpf/src/sys/powerpc/aim/ofw_machdep.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/powerpc/conf/NOTES#5 integrate
.. //depot/projects/zcopybpf/src/sys/powerpc/include/_bus.h#2 integrate
.. //depot/projects/zcopybpf/src/sys/powerpc/include/bus.h#2 integrate
.. //depot/projects/zcopybpf/src/sys/powerpc/powermac/grackle.c#3 integrate
.. //depot/projects/zcopybpf/src/sys/powerpc/powermac/macio.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/powerpc/powermac/uninorth.c#4 integrate
.. //depot/projects/zcopybpf/src/sys/powerpc/powerpc/bus_machdep.c#1 branch
.. //depot/projects/zcopybpf/src/sys/powerpc/psim/iobus.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/vm/vm_page.c#10 integrate
.. //depot/projects/zcopybpf/src/sys/vm/vm_phys.c#4 integrate
.. //depot/projects/zcopybpf/src/sys/vm/vm_phys.h#4 integrate

Differences ...

==== //depot/projects/zcopybpf/src/sys/arm/at91/at91.c#5 (text) ====

@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/at91.c,v 1.14 2007/12/17 05:08:54 kevlo Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/at91.c,v 1.15 2007/12/19 17:34:17 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -396,6 +396,48 @@
 
 #define NORMDEV 50
 
+/*
+ * Standard priority levels for the system.  0 is lowest and 7 is highest.
+ * These values are the ones Atmel uses for its Linux port, which differ
+ * a little form the ones that are in the standard distribution.  Also,
+ * the ones marked with 'TWEEK' are different based on experience.
+ */
+static int irq_prio[32] =
+{
+	7,	/* Advanced Interrupt Controller (FIQ) */
+	7,	/* System Peripherals */
+	1,	/* Parallel IO Controller A */
+	1,	/* Parallel IO Controller B */
+	1,	/* Parallel IO Controller C */
+	1,	/* Parallel IO Controller D */
+	5,	/* USART 0 */
+	5,	/* USART 1 */
+	5,	/* USART 2 */
+	5,	/* USART 3 */
+	0,	/* Multimedia Card Interface */
+	2,	/* USB Device Port */
+	4,	/* Two-Wire Interface */		/* TWEEK */
+	5,	/* Serial Peripheral Interface */
+	4,	/* Serial Synchronous Controller 0 */
+	6,	/* Serial Synchronous Controller 1 */	/* TWEEK */
+	4,	/* Serial Synchronous Controller 2 */
+	0,	/* Timer Counter 0 */
+	6,	/* Timer Counter 1 */			/* TWEEK */
+	0,	/* Timer Counter 2 */
+	0,	/* Timer Counter 3 */
+	0,	/* Timer Counter 4 */
+	0,	/* Timer Counter 5 */
+	2,	/* USB Host port */
+	3,	/* Ethernet MAC */
+	0,	/* Advanced Interrupt Controller (IRQ0) */
+	0,	/* Advanced Interrupt Controller (IRQ1) */
+	0,	/* Advanced Interrupt Controller (IRQ2) */
+	0,	/* Advanced Interrupt Controller (IRQ3) */
+	0,	/* Advanced Interrupt Controller (IRQ4) */
+	0,	/* Advanced Interrupt Controller (IRQ5) */
+ 	0	/* Advanced Interrupt Controller (IRQ6) */
+};
+
 static int
 at91_attach(device_t dev)
 {
@@ -432,13 +474,11 @@
 		bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SVR + 
 		    i * 4, i);
 		/* Priority. */
-		/* XXX: Give better priorities to IRQs */
 		bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SMR + i * 4,
-		    0);
+		    irq_prio[i]);
 		if (i < 8)
 			bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_EOICR,
 			    1);
-		    
 	}
 	bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SPU, 32);
 	/* No debug. */

==== //depot/projects/zcopybpf/src/sys/boot/forth/support.4th#2 (text+ko) ====

@@ -22,7 +22,7 @@
 \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 \ SUCH DAMAGE.
 \
-\ $FreeBSD: src/sys/boot/forth/support.4th,v 1.16 2006/10/13 20:48:17 ru Exp $
+\ $FreeBSD: src/sys/boot/forth/support.4th,v 1.17 2007/12/19 17:06:32 ambrisko Exp $
 
 \ Loader.rc support functions:
 \
@@ -463,8 +463,10 @@
 
 : digit?
   line_pointer c@ >r
+  r@ [char] - =
   r@ [char] 0 >=
   r> [char] 9 <= and
+  or
 ;
 
 : quote?

==== //depot/projects/zcopybpf/src/sys/conf/files.powerpc#7 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.powerpc,v 1.70 2007/12/16 01:02:47 marcel Exp $
+# $FreeBSD: src/sys/conf/files.powerpc,v 1.71 2007/12/19 18:00:48 marcel Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -85,6 +85,7 @@
 powerpc/powerpc/atomic.S	standard
 powerpc/powerpc/autoconf.c	standard
 powerpc/powerpc/bcopy.c		standard
+powerpc/powerpc/bus_machdep.c	standard
 powerpc/powerpc/busdma_machdep.c standard
 powerpc/powerpc/copystr.c	standard
 powerpc/powerpc/cpu.c		standard

==== //depot/projects/zcopybpf/src/sys/dev/aac/aac.c#5 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.125 2007/12/07 18:05:41 emaste Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.127 2007/12/20 21:13:58 emaste Exp $");
 
 /*
  * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters.
@@ -2980,15 +2980,13 @@
 
 	switch (event->ev_type) {
 	case AAC_EVENT_CMFREE:
-		mtx_lock(&sc->aac_io_lock);
+		mtx_assert(&sc->aac_io_lock, MA_OWNED);
 		if (aac_alloc_command(sc, (struct aac_command **)arg)) {
 			aac_add_event(sc, event);
-			mtx_unlock(&sc->aac_io_lock);
 			return;
 		}
 		free(event, M_AACBUF);
 		wakeup(arg);
-		mtx_unlock(&sc->aac_io_lock);
 		break;
 	default:
 		break;
@@ -3019,6 +3017,7 @@
 		    M_NOWAIT | M_ZERO);
 		if (event == NULL) {
 			error = EBUSY;
+			mtx_unlock(&sc->aac_io_lock);
 			goto out;
 		}
 		event->ev_type = AAC_EVENT_CMFREE;
@@ -3050,12 +3049,13 @@
 	 * Pass the FIB to the controller, wait for it to complete.
 	 */
 	mtx_lock(&sc->aac_io_lock);
-	if ((error = aac_wait_command(cm)) != 0) {
+	error = aac_wait_command(cm);
+	mtx_unlock(&sc->aac_io_lock);
+	if (error != 0) {
 		device_printf(sc->aac_dev,
 			      "aac_wait_command return %d\n", error);
 		goto out;
 	}
-	mtx_unlock(&sc->aac_io_lock);
 
 	/*
 	 * Copy the FIB and data back out to the caller.
@@ -3067,14 +3067,13 @@
 		size = sizeof(struct aac_fib);
 	}
 	error = copyout(cm->cm_fib, ufib, size);
-	mtx_lock(&sc->aac_io_lock);
 
 out:
 	if (cm != NULL) {
+		mtx_lock(&sc->aac_io_lock);
 		aac_release_command(cm);
+		mtx_unlock(&sc->aac_io_lock);
 	}
-
-	mtx_unlock(&sc->aac_io_lock);
 	return(error);
 }
 

==== //depot/projects/zcopybpf/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
 ***************************************************************************/
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c,v 1.2 2007/12/17 08:17:50 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c,v 1.3 2007/12/18 23:00:25 kmacy Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -110,6 +110,7 @@
 	prp = pffindtype(AF_INET, SOCK_STREAM);
 	pru_sosend = prp->pr_usrreqs->pru_sosend;
 	pru_soreceive = prp->pr_usrreqs->pru_soreceive;
+#ifdef TCP_USRREQS_OVERLOAD	
 	tcp_usrreqs.pru_connect = cxgb_tcp_usrreqs.pru_connect;
 	tcp_usrreqs.pru_abort = cxgb_tcp_usrreqs.pru_abort;
 	tcp_usrreqs.pru_listen = cxgb_tcp_usrreqs.pru_listen;
@@ -119,6 +120,7 @@
 	tcp_usrreqs.pru_close = cxgb_tcp_usrreqs.pru_close;
 	tcp_usrreqs.pru_shutdown = cxgb_tcp_usrreqs.pru_shutdown;
 	tcp_usrreqs.pru_rcvd = cxgb_tcp_usrreqs.pru_rcvd;
+#endif
 }
 
 

==== //depot/projects/zcopybpf/src/sys/dev/mfi/mfi.c#7 (text) ====

@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.33 2007/08/25 23:58:44 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.34 2007/12/19 17:22:07 ambrisko Exp $");
 
 #include "opt_mfi.h"
 
@@ -774,16 +774,12 @@
 				free(log_state, M_MFIBUF);
 			return (error);
 		}
-		/*
-		 * Don't run them yet since we can't parse them.
-		 * We can indirectly get the contents from
-		 * the AEN mechanism via setting it lower then
-		 * current.  The firmware will iterate through them.
-		 */
+		/* The message log is a circular buffer */
 		for (seq = log_state->shutdown_seq_num;
-		     seq <= log_state->newest_seq_num; seq++) {
+		     seq != log_state->newest_seq_num; seq++) {
 			mfi_get_entry(sc, seq);
 		}
+		mfi_get_entry(sc, seq);
 	} else
 		seq = seq_start;
 	mfi_aen_register(sc, seq, class_locale.word);

==== //depot/projects/zcopybpf/src/sys/dev/mfi/mfi_pci.c#5 (text) ====

@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_pci.c,v 1.9 2007/08/25 23:58:45 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_pci.c,v 1.10 2007/12/19 17:23:47 ambrisko Exp $");
 
 /* PCI/PCI-X/PCIe bus interface for the LSI MegaSAS controllers */
 
@@ -117,6 +117,7 @@
 	{0x1000, 0x0411, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Brocton IOP */
 	{0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */
 	{0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"},
+	{0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078,  "Dell PERC 6"},
 	{0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078,  "LSI MegaSAS 1078"},
 	{0, 0, 0, 0, 0, NULL}
 };

==== //depot/projects/zcopybpf/src/sys/dev/ofw/openpromio.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ofw/openpromio.c,v 1.7 2005/05/19 15:23:17 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ofw/openpromio.c,v 1.8 2007/12/20 00:31:04 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -101,12 +101,17 @@
 	char *buf;
 	int error;
 
+	if ((flags & FREAD) == 0)
+		return (EPERM);
+
 	prop = buf = NULL;
 	error = 0;
-	oprom = *(void **)data;
 	switch (cmd) {
 	case OPROMCHILD:
 	case OPROMNEXT:
+		if (data == NULL || *(void **)data == NULL)
+			return (EINVAL);
+		oprom = *(void **)data;
 		error = copyin(&oprom->oprom_size, &len, sizeof(len));
 		if (error != 0)
 			break;
@@ -135,6 +140,9 @@
 		break;
 	case OPROMGETPROP:
 	case OPROMNXTPROP:
+		if (data == NULL || *(void **)data == NULL)
+			return (EINVAL);
+		oprom = *(void **)data;
 		error = copyin(&oprom->oprom_size, &len, sizeof(len));
 		if (error != 0)
 			break;

==== //depot/projects/zcopybpf/src/sys/dev/powermac_nvram/powermac_nvram.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/powermac_nvram/powermac_nvram.c,v 1.1 2006/08/01 22:19:00 sobomax Exp $
+ * $FreeBSD: src/sys/dev/powermac_nvram/powermac_nvram.c,v 1.2 2007/12/19 18:00:48 marcel Exp $
  */
 
 #include <sys/param.h>
@@ -40,6 +40,7 @@
 #include <machine/bus.h>
 #include <machine/md_var.h>
 #include <machine/nexusvar.h>
+#include <machine/pio.h>
 #include <machine/resource.h>
 
 #include <sys/rman.h>

==== //depot/projects/zcopybpf/src/sys/dev/re/if_re.c#9 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.99 2007/12/08 00:14:09 yongari Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.100 2007/12/20 07:26:20 yongari Exp $");
 
 /*
  * RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
@@ -643,8 +643,12 @@
 	if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
 		if (ifp->if_flags & IFF_PROMISC)
 			rxfilt |= RL_RXCFG_RX_ALLPHYS;
-		if (ifp->if_flags & IFF_ALLMULTI)
-			rxfilt |= RL_RXCFG_RX_MULTI;
+		/*
+		 * Unlike other hardwares, we have to explicitly set
+		 * RL_RXCFG_RX_MULTI to receive multicast frames in
+		 * promiscuous mode.
+		 */
+		rxfilt |= RL_RXCFG_RX_MULTI;
 		CSR_WRITE_4(sc, RL_RXCFG, rxfilt);
 		CSR_WRITE_4(sc, RL_MAR0, 0xFFFFFFFF);
 		CSR_WRITE_4(sc, RL_MAR4, 0xFFFFFFFF);

==== //depot/projects/zcopybpf/src/sys/dev/uart/uart_cpu_powerpc.c#3 (text) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_cpu_powerpc.c,v 1.3 2007/04/02 22:00:22 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_cpu_powerpc.c,v 1.4 2007/12/19 18:00:49 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -38,8 +38,8 @@
 #include <dev/uart/uart.h>
 #include <dev/uart/uart_cpu.h>
 
-bus_space_tag_t uart_bus_space_io = PPC_BUS_SPACE_IO;
-bus_space_tag_t uart_bus_space_mem = PPC_BUS_SPACE_MEM;
+bus_space_tag_t uart_bus_space_io = &bs_le_tag;
+bus_space_tag_t uart_bus_space_mem = &bs_le_tag;
 
 int
 uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)

==== //depot/projects/zcopybpf/src/sys/i386/pci/pci_pir.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/pci/pci_pir.c,v 1.120 2006/11/09 18:03:36 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/pci/pci_pir.c,v 1.121 2007/12/21 16:53:27 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -398,12 +398,6 @@
 		pci_pir_dump_links();
 	}
 
-	/* Check for unique IRQ masks. */
-	TAILQ_FOREACH(pci_link, &pci_links, pl_links) {
-		if (pci_link->pl_irqmask != 0 && powerof2(pci_link->pl_irqmask))
-			pci_link->pl_irq = ffs(pci_link->pl_irqmask) - 1;
-	}
-
 	/*
 	 * Check to see if the BIOS has already routed any of the links by
 	 * checking each device connected to each link to see if it has a
@@ -516,15 +510,20 @@
 	}
 
 	/*
-	 * Pick a new interrupt if we don't have one already.  We look for
-	 * an interrupt from several different sets.  First, we check the
-	 * set of PCI only interrupts from the $PIR.  Second, we check the
-	 * set of known-good interrupts that the BIOS has already used.
-	 * Lastly, we check the "all possible valid IRQs" set.
+	 * Pick a new interrupt if we don't have one already.  We look
+	 * for an interrupt from several different sets.  First, if
+	 * this link only has one valid IRQ, use that.  Second, we
+	 * check the set of PCI only interrupts from the $PIR.  Third,
+	 * we check the set of known-good interrupts that the BIOS has
+	 * already used.  Lastly, we check the "all possible valid
+	 * IRQs" set.
 	 */
 	if (!PCI_INTERRUPT_VALID(pci_link->pl_irq)) {
-		irq = pci_pir_choose_irq(pci_link,
-		    pci_route_table->pt_header.ph_pci_irqs);
+		if (pci_link->pl_irqmask != 0 && powerof2(pci_link->pl_irqmask))
+			irq = ffs(pci_link->pl_irqmask) - 1;
+		else
+			irq = pci_pir_choose_irq(pci_link,
+			    pci_route_table->pt_header.ph_pci_irqs);
 		if (!PCI_INTERRUPT_VALID(irq))
 			irq = pci_pir_choose_irq(pci_link, pir_bios_irqs);
 		if (!PCI_INTERRUPT_VALID(irq))

==== //depot/projects/zcopybpf/src/sys/kern/init_main.c#7 (text+ko) ====

@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.288 2007/12/04 12:28:07 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.289 2007/12/22 04:56:48 julian Exp $");
 
 #include "opt_ddb.h"
 #include "opt_init_path.h"
@@ -421,6 +421,7 @@
 	knlist_init(&p->p_klist, &p->p_mtx, NULL, NULL, NULL);
 	STAILQ_INIT(&p->p_ktr);
 	p->p_nice = NZERO;
+	td->td_tid = PID_MAX + 1;
 	td->td_state = TDS_RUNNING;
 	td->td_pri_class = PRI_TIMESHARE;
 	td->td_user_pri = PUSER;

==== //depot/projects/zcopybpf/src/sys/kern/kern_thread.c#9 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.264 2007/12/16 06:21:19 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.265 2007/12/22 04:56:48 julian Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -251,7 +251,8 @@
 {
 
 	mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF);
-	tid_unrhdr = new_unrhdr(PID_MAX + 1, INT_MAX, &tid_lock);
+	/* leave one number for thread0 */
+	tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock);
 
 	thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(),
 	    thread_ctor, thread_dtor, thread_init, thread_fini,

==== //depot/projects/zcopybpf/src/sys/kern/sched_ule.c#11 (text+ko) ====

@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.219 2007/12/15 23:13:31 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.220 2007/12/21 23:30:18 wkoszek Exp $");
 
 #include "opt_hwpmc_hooks.h"
 #include "opt_sched.h"
@@ -1758,6 +1758,23 @@
 }
 
 /*
+ * Block a thread for switching.  Similar to thread_block() but does not
+ * bump the spin count.
+ */
+static inline struct mtx *
+thread_block_switch(struct thread *td)
+{
+	struct mtx *lock;
+
+	THREAD_LOCK_ASSERT(td, MA_OWNED);
+	lock = td->td_lock;
+	td->td_lock = &blocked_lock;
+	mtx_unlock_spin(lock);
+
+	return (lock);
+}
+
+/*
  * Handle migration from sched_switch().  This happens only for
  * cpu binding.
  */
@@ -1794,23 +1811,6 @@
 }
 
 /*
- * Block a thread for switching.  Similar to thread_block() but does not
- * bump the spin count.
- */
-static inline struct mtx *
-thread_block_switch(struct thread *td)
-{
-	struct mtx *lock;
-
-	THREAD_LOCK_ASSERT(td, MA_OWNED);
-	lock = td->td_lock;
-	td->td_lock = &blocked_lock;
-	mtx_unlock_spin(lock);
-
-	return (lock);
-}
-
-/*
  * Release a thread that was blocked with thread_block_switch().
  */
 static inline void

==== //depot/projects/zcopybpf/src/sys/kern/subr_bus.c#6 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/subr_bus.c,v 1.202 2007/11/30 21:30:14 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/subr_bus.c,v 1.203 2007/12/19 22:05:07 imp Exp $");
 
 #include "opt_bus.h"
 
@@ -1220,13 +1220,16 @@
  * @brief Get the maximum unit number used in a devclass
  *
  * Note that this is one greater than the highest currently-allocated
- * unit.
+ * unit.  If a null devclass_t is passed in, -1 is returned to indicate
+ * that not even the devclass has been allocated yet.
  *
  * @param dc		the devclass to examine
  */
 int
 devclass_get_maxunit(devclass_t dc)
 {
+	if (dc == NULL)
+		return (-1);
 	return (dc->maxunit);
 }
 

==== //depot/projects/zcopybpf/src/sys/modules/cxgb/tom/Makefile#2 (text+ko) ====

@@ -1,10 +1,10 @@
-# $FreeBSD: src/sys/modules/cxgb/tom/Makefile,v 1.2 2007/12/17 08:17:51 kmacy Exp $
+# $FreeBSD: src/sys/modules/cxgb/tom/Makefile,v 1.3 2007/12/18 23:00:25 kmacy Exp $
 TOM = ${.CURDIR}/../../../dev/cxgb/ulp/tom
 .PATH: ${TOM} 
 
 KMOD=	tom
 SRCS=   cxgb_tom.c cxgb_cpl_io.c cxgb_listen.c cxgb_tom_sysctl.c cxgb_cpl_socket.c
-SRCS+=  cxgb_tcp_subr.c cxgb_tcp_usrreq.c
+#SRCS+=  cxgb_tcp_subr.c cxgb_tcp_usrreq.c
 SRCS+=	opt_compat.h opt_inet.h opt_inet6.h opt_ipsec.h opt_mac.h opt_tcpdebug.h opt_ddb.h
 SRCS+=	device_if.h bus_if.h pci_if.h
 

==== //depot/projects/zcopybpf/src/sys/netgraph/ng_car.c#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/netgraph/ng_car.c,v 1.4 2007/06/13 11:01:17 mav Exp $
+ * $FreeBSD: src/sys/netgraph/ng_car.c,v 1.5 2007/12/19 22:50:14 mav Exp $
  */
 
 /*
@@ -263,6 +263,7 @@
 	hook_p dest = hinfo->dest;
 	struct mbuf *m = NULL;
 	int error = 0;
+	int len;
 
 	/* Node is useless without destination hook. */
 	if (dest == NULL) {
@@ -298,11 +299,18 @@
 		}					\
 	} while (0)
 
+	/* Packet is counted as 128 tokens for better resolution */
+	if (hinfo->conf.opt & NG_CAR_COUNT_PACKETS) {
+		len = 128;
+	} else {
+		len = m->m_pkthdr.len;
+	}
+
 	/* Check commited token bucket. */
-	if (hinfo->tc - m->m_pkthdr.len >= 0) {
+	if (hinfo->tc - len >= 0) {
 		/* This packet is green. */
 		++hinfo->stats.green_pkts;
-		hinfo->tc -= m->m_pkthdr.len;
+		hinfo->tc -= len;
 		NG_CAR_PERFORM_MATCH_ACTION(hinfo->conf.green_action);
 	} else {
 
@@ -310,10 +318,10 @@
 		ng_car_refillhook(hinfo);
 
 		 /* Check commited token bucket again after refill. */
-		if (hinfo->tc - m->m_pkthdr.len >= 0) {
+		if (hinfo->tc - len >= 0) {
 			/* This packet is green */
 			++hinfo->stats.green_pkts;
-			hinfo->tc -= m->m_pkthdr.len;
+			hinfo->tc -= len;
 			NG_CAR_PERFORM_MATCH_ACTION(hinfo->conf.green_action);
 
 		/* If not green and mode is SHAPE, enqueue packet. */
@@ -324,8 +332,7 @@
 		/* If not green and mode is RED, calculate probability. */
 		} else if (hinfo->conf.mode == NG_CAR_RED) {
 			/* Is packet is bigger then extended burst? */
-			if (m->m_pkthdr.len - (hinfo->tc - m->m_pkthdr.len) >
-			    hinfo->conf.ebs) {
+			if (len - (hinfo->tc - len) > hinfo->conf.ebs) {
 				/* This packet is definitely red. */
 				++hinfo->stats.red_pkts;
 				hinfo->te = 0;
@@ -333,13 +340,13 @@
 
 			/* Use token bucket to simulate RED-like drop
 			   probability. */
-			} else if (hinfo->te + (m->m_pkthdr.len - hinfo->tc) <
+			} else if (hinfo->te + (len - hinfo->tc) <
 			    hinfo->conf.ebs) {
 				/* This packet is yellow */
 				++hinfo->stats.yellow_pkts;
-				hinfo->te += m->m_pkthdr.len - hinfo->tc;
+				hinfo->te += len - hinfo->tc;
 				/* Go to negative tokens. */
-				hinfo->tc -= m->m_pkthdr.len;
+				hinfo->tc -= len;
 				NG_CAR_PERFORM_MATCH_ACTION(hinfo->conf.yellow_action);
 			} else {
 				/* This packet is probaly red. */
@@ -350,10 +357,10 @@
 		/* If not green and mode is SINGLE/DOUBLE RATE. */
 		} else {
 			/* Check extended token bucket. */
-			if (hinfo->te - m->m_pkthdr.len >= 0) {
+			if (hinfo->te - len >= 0) {
 				/* This packet is yellow */
 				++hinfo->stats.yellow_pkts;
-				hinfo->te -= m->m_pkthdr.len;
+				hinfo->te -= len;
 				NG_CAR_PERFORM_MATCH_ACTION(hinfo->conf.yellow_action);
 			} else {
 				/* This packet is red */
@@ -430,6 +437,19 @@
 				    sizeof(bconf->downstream));
 				bcopy(&priv->lower.conf, &bconf->upstream,
 				    sizeof(bconf->upstream));
+				/* Convert internal 1/(8*128) of pps into pps */
+				if (bconf->downstream.opt & NG_CAR_COUNT_PACKETS) {
+				    bconf->downstream.cir /= 1024;
+				    bconf->downstream.pir /= 1024;
+				    bconf->downstream.cbs /= 128;
+				    bconf->downstream.ebs /= 128;
+				}
+				if (bconf->upstream.opt & NG_CAR_COUNT_PACKETS) {
+				    bconf->upstream.cir /= 1024;
+				    bconf->upstream.pir /= 1024;
+				    bconf->upstream.cbs /= 128;
+				    bconf->upstream.ebs /= 128;
+				}
 			}
 			break;
 		case NGM_CAR_SET_CONF:
@@ -438,19 +458,45 @@
 				(struct ng_car_bulkconf *)msg->data;
 
 				/* Check for invalid or illegal config. */
-				if ((msg->header.arglen != sizeof(*bconf))
-				    || (bconf->downstream.cir > 1000000000)
-				    || (bconf->downstream.pir > 1000000000)
-				    || (bconf->upstream.cir > 1000000000)
-				    || (bconf->upstream.pir > 1000000000)
-				    || (bconf->downstream.cbs == 0
-					&& bconf->downstream.ebs == 0)
-				    || (bconf->upstream.cbs == 0
-					&& bconf->upstream.ebs == 0))
+				if (msg->header.arglen != sizeof(*bconf)) {
+					error = EINVAL;
+					break;
+				}
+				/* Convert pps into internal 1/(8*128) of pps */
+				if (bconf->downstream.opt & NG_CAR_COUNT_PACKETS) {
+				    bconf->downstream.cir *= 1024;
+				    bconf->downstream.pir *= 1024;
+				    bconf->downstream.cbs *= 125;
+				    bconf->downstream.ebs *= 125;
+				}
+				if (bconf->upstream.opt & NG_CAR_COUNT_PACKETS) {
+				    bconf->upstream.cir *= 1024;
+				    bconf->upstream.pir *= 1024;
+				    bconf->upstream.cbs *= 125;
+				    bconf->upstream.ebs *= 125;
+				}
+				if ((bconf->downstream.cir > 1000000000) ||
+				    (bconf->downstream.pir > 1000000000) ||
+				    (bconf->upstream.cir > 1000000000) ||
+				    (bconf->upstream.pir > 1000000000) ||
+				    (bconf->downstream.cbs == 0 &&
+					bconf->downstream.ebs == 0) ||
+				    (bconf->upstream.cbs == 0 &&
+					bconf->upstream.ebs == 0))
 				{
 					error = EINVAL;
 					break;
 				}
+				if ((bconf->upstream.mode == NG_CAR_SHAPE) &&
+				    (bconf->upstream.cir == 0)) {
+					error = EINVAL;
+					break;
+				}
+				if ((bconf->downstream.mode == NG_CAR_SHAPE) &&
+				    (bconf->downstream.cir == 0)) {
+					error = EINVAL;
+					break;
+				}
 
 				/* Copy downstream config. */
 				bcopy(&bconf->downstream, &priv->upper.conf,
@@ -653,7 +699,11 @@
 
 			/* If we have more packet, try it. */
 			m = hinfo->q[hinfo->q_first];
-			hinfo->tc -= m->m_pkthdr.len;
+			if (hinfo->conf.opt & NG_CAR_COUNT_PACKETS) {
+				hinfo->tc -= 128;
+			} else {
+				hinfo->tc -= m->m_pkthdr.len;
+			}
 		}
 	}
 
@@ -707,7 +757,11 @@
 
 		/* If this is a first packet in the queue. */
 		if (len == 0) {
-			hinfo->tc -= m->m_pkthdr.len;
+			if (hinfo->conf.opt & NG_CAR_COUNT_PACKETS) {
+				hinfo->tc -= 128;
+			} else {
+				hinfo->tc -= m->m_pkthdr.len;
+			}
 
 			/* Schedule queue processing. */
 			ng_car_schedule(hinfo);

==== //depot/projects/zcopybpf/src/sys/netgraph/ng_car.h#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/netgraph/ng_car.h,v 1.1 2007/05/15 16:09:23 mav Exp $
+ * $FreeBSD: src/sys/netgraph/ng_car.h,v 1.2 2007/12/19 22:50:14 mav Exp $
  */
 
 #ifndef _NETGRAPH_NG_CAR_H_
@@ -115,6 +115,7 @@
 
 /* mode options (opt) */
 #define NG_CAR_COLOR_AWARE	1
+#define NG_CAR_COUNT_PACKETS	2
 
 /* Bulk config */
 struct ng_car_bulkconf {

==== //depot/projects/zcopybpf/src/sys/netinet/in_pcb.c#8 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/in_pcb.c,v 1.197 2007/10/24 19:03:58 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/in_pcb.c,v 1.198 2007/12/22 10:06:11 rwatson Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipsec.h"
@@ -197,8 +197,12 @@
 
 #ifdef IPSEC
 	error = ipsec_init_policy(so, &inp->inp_sp);
-	if (error != 0)
+	if (error != 0) {
+#ifdef MAC
+		mac_inpcb_destroy(inp);
+#endif
 		goto out;
+}
 #endif /*IPSEC*/
 #ifdef INET6
 	if (INP_SOCKAF(so) == AF_INET6) {

==== //depot/projects/zcopybpf/src/sys/netinet/tcp_offload.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/tcp_offload.c,v 1.1 2007/12/17 07:56:27 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/tcp_offload.c,v 1.2 2007/12/19 05:17:40 kmacy Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,23 +72,17 @@
 
 	ifp = rt->rt_ifp;
 	if ((ifp->if_capenable & IFCAP_TOE) == 0) {
-		printf("no toe capability on %p\n", ifp);
-		
 		error = EINVAL;
 		goto fail;
 	}
 	
 	tdev = TOEDEV(ifp);
 	if (tdev == NULL) {
-		printf("tdev not set\n");
-
 		error = EPERM;
 		goto fail;
 	}
 	
 	if (tdev->tod_can_offload(tdev, so) == 0) {
-		printf("not offloadable\n");
-
 		error = EPERM;
 		goto fail;
 	}

==== //depot/projects/zcopybpf/src/sys/netinet/tcp_offload.h#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/netinet/tcp_offload.h,v 1.1 2007/12/17 07:56:27 kmacy Exp $
+ * $FreeBSD: src/sys/netinet/tcp_offload.h,v 1.2 2007/12/18 22:59:07 kmacy Exp $
  */
 
 #ifndef _NETINET_TCP_OFFLOAD_H_
@@ -216,8 +216,10 @@
 int	tcp_offload_connect(struct socket *so, struct sockaddr *nam);
 
 /*
- * The tcp_gen_* routines are wrappers around the toe_usrreqs calls,
- * in the non-offloaded case they translate to tcp_output.
+ * The tcp_output_* routines are wrappers around the toe_usrreqs calls
+ * which trigger packet transmission. In the non-offloaded case they
+ * translate to tcp_output. The tcp_offload_* routines notify TOE
+ * of specific events. I the non-offloaded case they are no-ops.
  *
  * Listen is a special case because it is a 1 to many relationship
  * and there can be more than one offload driver in the system.
@@ -233,7 +235,7 @@
 #define	SO_OFFLOADABLE(so)	((so->so_options & SO_NO_OFFLOAD) == 0)
 
 static __inline int
-tcp_gen_connect(struct socket *so, struct sockaddr *nam)
+tcp_output_connect(struct socket *so, struct sockaddr *nam)
 {
 	struct tcpcb *tp = sototcpcb(so);
 	int error;
@@ -251,7 +253,7 @@
 }
 
 static __inline int
-tcp_gen_send(struct tcpcb *tp)
+tcp_output_send(struct tcpcb *tp)
 {
 
 #ifndef TCP_OFFLOAD_DISABLE
@@ -262,7 +264,7 @@
 }
 
 static __inline int
-tcp_gen_rcvd(struct tcpcb *tp)
+tcp_output_rcvd(struct tcpcb *tp)
 {
 
 #ifndef TCP_OFFLOAD_DISABLE
@@ -273,7 +275,7 @@
 }
 
 static __inline int
-tcp_gen_disconnect(struct tcpcb *tp)
+tcp_output_disconnect(struct tcpcb *tp)
 {
 
 #ifndef TCP_OFFLOAD_DISABLE
@@ -284,7 +286,7 @@
 }
 
 static __inline int
-tcp_gen_reset(struct tcpcb *tp)
+tcp_output_reset(struct tcpcb *tp)
 {
 
 #ifndef TCP_OFFLOAD_DISABLE
@@ -295,7 +297,7 @@
 }
 
 static __inline void
-tcp_gen_detach(struct tcpcb *tp)
+tcp_offload_detach(struct tcpcb *tp)
 {
 
 #ifndef TCP_OFFLOAD_DISABLE
@@ -305,7 +307,7 @@
 }
 
 static __inline void
-tcp_gen_listen_open(struct tcpcb *tp)
+tcp_offload_listen_open(struct tcpcb *tp)
 {
 
 #ifndef TCP_OFFLOAD_DISABLE
@@ -315,7 +317,7 @@
 }
 
 static __inline void
-tcp_gen_listen_close(struct tcpcb *tp)
+tcp_offload_listen_close(struct tcpcb *tp)
 {
 
 #ifndef TCP_OFFLOAD_DISABLE

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


More information about the p4-projects mailing list