ia64/xen-unstable

changeset 12660:d8c32fa3e3a9

merge with xen-unstable.hg
author awilliam@xenbuild.aw
date Wed Nov 29 11:07:28 2006 -0700 (2006-11-29)
parents d54bcabd0624 463bda167715
children 52e6bf6dc744
files patches/linux-2.6.16.32/blktap-aio-16_03_06.patch patches/linux-2.6.16.32/device_bind.patch patches/linux-2.6.16.32/fix-hz-suspend.patch patches/linux-2.6.16.32/fix-ide-cd-pio-mode.patch patches/linux-2.6.16.32/i386-mach-io-check-nmi.patch patches/linux-2.6.16.32/ipv6-no-autoconf.patch patches/linux-2.6.16.32/kasprintf.patch patches/linux-2.6.16.32/net-csum.patch patches/linux-2.6.16.32/net-gso-0-base.patch patches/linux-2.6.16.32/net-gso-1-check-dodgy.patch patches/linux-2.6.16.32/net-gso-2-checksum-fix.patch patches/linux-2.6.16.32/net-gso-3-fix-errorcheck.patch patches/linux-2.6.16.32/net-gso-4-kill-warnon.patch patches/linux-2.6.16.32/net-gso-5-rcv-mss.patch patches/linux-2.6.16.32/pci-mmconfig-fix-from-2.6.17.patch patches/linux-2.6.16.32/pmd-shared.patch patches/linux-2.6.16.32/rcu_needs_cpu.patch patches/linux-2.6.16.32/rename-TSS_sysenter_esp0-SYSENTER_stack_esp0.patch patches/linux-2.6.16.32/series patches/linux-2.6.16.32/smp-alts.patch patches/linux-2.6.16.32/tpm_plugin_2.6.17.patch patches/linux-2.6.16.32/vsnprintf.patch patches/linux-2.6.16.32/x86-elfnote-as-preprocessor-macro.patch patches/linux-2.6.16.32/x86-increase-interrupt-vector-range.patch patches/linux-2.6.16.32/x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch patches/linux-2.6.16.32/x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch patches/linux-2.6.16.32/xen-hotplug.patch patches/linux-2.6.16.32/xenoprof-generic.patch tools/firmware/hvmloader/acpi_ssdt_tpm.asl tools/firmware/hvmloader/acpi_ssdt_tpm.h tools/firmware/hvmloader/acpi_utils.c tools/firmware/hvmloader/acpi_utils.h xen/include/asm-ia64/config.h
line diff
     1.1 --- a/Config.mk	Wed Nov 29 11:05:02 2006 -0700
     1.2 +++ b/Config.mk	Wed Nov 29 11:07:28 2006 -0700
     1.3 @@ -71,5 +71,6 @@ ACM_DEFAULT_SECURITY_POLICY ?= ACM_NULL_
     1.4  XENSTAT_XENTOP ?= y
     1.5  
     1.6  VTPM_TOOLS ?= n
     1.7 +LIBXENAPI_BINDINGS ?= n
     1.8  
     1.9  -include $(XEN_ROOT)/.config
     2.1 --- a/buildconfigs/mk.linux-2.6-xen	Wed Nov 29 11:05:02 2006 -0700
     2.2 +++ b/buildconfigs/mk.linux-2.6-xen	Wed Nov 29 11:07:28 2006 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  LINUX_SERIES = 2.6
     2.5 -LINUX_VER    = 2.6.16.32
     2.6 +LINUX_VER    = 2.6.16.33
     2.7  
     2.8  EXTRAVERSION ?= xen
     2.9  
     3.1 --- a/docs/src/user.tex	Wed Nov 29 11:05:02 2006 -0700
     3.2 +++ b/docs/src/user.tex	Wed Nov 29 11:07:28 2006 -0700
     3.3 @@ -3240,6 +3240,11 @@ editing \path{grub.conf}.
     3.4    enabled by the BIOS.
     3.5  \item [ apic=bigsmp,default,es7000,summit ] Specify NUMA platform.
     3.6    This can usually be probed automatically.
     3.7 +\item [ dma\_bits=xxx ] Specify width of DMA
     3.8 +  addresses in bits. Default is 30 bits (addresses up to 1GB are DMAable).
     3.9 +\item [ dma\_emergency\_pool=xxx ] Specify lower bound on size of DMA
    3.10 +  pool below which ordinary allocations will fail rather than fall
    3.11 +  back to allocating from the DMA pool.
    3.12  \end{description}
    3.13  
    3.14  In addition, the following options may be specified on the Xen command
     4.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Wed Nov 29 11:05:02 2006 -0700
     4.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Wed Nov 29 11:07:28 2006 -0700
     4.3 @@ -47,8 +47,8 @@ EXPORT_SYMBOL(swiotlb);
     4.4   */
     4.5  #define IO_TLB_SHIFT 11
     4.6  
     4.7 -/* Width of DMA addresses in the IO TLB. 31 bits is an aacraid limitation. */
     4.8 -#define IO_TLB_DMA_BITS 31
     4.9 +/* Width of DMA addresses in the IO TLB. 30 bits is a b44 limitation. */
    4.10 +#define DEFAULT_IO_TLB_DMA_BITS 30
    4.11  
    4.12  static int swiotlb_force;
    4.13  static char *iotlb_virt_start;
    4.14 @@ -98,6 +98,15 @@ static struct phys_addr {
    4.15   */
    4.16  static DEFINE_SPINLOCK(io_tlb_lock);
    4.17  
    4.18 +static unsigned int io_tlb_dma_bits = DEFAULT_IO_TLB_DMA_BITS;
    4.19 +static int __init
    4.20 +setup_io_tlb_bits(char *str)
    4.21 +{
    4.22 +	io_tlb_dma_bits = simple_strtoul(str, NULL, 0);
    4.23 +	return 0;
    4.24 +}
    4.25 +__setup("swiotlb_bits=", setup_io_tlb_bits);
    4.26 +
    4.27  static int __init
    4.28  setup_io_tlb_npages(char *str)
    4.29  {
    4.30 @@ -158,7 +167,7 @@ swiotlb_init_with_default_size (size_t d
    4.31  		int rc = xen_create_contiguous_region(
    4.32  			(unsigned long)iotlb_virt_start + (i << IO_TLB_SHIFT),
    4.33  			get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT),
    4.34 -			IO_TLB_DMA_BITS);
    4.35 +			io_tlb_dma_bits);
    4.36  		BUG_ON(rc);
    4.37  	}
    4.38  
    4.39 @@ -183,10 +192,12 @@ swiotlb_init_with_default_size (size_t d
    4.40  
    4.41  	printk(KERN_INFO "Software IO TLB enabled: \n"
    4.42  	       " Aperture:     %lu megabytes\n"
    4.43 -	       " Kernel range: 0x%016lx - 0x%016lx\n",
    4.44 +	       " Kernel range: 0x%016lx - 0x%016lx\n"
    4.45 +	       " Address size: %u bits\n",
    4.46  	       bytes >> 20,
    4.47  	       (unsigned long)iotlb_virt_start,
    4.48 -	       (unsigned long)iotlb_virt_start + bytes);
    4.49 +	       (unsigned long)iotlb_virt_start + bytes,
    4.50 +	       io_tlb_dma_bits);
    4.51  }
    4.52  
    4.53  void
    4.54 @@ -654,7 +665,7 @@ swiotlb_dma_mapping_error(dma_addr_t dma
    4.55  int
    4.56  swiotlb_dma_supported (struct device *hwdev, u64 mask)
    4.57  {
    4.58 -	return (mask >= ((1UL << IO_TLB_DMA_BITS) - 1));
    4.59 +	return (mask >= ((1UL << io_tlb_dma_bits) - 1));
    4.60  }
    4.61  
    4.62  EXPORT_SYMBOL(swiotlb_init);
     5.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Wed Nov 29 11:05:02 2006 -0700
     5.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Wed Nov 29 11:07:28 2006 -0700
     5.3 @@ -710,6 +710,10 @@ irqreturn_t timer_interrupt(int irq, voi
     5.4  					    (cputime_t)delta_cpu);
     5.5  	}
     5.6  
     5.7 +	/* Offlined for more than a few seconds? Avoid lockup warnings. */
     5.8 +	if (stolen > 5*HZ)
     5.9 +		touch_softlockup_watchdog();
    5.10 +
    5.11  	/* Local timer processing (see update_process_times()). */
    5.12  	run_local_timers();
    5.13  	if (rcu_pending(cpu))
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Wed Nov 29 11:05:02 2006 -0700
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Wed Nov 29 11:07:28 2006 -0700
     6.3 @@ -64,14 +64,21 @@
     6.4   *  'xencons=off'  [XC_OFF]:     Console is disabled.
     6.5   *  'xencons=tty'  [XC_TTY]:     Console attached to '/dev/tty[0-9]+'.
     6.6   *  'xencons=ttyS' [XC_SERIAL]:  Console attached to '/dev/ttyS[0-9]+'.
     6.7 + *  'xencons=xvc'  [XC_XVC]:     Console attached to '/dev/xvc0'.
     6.8   *                 [XC_DEFAULT]: DOM0 -> XC_SERIAL ; all others -> XC_TTY.
     6.9   * 
    6.10   * NB. In mode XC_TTY, we create dummy consoles for tty2-63. This suppresses
    6.11   * warnings from standard distro startup scripts.
    6.12   */
    6.13 -static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT;
    6.14 +static enum {
    6.15 +	XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL, XC_XVC
    6.16 +} xc_mode = XC_DEFAULT;
    6.17  static int xc_num = -1;
    6.18  
    6.19 +/* /dev/xvc0 device number allocated by lanana.org. */
    6.20 +#define XEN_XVC_MAJOR 204
    6.21 +#define XEN_XVC_MINOR 191
    6.22 +
    6.23  #ifdef CONFIG_MAGIC_SYSRQ
    6.24  static unsigned long sysrq_requested;
    6.25  extern int sysrq_enabled;
    6.26 @@ -82,27 +89,23 @@ static int __init xencons_setup(char *st
    6.27  	char *q;
    6.28  	int n;
    6.29  
    6.30 -	if (!strncmp(str, "ttyS", 4))
    6.31 +	if (!strncmp(str, "ttyS", 4)) {
    6.32  		xc_mode = XC_SERIAL;
    6.33 -	else if (!strncmp(str, "tty", 3))
    6.34 +		str += 4;
    6.35 +	} else if (!strncmp(str, "tty", 3)) {
    6.36  		xc_mode = XC_TTY;
    6.37 -	else if (!strncmp(str, "off", 3))
    6.38 +		str += 3;
    6.39 +	} else if (!strncmp(str, "xvc", 3)) {
    6.40 +		xc_mode = XC_XVC;
    6.41 +		str += 3;
    6.42 +	} else if (!strncmp(str, "off", 3)) {
    6.43  		xc_mode = XC_OFF;
    6.44 +		str += 3;
    6.45 +	}
    6.46  
    6.47 -	switch (xc_mode) {
    6.48 -	case XC_SERIAL:
    6.49 -		n = simple_strtol(str+4, &q, 10);
    6.50 -		if (q > (str + 4))
    6.51 -			xc_num = n;
    6.52 -		break;
    6.53 -	case XC_TTY:
    6.54 -		n = simple_strtol(str+3, &q, 10);
    6.55 -		if (q > (str + 3))
    6.56 -			xc_num = n;
    6.57 -		break;
    6.58 -	default:
    6.59 -		break;
    6.60 -	}
    6.61 +	n = simple_strtol(str, &q, 10);
    6.62 +	if (q != str)
    6.63 +		xc_num = n;
    6.64  
    6.65  	return 1;
    6.66  }
    6.67 @@ -201,6 +204,12 @@ static int __init xen_console_init(void)
    6.68  	}
    6.69  
    6.70  	switch (xc_mode) {
    6.71 +	case XC_XVC:
    6.72 +		strcpy(kcons_info.name, "xvc");
    6.73 +		if (xc_num == -1)
    6.74 +			xc_num = 0;
    6.75 +		break;
    6.76 +
    6.77  	case XC_SERIAL:
    6.78  		strcpy(kcons_info.name, "ttyS");
    6.79  		if (xc_num == -1)
    6.80 @@ -305,7 +314,7 @@ void dom0_init_screen_info(const struct 
    6.81  /******************** User-space console driver (/dev/console) ************/
    6.82  
    6.83  #define DRV(_d)         (_d)
    6.84 -#define DUMMY_TTY(_tty) ((xc_mode != XC_SERIAL) &&		\
    6.85 +#define DUMMY_TTY(_tty) ((xc_mode == XC_TTY) &&		\
    6.86  			 ((_tty)->index != (xc_num - 1)))
    6.87  
    6.88  static struct termios *xencons_termios[MAX_NR_CONSOLES];
    6.89 @@ -628,8 +637,8 @@ static int __init xencons_init(void)
    6.90  			return rc;
    6.91  	}
    6.92  
    6.93 -	xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ?
    6.94 -					  1 : MAX_NR_CONSOLES);
    6.95 +	xencons_driver = alloc_tty_driver((xc_mode == XC_TTY) ?
    6.96 +					  MAX_NR_CONSOLES : 1);
    6.97  	if (xencons_driver == NULL)
    6.98  		return -ENOMEM;
    6.99  
   6.100 @@ -644,14 +653,23 @@ static int __init xencons_init(void)
   6.101  	DRV(xencons_driver)->termios         = xencons_termios;
   6.102  	DRV(xencons_driver)->termios_locked  = xencons_termios_locked;
   6.103  
   6.104 -	if (xc_mode == XC_SERIAL) {
   6.105 +	switch (xc_mode) {
   6.106 +	case XC_XVC:
   6.107 +		DRV(xencons_driver)->name        = "xvc";
   6.108 +		DRV(xencons_driver)->major       = XEN_XVC_MAJOR;
   6.109 +		DRV(xencons_driver)->minor_start = XEN_XVC_MINOR;
   6.110 +		DRV(xencons_driver)->name_base   = xc_num;
   6.111 +		break;
   6.112 +	case XC_SERIAL:
   6.113  		DRV(xencons_driver)->name        = "ttyS";
   6.114  		DRV(xencons_driver)->minor_start = 64 + xc_num;
   6.115 -		DRV(xencons_driver)->name_base   = 0 + xc_num;
   6.116 -	} else {
   6.117 +		DRV(xencons_driver)->name_base   = xc_num;
   6.118 +		break;
   6.119 +	default:
   6.120  		DRV(xencons_driver)->name        = "tty";
   6.121  		DRV(xencons_driver)->minor_start = 1;
   6.122  		DRV(xencons_driver)->name_base   = 1;
   6.123 +		break;
   6.124  	}
   6.125  
   6.126  	tty_set_operations(xencons_driver, &xencons_ops);
     7.1 --- a/patches/linux-2.6.16.32/blktap-aio-16_03_06.patch	Wed Nov 29 11:05:02 2006 -0700
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,294 +0,0 @@
     7.4 -diff -pruN ../orig-linux-2.6.16.29/fs/aio.c ./fs/aio.c
     7.5 ---- ../orig-linux-2.6.16.29/fs/aio.c	2006-09-12 19:02:10.000000000 +0100
     7.6 -+++ ./fs/aio.c	2006-09-19 13:58:49.000000000 +0100
     7.7 -@@ -34,6 +34,11 @@
     7.8 - #include <asm/uaccess.h>
     7.9 - #include <asm/mmu_context.h>
    7.10 - 
    7.11 -+#ifdef CONFIG_EPOLL
    7.12 -+#include <linux/poll.h>
    7.13 -+#include <linux/eventpoll.h>
    7.14 -+#endif
    7.15 -+
    7.16 - #if DEBUG > 1
    7.17 - #define dprintk		printk
    7.18 - #else
    7.19 -@@ -1016,6 +1021,10 @@ put_rq:
    7.20 - 	if (waitqueue_active(&ctx->wait))
    7.21 - 		wake_up(&ctx->wait);
    7.22 - 
    7.23 -+#ifdef CONFIG_EPOLL
    7.24 -+	if (ctx->file && waitqueue_active(&ctx->poll_wait))
    7.25 -+		wake_up(&ctx->poll_wait);
    7.26 -+#endif
    7.27 - 	if (ret)
    7.28 - 		put_ioctx(ctx);
    7.29 - 
    7.30 -@@ -1025,6 +1034,8 @@ put_rq:
    7.31 - /* aio_read_evt
    7.32 -  *	Pull an event off of the ioctx's event ring.  Returns the number of 
    7.33 -  *	events fetched (0 or 1 ;-)
    7.34 -+ *	If ent parameter is 0, just returns the number of events that would
    7.35 -+ *	be fetched.
    7.36 -  *	FIXME: make this use cmpxchg.
    7.37 -  *	TODO: make the ringbuffer user mmap()able (requires FIXME).
    7.38 -  */
    7.39 -@@ -1047,13 +1058,18 @@ static int aio_read_evt(struct kioctx *i
    7.40 - 
    7.41 - 	head = ring->head % info->nr;
    7.42 - 	if (head != ring->tail) {
    7.43 --		struct io_event *evp = aio_ring_event(info, head, KM_USER1);
    7.44 --		*ent = *evp;
    7.45 --		head = (head + 1) % info->nr;
    7.46 --		smp_mb(); /* finish reading the event before updatng the head */
    7.47 --		ring->head = head;
    7.48 --		ret = 1;
    7.49 --		put_aio_ring_event(evp, KM_USER1);
    7.50 -+		if (ent) { /* event requested */
    7.51 -+			struct io_event *evp =
    7.52 -+				aio_ring_event(info, head, KM_USER1);
    7.53 -+			*ent = *evp;
    7.54 -+			head = (head + 1) % info->nr;
    7.55 -+			/* finish reading the event before updatng the head */
    7.56 -+			smp_mb();
    7.57 -+			ring->head = head;
    7.58 -+			ret = 1;
    7.59 -+			put_aio_ring_event(evp, KM_USER1);
    7.60 -+		} else /* only need to know availability */
    7.61 -+			ret = 1;
    7.62 - 	}
    7.63 - 	spin_unlock(&info->ring_lock);
    7.64 - 
    7.65 -@@ -1236,9 +1252,78 @@ static void io_destroy(struct kioctx *io
    7.66 - 
    7.67 - 	aio_cancel_all(ioctx);
    7.68 - 	wait_for_all_aios(ioctx);
    7.69 -+#ifdef CONFIG_EPOLL
    7.70 -+	/* forget the poll file, but it's up to the user to close it */
    7.71 -+	if (ioctx->file) {
    7.72 -+		ioctx->file->private_data = 0;
    7.73 -+		ioctx->file = 0;
    7.74 -+	}
    7.75 -+#endif
    7.76 - 	put_ioctx(ioctx);	/* once for the lookup */
    7.77 - }
    7.78 - 
    7.79 -+#ifdef CONFIG_EPOLL
    7.80 -+
    7.81 -+static int aio_queue_fd_close(struct inode *inode, struct file *file)
    7.82 -+{
    7.83 -+	struct kioctx *ioctx = file->private_data;
    7.84 -+	if (ioctx) {
    7.85 -+		file->private_data = 0;
    7.86 -+		spin_lock_irq(&ioctx->ctx_lock);
    7.87 -+		ioctx->file = 0;
    7.88 -+		spin_unlock_irq(&ioctx->ctx_lock);
    7.89 -+	}
    7.90 -+	return 0;
    7.91 -+}
    7.92 -+
    7.93 -+static unsigned int aio_queue_fd_poll(struct file *file, poll_table *wait)
    7.94 -+{	unsigned int pollflags = 0;
    7.95 -+	struct kioctx *ioctx = file->private_data;
    7.96 -+
    7.97 -+	if (ioctx) {
    7.98 -+
    7.99 -+		spin_lock_irq(&ioctx->ctx_lock);
   7.100 -+		/* Insert inside our poll wait queue */
   7.101 -+		poll_wait(file, &ioctx->poll_wait, wait);
   7.102 -+
   7.103 -+		/* Check our condition */
   7.104 -+		if (aio_read_evt(ioctx, 0))
   7.105 -+			pollflags = POLLIN | POLLRDNORM;
   7.106 -+		spin_unlock_irq(&ioctx->ctx_lock);
   7.107 -+	}
   7.108 -+
   7.109 -+	return pollflags;
   7.110 -+}
   7.111 -+
   7.112 -+static struct file_operations aioq_fops = {
   7.113 -+	.release	= aio_queue_fd_close,
   7.114 -+	.poll		= aio_queue_fd_poll
   7.115 -+};
   7.116 -+
   7.117 -+/* make_aio_fd:
   7.118 -+ *  Create a file descriptor that can be used to poll the event queue.
   7.119 -+ *  Based and piggybacked on the excellent epoll code.
   7.120 -+ */
   7.121 -+
   7.122 -+static int make_aio_fd(struct kioctx *ioctx)
   7.123 -+{
   7.124 -+	int error, fd;
   7.125 -+	struct inode *inode;
   7.126 -+	struct file *file;
   7.127 -+
   7.128 -+	error = ep_getfd(&fd, &inode, &file, NULL, &aioq_fops);
   7.129 -+	if (error)
   7.130 -+		return error;
   7.131 -+
   7.132 -+	/* associate the file with the IO context */
   7.133 -+	file->private_data = ioctx;
   7.134 -+	ioctx->file = file;
   7.135 -+	init_waitqueue_head(&ioctx->poll_wait);
   7.136 -+	return fd;
   7.137 -+}
   7.138 -+#endif
   7.139 -+
   7.140 -+
   7.141 - /* sys_io_setup:
   7.142 -  *	Create an aio_context capable of receiving at least nr_events.
   7.143 -  *	ctxp must not point to an aio_context that already exists, and
   7.144 -@@ -1251,18 +1336,30 @@ static void io_destroy(struct kioctx *io
   7.145 -  *	resources are available.  May fail with -EFAULT if an invalid
   7.146 -  *	pointer is passed for ctxp.  Will fail with -ENOSYS if not
   7.147 -  *	implemented.
   7.148 -+ *
   7.149 -+ *	To request a selectable fd, the user context has to be initialized
   7.150 -+ *	to 1, instead of 0, and the return value is the fd.
   7.151 -+ *	This keeps the system call compatible, since a non-zero value
   7.152 -+ *	was not allowed so far.
   7.153 -  */
   7.154 - asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp)
   7.155 - {
   7.156 - 	struct kioctx *ioctx = NULL;
   7.157 - 	unsigned long ctx;
   7.158 - 	long ret;
   7.159 -+	int make_fd = 0;
   7.160 - 
   7.161 - 	ret = get_user(ctx, ctxp);
   7.162 - 	if (unlikely(ret))
   7.163 - 		goto out;
   7.164 - 
   7.165 - 	ret = -EINVAL;
   7.166 -+#ifdef CONFIG_EPOLL
   7.167 -+	if (ctx == 1) {
   7.168 -+		make_fd = 1;
   7.169 -+		ctx = 0;
   7.170 -+	}
   7.171 -+#endif
   7.172 - 	if (unlikely(ctx || nr_events == 0)) {
   7.173 - 		pr_debug("EINVAL: io_setup: ctx %lu nr_events %u\n",
   7.174 - 		         ctx, nr_events);
   7.175 -@@ -1273,8 +1370,12 @@ asmlinkage long sys_io_setup(unsigned nr
   7.176 - 	ret = PTR_ERR(ioctx);
   7.177 - 	if (!IS_ERR(ioctx)) {
   7.178 - 		ret = put_user(ioctx->user_id, ctxp);
   7.179 --		if (!ret)
   7.180 --			return 0;
   7.181 -+#ifdef CONFIG_EPOLL
   7.182 -+		if (make_fd && ret >= 0)
   7.183 -+			ret = make_aio_fd(ioctx);
   7.184 -+#endif
   7.185 -+		if (ret >= 0)
   7.186 -+			return ret;
   7.187 - 
   7.188 - 		get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */
   7.189 - 		io_destroy(ioctx);
   7.190 -diff -pruN ../orig-linux-2.6.16.29/fs/eventpoll.c ./fs/eventpoll.c
   7.191 ---- ../orig-linux-2.6.16.29/fs/eventpoll.c	2006-09-12 19:02:10.000000000 +0100
   7.192 -+++ ./fs/eventpoll.c	2006-09-19 13:58:49.000000000 +0100
   7.193 -@@ -235,8 +235,6 @@ struct ep_pqueue {
   7.194 - 
   7.195 - static void ep_poll_safewake_init(struct poll_safewake *psw);
   7.196 - static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq);
   7.197 --static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
   7.198 --		    struct eventpoll *ep);
   7.199 - static int ep_alloc(struct eventpoll **pep);
   7.200 - static void ep_free(struct eventpoll *ep);
   7.201 - static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
   7.202 -@@ -266,7 +264,7 @@ static int ep_events_transfer(struct eve
   7.203 - static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
   7.204 - 		   int maxevents, long timeout);
   7.205 - static int eventpollfs_delete_dentry(struct dentry *dentry);
   7.206 --static struct inode *ep_eventpoll_inode(void);
   7.207 -+static struct inode *ep_eventpoll_inode(struct file_operations *fops);
   7.208 - static struct super_block *eventpollfs_get_sb(struct file_system_type *fs_type,
   7.209 - 					      int flags, const char *dev_name,
   7.210 - 					      void *data);
   7.211 -@@ -525,7 +523,7 @@ asmlinkage long sys_epoll_create(int siz
   7.212 - 	 * Creates all the items needed to setup an eventpoll file. That is,
   7.213 - 	 * a file structure, and inode and a free file descriptor.
   7.214 - 	 */
   7.215 --	error = ep_getfd(&fd, &inode, &file, ep);
   7.216 -+	error = ep_getfd(&fd, &inode, &file, ep, &eventpoll_fops);
   7.217 - 	if (error)
   7.218 - 		goto eexit_2;
   7.219 - 
   7.220 -@@ -710,8 +708,8 @@ eexit_1:
   7.221 - /*
   7.222 -  * Creates the file descriptor to be used by the epoll interface.
   7.223 -  */
   7.224 --static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
   7.225 --		    struct eventpoll *ep)
   7.226 -+int ep_getfd(int *efd, struct inode **einode, struct file **efile,
   7.227 -+		    struct eventpoll *ep, struct file_operations *fops)
   7.228 - {
   7.229 - 	struct qstr this;
   7.230 - 	char name[32];
   7.231 -@@ -727,7 +725,7 @@ static int ep_getfd(int *efd, struct ino
   7.232 - 		goto eexit_1;
   7.233 - 
   7.234 - 	/* Allocates an inode from the eventpoll file system */
   7.235 --	inode = ep_eventpoll_inode();
   7.236 -+	inode = ep_eventpoll_inode(fops);
   7.237 - 	error = PTR_ERR(inode);
   7.238 - 	if (IS_ERR(inode))
   7.239 - 		goto eexit_2;
   7.240 -@@ -758,7 +756,7 @@ static int ep_getfd(int *efd, struct ino
   7.241 - 
   7.242 - 	file->f_pos = 0;
   7.243 - 	file->f_flags = O_RDONLY;
   7.244 --	file->f_op = &eventpoll_fops;
   7.245 -+	file->f_op = fops;
   7.246 - 	file->f_mode = FMODE_READ;
   7.247 - 	file->f_version = 0;
   7.248 - 	file->private_data = ep;
   7.249 -@@ -1574,7 +1572,7 @@ static int eventpollfs_delete_dentry(str
   7.250 - }
   7.251 - 
   7.252 - 
   7.253 --static struct inode *ep_eventpoll_inode(void)
   7.254 -+static struct inode *ep_eventpoll_inode(struct file_operations *fops)
   7.255 - {
   7.256 - 	int error = -ENOMEM;
   7.257 - 	struct inode *inode = new_inode(eventpoll_mnt->mnt_sb);
   7.258 -@@ -1582,7 +1580,7 @@ static struct inode *ep_eventpoll_inode(
   7.259 - 	if (!inode)
   7.260 - 		goto eexit_1;
   7.261 - 
   7.262 --	inode->i_fop = &eventpoll_fops;
   7.263 -+	inode->i_fop = fops;
   7.264 - 
   7.265 - 	/*
   7.266 - 	 * Mark the inode dirty from the very beginning,
   7.267 -diff -pruN ../orig-linux-2.6.16.29/include/linux/aio.h ./include/linux/aio.h
   7.268 ---- ../orig-linux-2.6.16.29/include/linux/aio.h	2006-09-12 19:02:10.000000000 +0100
   7.269 -+++ ./include/linux/aio.h	2006-09-19 13:58:49.000000000 +0100
   7.270 -@@ -191,6 +191,11 @@ struct kioctx {
   7.271 - 	struct aio_ring_info	ring_info;
   7.272 - 
   7.273 - 	struct work_struct	wq;
   7.274 -+#ifdef CONFIG_EPOLL
   7.275 -+	// poll integration
   7.276 -+	wait_queue_head_t       poll_wait;
   7.277 -+	struct file		*file;
   7.278 -+#endif
   7.279 - };
   7.280 - 
   7.281 - /* prototypes */
   7.282 -diff -pruN ../orig-linux-2.6.16.29/include/linux/eventpoll.h ./include/linux/eventpoll.h
   7.283 ---- ../orig-linux-2.6.16.29/include/linux/eventpoll.h	2006-09-12 19:02:10.000000000 +0100
   7.284 -+++ ./include/linux/eventpoll.h	2006-09-19 13:58:49.000000000 +0100
   7.285 -@@ -86,6 +86,12 @@ static inline void eventpoll_release(str
   7.286 - }
   7.287 - 
   7.288 - 
   7.289 -+/*
   7.290 -+ * called by aio code to create fd that can poll the  aio event queueQ
   7.291 -+ */
   7.292 -+struct eventpoll;
   7.293 -+int ep_getfd(int *efd, struct inode **einode, struct file **efile,
   7.294 -+             struct eventpoll *ep, struct file_operations *fops);
   7.295 - #else
   7.296 - 
   7.297 - static inline void eventpoll_init_file(struct file *file) {}
     8.1 --- a/patches/linux-2.6.16.32/device_bind.patch	Wed Nov 29 11:05:02 2006 -0700
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,15 +0,0 @@
     8.4 -diff -pruN ../orig-linux-2.6.16.29/drivers/base/bus.c ./drivers/base/bus.c
     8.5 ---- ../orig-linux-2.6.16.29/drivers/base/bus.c	2006-09-12 19:02:10.000000000 +0100
     8.6 -+++ ./drivers/base/bus.c	2006-09-19 13:58:54.000000000 +0100
     8.7 -@@ -188,6 +188,11 @@ static ssize_t driver_bind(struct device
     8.8 - 		up(&dev->sem);
     8.9 - 		if (dev->parent)
    8.10 - 			up(&dev->parent->sem);
    8.11 -+
    8.12 -+		if (err > 0) 		/* success */
    8.13 -+			err = count;
    8.14 -+		else if (err == 0)	/* driver didn't accept device */
    8.15 -+			err = -ENODEV;
    8.16 - 	}
    8.17 - 	put_device(dev);
    8.18 - 	put_bus(bus);
     9.1 --- a/patches/linux-2.6.16.32/fix-hz-suspend.patch	Wed Nov 29 11:05:02 2006 -0700
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,26 +0,0 @@
     9.4 -diff -pruN ../orig-linux-2.6.16.29/kernel/timer.c ./kernel/timer.c
     9.5 ---- ../orig-linux-2.6.16.29/kernel/timer.c	2006-09-12 19:02:10.000000000 +0100
     9.6 -+++ ./kernel/timer.c	2006-09-19 13:58:58.000000000 +0100
     9.7 -@@ -555,6 +555,22 @@ found:
     9.8 - 	}
     9.9 - 	spin_unlock(&base->t_base.lock);
    9.10 - 
    9.11 -+	/*
    9.12 -+	 * It can happen that other CPUs service timer IRQs and increment
    9.13 -+	 * jiffies, but we have not yet got a local timer tick to process
    9.14 -+	 * the timer wheels.  In that case, the expiry time can be before
    9.15 -+	 * jiffies, but since the high-resolution timer here is relative to
    9.16 -+	 * jiffies, the default expression when high-resolution timers are
    9.17 -+	 * not active,
    9.18 -+	 *
    9.19 -+	 *   time_before(MAX_JIFFY_OFFSET + jiffies, expires)
    9.20 -+	 *
    9.21 -+	 * would falsely evaluate to true.  If that is the case, just
    9.22 -+	 * return jiffies so that we can immediately fire the local timer
    9.23 -+	 */
    9.24 -+	if (time_before(expires, jiffies))
    9.25 -+		return jiffies;
    9.26 -+
    9.27 - 	if (time_before(hr_expires, expires))
    9.28 - 		return hr_expires;
    9.29 - 
    10.1 --- a/patches/linux-2.6.16.32/fix-ide-cd-pio-mode.patch	Wed Nov 29 11:05:02 2006 -0700
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,18 +0,0 @@
    10.4 -diff -pruN ../orig-linux-2.6.16.29/drivers/ide/ide-lib.c ./drivers/ide/ide-lib.c
    10.5 ---- ../orig-linux-2.6.16.29/drivers/ide/ide-lib.c	2006-09-12 19:02:10.000000000 +0100
    10.6 -+++ ./drivers/ide/ide-lib.c	2006-09-19 13:59:03.000000000 +0100
    10.7 -@@ -410,10 +410,10 @@ void ide_toggle_bounce(ide_drive_t *driv
    10.8 - {
    10.9 - 	u64 addr = BLK_BOUNCE_HIGH;	/* dma64_addr_t */
   10.10 - 
   10.11 --	if (!PCI_DMA_BUS_IS_PHYS) {
   10.12 --		addr = BLK_BOUNCE_ANY;
   10.13 --	} else if (on && drive->media == ide_disk) {
   10.14 --		if (HWIF(drive)->pci_dev)
   10.15 -+	if (on && drive->media == ide_disk) {
   10.16 -+		if (!PCI_DMA_BUS_IS_PHYS)
   10.17 -+			addr = BLK_BOUNCE_ANY;
   10.18 -+		else if (HWIF(drive)->pci_dev)
   10.19 - 			addr = HWIF(drive)->pci_dev->dma_mask;
   10.20 - 	}
   10.21 - 
    11.1 --- a/patches/linux-2.6.16.32/i386-mach-io-check-nmi.patch	Wed Nov 29 11:05:02 2006 -0700
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,45 +0,0 @@
    11.4 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/traps.c ./arch/i386/kernel/traps.c
    11.5 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/traps.c	2006-09-12 19:02:10.000000000 +0100
    11.6 -+++ ./arch/i386/kernel/traps.c	2006-09-19 13:59:06.000000000 +0100
    11.7 -@@ -567,18 +567,11 @@ static void mem_parity_error(unsigned ch
    11.8 - 
    11.9 - static void io_check_error(unsigned char reason, struct pt_regs * regs)
   11.10 - {
   11.11 --	unsigned long i;
   11.12 --
   11.13 - 	printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
   11.14 - 	show_registers(regs);
   11.15 - 
   11.16 - 	/* Re-enable the IOCK line, wait for a few seconds */
   11.17 --	reason = (reason & 0xf) | 8;
   11.18 --	outb(reason, 0x61);
   11.19 --	i = 2000;
   11.20 --	while (--i) udelay(1000);
   11.21 --	reason &= ~8;
   11.22 --	outb(reason, 0x61);
   11.23 -+	clear_io_check_error(reason);
   11.24 - }
   11.25 - 
   11.26 - static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
   11.27 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/mach-default/mach_traps.h ./include/asm-i386/mach-default/mach_traps.h
   11.28 ---- ../orig-linux-2.6.16.29/include/asm-i386/mach-default/mach_traps.h	2006-09-12 19:02:10.000000000 +0100
   11.29 -+++ ./include/asm-i386/mach-default/mach_traps.h	2006-09-19 13:59:06.000000000 +0100
   11.30 -@@ -15,6 +15,18 @@ static inline void clear_mem_error(unsig
   11.31 - 	outb(reason, 0x61);
   11.32 - }
   11.33 - 
   11.34 -+static inline void clear_io_check_error(unsigned char reason)
   11.35 -+{
   11.36 -+	unsigned long i;
   11.37 -+
   11.38 -+	reason = (reason & 0xf) | 8;
   11.39 -+	outb(reason, 0x61);
   11.40 -+	i = 2000;
   11.41 -+	while (--i) udelay(1000);
   11.42 -+	reason &= ~8;
   11.43 -+	outb(reason, 0x61);
   11.44 -+}
   11.45 -+
   11.46 - static inline unsigned char get_nmi_reason(void)
   11.47 - {
   11.48 - 	return inb(0x61);
    12.1 --- a/patches/linux-2.6.16.32/ipv6-no-autoconf.patch	Wed Nov 29 11:05:02 2006 -0700
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,19 +0,0 @@
    12.4 -diff -pruN ../orig-linux-2.6.16.29/net/ipv6/addrconf.c ./net/ipv6/addrconf.c
    12.5 ---- ../orig-linux-2.6.16.29/net/ipv6/addrconf.c	2006-09-12 19:02:10.000000000 +0100
    12.6 -+++ ./net/ipv6/addrconf.c	2006-09-19 13:59:11.000000000 +0100
    12.7 -@@ -2471,6 +2471,7 @@ static void addrconf_dad_start(struct in
    12.8 - 	spin_lock_bh(&ifp->lock);
    12.9 - 
   12.10 - 	if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) ||
   12.11 -+	    !(dev->flags&IFF_MULTICAST) ||
   12.12 - 	    !(ifp->flags&IFA_F_TENTATIVE)) {
   12.13 - 		ifp->flags &= ~IFA_F_TENTATIVE;
   12.14 - 		spin_unlock_bh(&ifp->lock);
   12.15 -@@ -2555,6 +2556,7 @@ static void addrconf_dad_completed(struc
   12.16 - 	if (ifp->idev->cnf.forwarding == 0 &&
   12.17 - 	    ifp->idev->cnf.rtr_solicits > 0 &&
   12.18 - 	    (dev->flags&IFF_LOOPBACK) == 0 &&
   12.19 -+	    (dev->flags & IFF_MULTICAST) &&
   12.20 - 	    (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) {
   12.21 - 		struct in6_addr all_routers;
   12.22 - 
    13.1 --- a/patches/linux-2.6.16.32/kasprintf.patch	Wed Nov 29 11:05:02 2006 -0700
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,59 +0,0 @@
    13.4 -commit e905914f96e11862b130dd229f73045dad9a34e8
    13.5 -Author: Jeremy Fitzhardinge <jeremy@xensource.com>
    13.6 -Date:   Sun Jun 25 05:49:17 2006 -0700
    13.7 -
    13.8 -    [PATCH] Implement kasprintf
    13.9 -    
   13.10 -    Implement kasprintf, a kernel version of asprintf.  This allocates the
   13.11 -    memory required for the formatted string, including the trailing '\0'.
   13.12 -    Returns NULL on allocation failure.
   13.13 -    
   13.14 -    Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
   13.15 -    Signed-off-by: Chris Wright <chrisw@sous-sol.org>
   13.16 -    Signed-off-by: Andrew Morton <akpm@osdl.org>
   13.17 -    Signed-off-by: Linus Torvalds <torvalds@osdl.org>
   13.18 -
   13.19 -diff --git a/include/linux/kernel.h b/include/linux/kernel.h
   13.20 -index 8c21aaa..3c5e4c2 100644
   13.21 ---- a/include/linux/kernel.h
   13.22 -+++ b/include/linux/kernel.h
   13.23 -@@ -117,6 +117,8 @@ extern int scnprintf(char * buf, size_t
   13.24 - 	__attribute__ ((format (printf, 3, 4)));
   13.25 - extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
   13.26 - 	__attribute__ ((format (printf, 3, 0)));
   13.27 -+extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
   13.28 -+	__attribute__ ((format (printf, 2, 3)));
   13.29 - 
   13.30 - extern int sscanf(const char *, const char *, ...)
   13.31 - 	__attribute__ ((format (scanf, 2, 3)));
   13.32 -diff --git a/lib/vsprintf.c b/lib/vsprintf.c
   13.33 -index f595947..797428a 100644
   13.34 ---- a/lib/vsprintf.c
   13.35 -+++ b/lib/vsprintf.c
   13.36 -@@ -849,3 +849,26 @@ int sscanf(const char * buf, const char
   13.37 - }
   13.38 - 
   13.39 - EXPORT_SYMBOL(sscanf);
   13.40 -+
   13.41 -+
   13.42 -+/* Simplified asprintf. */
   13.43 -+char *kasprintf(gfp_t gfp, const char *fmt, ...)
   13.44 -+{
   13.45 -+	va_list ap;
   13.46 -+	unsigned int len;
   13.47 -+	char *p;
   13.48 -+
   13.49 -+	va_start(ap, fmt);
   13.50 -+	len = vsnprintf(NULL, 0, fmt, ap);
   13.51 -+	va_end(ap);
   13.52 -+
   13.53 -+	p = kmalloc(len+1, gfp);
   13.54 -+	if (!p)
   13.55 -+		return NULL;
   13.56 -+	va_start(ap, fmt);
   13.57 -+	vsnprintf(p, len+1, fmt, ap);
   13.58 -+	va_end(ap);
   13.59 -+	return p;
   13.60 -+}
   13.61 -+
   13.62 -+EXPORT_SYMBOL(kasprintf);
    14.1 --- a/patches/linux-2.6.16.32/net-csum.patch	Wed Nov 29 11:05:02 2006 -0700
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,63 +0,0 @@
    14.4 -diff -pruN ../orig-linux-2.6.16.29/net/ipv4/netfilter/ip_nat_proto_tcp.c ./net/ipv4/netfilter/ip_nat_proto_tcp.c
    14.5 ---- ../orig-linux-2.6.16.29/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-09-12 19:02:10.000000000 +0100
    14.6 -+++ ./net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-09-19 13:59:15.000000000 +0100
    14.7 -@@ -129,7 +129,12 @@ tcp_manip_pkt(struct sk_buff **pskb,
    14.8 - 	if (hdrsize < sizeof(*hdr))
    14.9 - 		return 1;
   14.10 - 
   14.11 --	hdr->check = ip_nat_cheat_check(~oldip, newip,
   14.12 -+#ifdef CONFIG_XEN
   14.13 -+	if ((*pskb)->proto_csum_blank)
   14.14 -+		hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
   14.15 -+	else
   14.16 -+#endif
   14.17 -+		hdr->check = ip_nat_cheat_check(~oldip, newip,
   14.18 - 					ip_nat_cheat_check(oldport ^ 0xFFFF,
   14.19 - 							   newport,
   14.20 - 							   hdr->check));
   14.21 -diff -pruN ../orig-linux-2.6.16.29/net/ipv4/netfilter/ip_nat_proto_udp.c ./net/ipv4/netfilter/ip_nat_proto_udp.c
   14.22 ---- ../orig-linux-2.6.16.29/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-09-12 19:02:10.000000000 +0100
   14.23 -+++ ./net/ipv4/netfilter/ip_nat_proto_udp.c	2006-09-19 13:59:15.000000000 +0100
   14.24 -@@ -113,11 +113,17 @@ udp_manip_pkt(struct sk_buff **pskb,
   14.25 - 		newport = tuple->dst.u.udp.port;
   14.26 - 		portptr = &hdr->dest;
   14.27 - 	}
   14.28 --	if (hdr->check) /* 0 is a special case meaning no checksum */
   14.29 --		hdr->check = ip_nat_cheat_check(~oldip, newip,
   14.30 -+	if (hdr->check) { /* 0 is a special case meaning no checksum */
   14.31 -+#ifdef CONFIG_XEN
   14.32 -+		if ((*pskb)->proto_csum_blank)
   14.33 -+			hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
   14.34 -+		else
   14.35 -+#endif
   14.36 -+			hdr->check = ip_nat_cheat_check(~oldip, newip,
   14.37 - 					ip_nat_cheat_check(*portptr ^ 0xFFFF,
   14.38 - 							   newport,
   14.39 - 							   hdr->check));
   14.40 -+	}
   14.41 - 	*portptr = newport;
   14.42 - 	return 1;
   14.43 - }
   14.44 -diff -pruN ../orig-linux-2.6.16.29/net/ipv4/xfrm4_output.c ./net/ipv4/xfrm4_output.c
   14.45 ---- ../orig-linux-2.6.16.29/net/ipv4/xfrm4_output.c	2006-09-12 19:02:10.000000000 +0100
   14.46 -+++ ./net/ipv4/xfrm4_output.c	2006-09-19 13:59:15.000000000 +0100
   14.47 -@@ -17,6 +17,8 @@
   14.48 - #include <net/xfrm.h>
   14.49 - #include <net/icmp.h>
   14.50 - 
   14.51 -+extern int skb_checksum_setup(struct sk_buff *skb);
   14.52 -+
   14.53 - /* Add encapsulation header.
   14.54 -  *
   14.55 -  * In transport mode, the IP header will be moved forward to make space
   14.56 -@@ -103,6 +105,10 @@ static int xfrm4_output_one(struct sk_bu
   14.57 - 	struct xfrm_state *x = dst->xfrm;
   14.58 - 	int err;
   14.59 - 	
   14.60 -+	err = skb_checksum_setup(skb);
   14.61 -+	if (err)
   14.62 -+		goto error_nolock;
   14.63 -+
   14.64 - 	if (skb->ip_summed == CHECKSUM_HW) {
   14.65 - 		err = skb_checksum_help(skb, 0);
   14.66 - 		if (err)
    15.1 --- a/patches/linux-2.6.16.32/net-gso-0-base.patch	Wed Nov 29 11:05:02 2006 -0700
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,2898 +0,0 @@
    15.4 -Index: tmp-xxx/Documentation/networking/netdevices.txt
    15.5 -===================================================================
    15.6 ---- tmp-xxx.orig/Documentation/networking/netdevices.txt	2006-11-15 10:38:39.000000000 +0000
    15.7 -+++ tmp-xxx/Documentation/networking/netdevices.txt	2006-11-27 10:52:42.000000000 +0000
    15.8 -@@ -42,9 +42,9 @@
    15.9 - 	Context: nominally process, but don't sleep inside an rwlock
   15.10 - 
   15.11 - dev->hard_start_xmit:
   15.12 --	Synchronization: dev->xmit_lock spinlock.
   15.13 -+	Synchronization: netif_tx_lock spinlock.
   15.14 - 	When the driver sets NETIF_F_LLTX in dev->features this will be
   15.15 --	called without holding xmit_lock. In this case the driver 
   15.16 -+	called without holding netif_tx_lock. In this case the driver
   15.17 - 	has to lock by itself when needed. It is recommended to use a try lock
   15.18 - 	for this and return -1 when the spin lock fails. 
   15.19 - 	The locking there should also properly protect against 
   15.20 -@@ -62,12 +62,12 @@
   15.21 - 	  Only valid when NETIF_F_LLTX is set.
   15.22 - 
   15.23 - dev->tx_timeout:
   15.24 --	Synchronization: dev->xmit_lock spinlock.
   15.25 -+	Synchronization: netif_tx_lock spinlock.
   15.26 - 	Context: BHs disabled
   15.27 - 	Notes: netif_queue_stopped() is guaranteed true
   15.28 - 
   15.29 - dev->set_multicast_list:
   15.30 --	Synchronization: dev->xmit_lock spinlock.
   15.31 -+	Synchronization: netif_tx_lock spinlock.
   15.32 - 	Context: BHs disabled
   15.33 - 
   15.34 - dev->poll:
   15.35 -Index: tmp-xxx/drivers/block/aoe/aoenet.c
   15.36 -===================================================================
   15.37 ---- tmp-xxx.orig/drivers/block/aoe/aoenet.c	2006-11-15 10:38:39.000000000 +0000
   15.38 -+++ tmp-xxx/drivers/block/aoe/aoenet.c	2006-11-27 10:52:42.000000000 +0000
   15.39 -@@ -95,9 +95,8 @@
   15.40 - static struct sk_buff *
   15.41 - skb_check(struct sk_buff *skb)
   15.42 - {
   15.43 --	if (skb_is_nonlinear(skb))
   15.44 - 	if ((skb = skb_share_check(skb, GFP_ATOMIC)))
   15.45 --	if (skb_linearize(skb, GFP_ATOMIC) < 0) {
   15.46 -+	if (skb_linearize(skb)) {
   15.47 - 		dev_kfree_skb(skb);
   15.48 - 		return NULL;
   15.49 - 	}
   15.50 -Index: tmp-xxx/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
   15.51 -===================================================================
   15.52 ---- tmp-xxx.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2006-11-15 10:38:39.000000000 +0000
   15.53 -+++ tmp-xxx/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2006-11-27 10:52:42.000000000 +0000
   15.54 -@@ -821,7 +821,8 @@
   15.55 - 
   15.56 - 	ipoib_mcast_stop_thread(dev, 0);
   15.57 - 
   15.58 --	spin_lock_irqsave(&dev->xmit_lock, flags);
   15.59 -+	local_irq_save(flags);
   15.60 -+	netif_tx_lock(dev);
   15.61 - 	spin_lock(&priv->lock);
   15.62 - 
   15.63 - 	/*
   15.64 -@@ -896,7 +897,8 @@
   15.65 - 	}
   15.66 - 
   15.67 - 	spin_unlock(&priv->lock);
   15.68 --	spin_unlock_irqrestore(&dev->xmit_lock, flags);
   15.69 -+	netif_tx_unlock(dev);
   15.70 -+	local_irq_restore(flags);
   15.71 - 
   15.72 - 	/* We have to cancel outside of the spinlock */
   15.73 - 	list_for_each_entry_safe(mcast, tmcast, &remove_list, list) {
   15.74 -Index: tmp-xxx/drivers/media/dvb/dvb-core/dvb_net.c
   15.75 -===================================================================
   15.76 ---- tmp-xxx.orig/drivers/media/dvb/dvb-core/dvb_net.c	2006-11-15 10:38:39.000000000 +0000
   15.77 -+++ tmp-xxx/drivers/media/dvb/dvb-core/dvb_net.c	2006-11-27 10:52:42.000000000 +0000
   15.78 -@@ -1053,7 +1053,7 @@
   15.79 - 
   15.80 - 	dvb_net_feed_stop(dev);
   15.81 - 	priv->rx_mode = RX_MODE_UNI;
   15.82 --	spin_lock_bh(&dev->xmit_lock);
   15.83 -+	netif_tx_lock_bh(dev);
   15.84 - 
   15.85 - 	if (dev->flags & IFF_PROMISC) {
   15.86 - 		dprintk("%s: promiscuous mode\n", dev->name);
   15.87 -@@ -1078,7 +1078,7 @@
   15.88 - 		}
   15.89 - 	}
   15.90 - 
   15.91 --	spin_unlock_bh(&dev->xmit_lock);
   15.92 -+	netif_tx_unlock_bh(dev);
   15.93 - 	dvb_net_feed_start(dev);
   15.94 - }
   15.95 - 
   15.96 -Index: tmp-xxx/drivers/net/8139cp.c
   15.97 -===================================================================
   15.98 ---- tmp-xxx.orig/drivers/net/8139cp.c	2006-11-15 10:38:39.000000000 +0000
   15.99 -+++ tmp-xxx/drivers/net/8139cp.c	2006-11-27 10:52:42.000000000 +0000
  15.100 -@@ -794,7 +794,7 @@
  15.101 - 	entry = cp->tx_head;
  15.102 - 	eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
  15.103 - 	if (dev->features & NETIF_F_TSO)
  15.104 --		mss = skb_shinfo(skb)->tso_size;
  15.105 -+		mss = skb_shinfo(skb)->gso_size;
  15.106 - 
  15.107 - 	if (skb_shinfo(skb)->nr_frags == 0) {
  15.108 - 		struct cp_desc *txd = &cp->tx_ring[entry];
  15.109 -Index: tmp-xxx/drivers/net/bnx2.c
  15.110 -===================================================================
  15.111 ---- tmp-xxx.orig/drivers/net/bnx2.c	2006-11-15 10:38:39.000000000 +0000
  15.112 -+++ tmp-xxx/drivers/net/bnx2.c	2006-11-27 10:52:42.000000000 +0000
  15.113 -@@ -1593,7 +1593,7 @@
  15.114 - 		skb = tx_buf->skb;
  15.115 - #ifdef BCM_TSO 
  15.116 - 		/* partial BD completions possible with TSO packets */
  15.117 --		if (skb_shinfo(skb)->tso_size) {
  15.118 -+		if (skb_shinfo(skb)->gso_size) {
  15.119 - 			u16 last_idx, last_ring_idx;
  15.120 - 
  15.121 - 			last_idx = sw_cons +
  15.122 -@@ -1948,7 +1948,7 @@
  15.123 - 	return 1;
  15.124 - }
  15.125 - 
  15.126 --/* Called with rtnl_lock from vlan functions and also dev->xmit_lock
  15.127 -+/* Called with rtnl_lock from vlan functions and also netif_tx_lock
  15.128 -  * from set_multicast.
  15.129 -  */
  15.130 - static void
  15.131 -@@ -4403,7 +4403,7 @@
  15.132 - }
  15.133 - #endif
  15.134 - 
  15.135 --/* Called with dev->xmit_lock.
  15.136 -+/* Called with netif_tx_lock.
  15.137 -  * hard_start_xmit is pseudo-lockless - a lock is only required when
  15.138 -  * the tx queue is full. This way, we get the benefit of lockless
  15.139 -  * operations most of the time without the complexities to handle
  15.140 -@@ -4441,7 +4441,7 @@
  15.141 - 			(TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
  15.142 - 	}
  15.143 - #ifdef BCM_TSO 
  15.144 --	if ((mss = skb_shinfo(skb)->tso_size) &&
  15.145 -+	if ((mss = skb_shinfo(skb)->gso_size) &&
  15.146 - 		(skb->len > (bp->dev->mtu + ETH_HLEN))) {
  15.147 - 		u32 tcp_opt_len, ip_tcp_len;
  15.148 - 
  15.149 -Index: tmp-xxx/drivers/net/bonding/bond_main.c
  15.150 -===================================================================
  15.151 ---- tmp-xxx.orig/drivers/net/bonding/bond_main.c	2006-11-15 10:38:39.000000000 +0000
  15.152 -+++ tmp-xxx/drivers/net/bonding/bond_main.c	2006-11-27 10:52:42.000000000 +0000
  15.153 -@@ -1145,8 +1145,7 @@
  15.154 - }
  15.155 - 
  15.156 - #define BOND_INTERSECT_FEATURES \
  15.157 --	(NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM|\
  15.158 --	NETIF_F_TSO|NETIF_F_UFO)
  15.159 -+	(NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO)
  15.160 - 
  15.161 - /* 
  15.162 -  * Compute the common dev->feature set available to all slaves.  Some
  15.163 -@@ -1164,9 +1163,7 @@
  15.164 - 		features &= (slave->dev->features & BOND_INTERSECT_FEATURES);
  15.165 - 
  15.166 - 	if ((features & NETIF_F_SG) && 
  15.167 --	    !(features & (NETIF_F_IP_CSUM |
  15.168 --			  NETIF_F_NO_CSUM |
  15.169 --			  NETIF_F_HW_CSUM)))
  15.170 -+	    !(features & NETIF_F_ALL_CSUM))
  15.171 - 		features &= ~NETIF_F_SG;
  15.172 - 
  15.173 - 	/* 
  15.174 -@@ -4147,7 +4144,7 @@
  15.175 - 	 */
  15.176 - 	bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
  15.177 - 
  15.178 --	/* don't acquire bond device's xmit_lock when 
  15.179 -+	/* don't acquire bond device's netif_tx_lock when
  15.180 - 	 * transmitting */
  15.181 - 	bond_dev->features |= NETIF_F_LLTX;
  15.182 - 
  15.183 -Index: tmp-xxx/drivers/net/chelsio/sge.c
  15.184 -===================================================================
  15.185 ---- tmp-xxx.orig/drivers/net/chelsio/sge.c	2006-11-15 10:38:39.000000000 +0000
  15.186 -+++ tmp-xxx/drivers/net/chelsio/sge.c	2006-11-27 10:52:42.000000000 +0000
  15.187 -@@ -1419,7 +1419,7 @@
  15.188 - 	struct cpl_tx_pkt *cpl;
  15.189 - 
  15.190 - #ifdef NETIF_F_TSO
  15.191 --	if (skb_shinfo(skb)->tso_size) {
  15.192 -+	if (skb_shinfo(skb)->gso_size) {
  15.193 - 		int eth_type;
  15.194 - 		struct cpl_tx_pkt_lso *hdr;
  15.195 - 
  15.196 -@@ -1434,7 +1434,7 @@
  15.197 - 		hdr->ip_hdr_words = skb->nh.iph->ihl;
  15.198 - 		hdr->tcp_hdr_words = skb->h.th->doff;
  15.199 - 		hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type,
  15.200 --						skb_shinfo(skb)->tso_size));
  15.201 -+						skb_shinfo(skb)->gso_size));
  15.202 - 		hdr->len = htonl(skb->len - sizeof(*hdr));
  15.203 - 		cpl = (struct cpl_tx_pkt *)hdr;
  15.204 - 		sge->stats.tx_lso_pkts++;
  15.205 -Index: tmp-xxx/drivers/net/e1000/e1000_main.c
  15.206 -===================================================================
  15.207 ---- tmp-xxx.orig/drivers/net/e1000/e1000_main.c	2006-11-15 10:38:39.000000000 +0000
  15.208 -+++ tmp-xxx/drivers/net/e1000/e1000_main.c	2006-11-27 10:52:42.000000000 +0000
  15.209 -@@ -2526,7 +2526,7 @@
  15.210 - 	uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
  15.211 - 	int err;
  15.212 - 
  15.213 --	if (skb_shinfo(skb)->tso_size) {
  15.214 -+	if (skb_shinfo(skb)->gso_size) {
  15.215 - 		if (skb_header_cloned(skb)) {
  15.216 - 			err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
  15.217 - 			if (err)
  15.218 -@@ -2534,7 +2534,7 @@
  15.219 - 		}
  15.220 - 
  15.221 - 		hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
  15.222 --		mss = skb_shinfo(skb)->tso_size;
  15.223 -+		mss = skb_shinfo(skb)->gso_size;
  15.224 - 		if (skb->protocol == ntohs(ETH_P_IP)) {
  15.225 - 			skb->nh.iph->tot_len = 0;
  15.226 - 			skb->nh.iph->check = 0;
  15.227 -@@ -2651,7 +2651,7 @@
  15.228 - 		 * tso gets written back prematurely before the data is fully
  15.229 - 		 * DMAd to the controller */
  15.230 - 		if (!skb->data_len && tx_ring->last_tx_tso &&
  15.231 --				!skb_shinfo(skb)->tso_size) {
  15.232 -+				!skb_shinfo(skb)->gso_size) {
  15.233 - 			tx_ring->last_tx_tso = 0;
  15.234 - 			size -= 4;
  15.235 - 		}
  15.236 -@@ -2893,7 +2893,7 @@
  15.237 - 	}
  15.238 - 
  15.239 - #ifdef NETIF_F_TSO
  15.240 --	mss = skb_shinfo(skb)->tso_size;
  15.241 -+	mss = skb_shinfo(skb)->gso_size;
  15.242 - 	/* The controller does a simple calculation to 
  15.243 - 	 * make sure there is enough room in the FIFO before
  15.244 - 	 * initiating the DMA for each buffer.  The calc is:
  15.245 -@@ -2935,7 +2935,7 @@
  15.246 - #ifdef NETIF_F_TSO
  15.247 - 	/* Controller Erratum workaround */
  15.248 - 	if (!skb->data_len && tx_ring->last_tx_tso &&
  15.249 --		!skb_shinfo(skb)->tso_size)
  15.250 -+		!skb_shinfo(skb)->gso_size)
  15.251 - 		count++;
  15.252 - #endif
  15.253 - 
  15.254 -Index: tmp-xxx/drivers/net/forcedeth.c
  15.255 -===================================================================
  15.256 ---- tmp-xxx.orig/drivers/net/forcedeth.c	2006-11-15 10:38:39.000000000 +0000
  15.257 -+++ tmp-xxx/drivers/net/forcedeth.c	2006-11-27 10:52:42.000000000 +0000
  15.258 -@@ -482,9 +482,9 @@
  15.259 -  * critical parts:
  15.260 -  * - rx is (pseudo-) lockless: it relies on the single-threading provided
  15.261 -  *	by the arch code for interrupts.
  15.262 -- * - tx setup is lockless: it relies on dev->xmit_lock. Actual submission
  15.263 -+ * - tx setup is lockless: it relies on netif_tx_lock. Actual submission
  15.264 -  *	needs dev->priv->lock :-(
  15.265 -- * - set_multicast_list: preparation lockless, relies on dev->xmit_lock.
  15.266 -+ * - set_multicast_list: preparation lockless, relies on netif_tx_lock.
  15.267 -  */
  15.268 - 
  15.269 - /* in dev: base, irq */
  15.270 -@@ -1016,7 +1016,7 @@
  15.271 - 
  15.272 - /*
  15.273 -  * nv_start_xmit: dev->hard_start_xmit function
  15.274 -- * Called with dev->xmit_lock held.
  15.275 -+ * Called with netif_tx_lock held.
  15.276 -  */
  15.277 - static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
  15.278 - {
  15.279 -@@ -1105,8 +1105,8 @@
  15.280 - 	np->tx_skbuff[nr] = skb;
  15.281 - 
  15.282 - #ifdef NETIF_F_TSO
  15.283 --	if (skb_shinfo(skb)->tso_size)
  15.284 --		tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT);
  15.285 -+	if (skb_shinfo(skb)->gso_size)
  15.286 -+		tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->gso_size << NV_TX2_TSO_SHIFT);
  15.287 - 	else
  15.288 - #endif
  15.289 - 	tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0);
  15.290 -@@ -1203,7 +1203,7 @@
  15.291 - 
  15.292 - /*
  15.293 -  * nv_tx_timeout: dev->tx_timeout function
  15.294 -- * Called with dev->xmit_lock held.
  15.295 -+ * Called with netif_tx_lock held.
  15.296 -  */
  15.297 - static void nv_tx_timeout(struct net_device *dev)
  15.298 - {
  15.299 -@@ -1524,7 +1524,7 @@
  15.300 - 		 * Changing the MTU is a rare event, it shouldn't matter.
  15.301 - 		 */
  15.302 - 		disable_irq(dev->irq);
  15.303 --		spin_lock_bh(&dev->xmit_lock);
  15.304 -+		netif_tx_lock_bh(dev);
  15.305 - 		spin_lock(&np->lock);
  15.306 - 		/* stop engines */
  15.307 - 		nv_stop_rx(dev);
  15.308 -@@ -1559,7 +1559,7 @@
  15.309 - 		nv_start_rx(dev);
  15.310 - 		nv_start_tx(dev);
  15.311 - 		spin_unlock(&np->lock);
  15.312 --		spin_unlock_bh(&dev->xmit_lock);
  15.313 -+		netif_tx_unlock_bh(dev);
  15.314 - 		enable_irq(dev->irq);
  15.315 - 	}
  15.316 - 	return 0;
  15.317 -@@ -1594,7 +1594,7 @@
  15.318 - 	memcpy(dev->dev_addr, macaddr->sa_data, ETH_ALEN);
  15.319 - 
  15.320 - 	if (netif_running(dev)) {
  15.321 --		spin_lock_bh(&dev->xmit_lock);
  15.322 -+		netif_tx_lock_bh(dev);
  15.323 - 		spin_lock_irq(&np->lock);
  15.324 - 
  15.325 - 		/* stop rx engine */
  15.326 -@@ -1606,7 +1606,7 @@
  15.327 - 		/* restart rx engine */
  15.328 - 		nv_start_rx(dev);
  15.329 - 		spin_unlock_irq(&np->lock);
  15.330 --		spin_unlock_bh(&dev->xmit_lock);
  15.331 -+		netif_tx_unlock_bh(dev);
  15.332 - 	} else {
  15.333 - 		nv_copy_mac_to_hw(dev);
  15.334 - 	}
  15.335 -@@ -1615,7 +1615,7 @@
  15.336 - 
  15.337 - /*
  15.338 -  * nv_set_multicast: dev->set_multicast function
  15.339 -- * Called with dev->xmit_lock held.
  15.340 -+ * Called with netif_tx_lock held.
  15.341 -  */
  15.342 - static void nv_set_multicast(struct net_device *dev)
  15.343 - {
  15.344 -Index: tmp-xxx/drivers/net/hamradio/6pack.c
  15.345 -===================================================================
  15.346 ---- tmp-xxx.orig/drivers/net/hamradio/6pack.c	2006-11-15 10:38:39.000000000 +0000
  15.347 -+++ tmp-xxx/drivers/net/hamradio/6pack.c	2006-11-27 10:52:42.000000000 +0000
  15.348 -@@ -308,9 +308,9 @@
  15.349 - {
  15.350 - 	struct sockaddr_ax25 *sa = addr;
  15.351 - 
  15.352 --	spin_lock_irq(&dev->xmit_lock);
  15.353 -+	netif_tx_lock_bh(dev);
  15.354 - 	memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
  15.355 --	spin_unlock_irq(&dev->xmit_lock);
  15.356 -+	netif_tx_unlock_bh(dev);
  15.357 - 
  15.358 - 	return 0;
  15.359 - }
  15.360 -@@ -767,9 +767,9 @@
  15.361 - 			break;
  15.362 - 		}
  15.363 - 
  15.364 --		spin_lock_irq(&dev->xmit_lock);
  15.365 -+		netif_tx_lock_bh(dev);
  15.366 - 		memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN);
  15.367 --		spin_unlock_irq(&dev->xmit_lock);
  15.368 -+		netif_tx_unlock_bh(dev);
  15.369 - 
  15.370 - 		err = 0;
  15.371 - 		break;
  15.372 -Index: tmp-xxx/drivers/net/hamradio/mkiss.c
  15.373 -===================================================================
  15.374 ---- tmp-xxx.orig/drivers/net/hamradio/mkiss.c	2006-11-15 10:38:39.000000000 +0000
  15.375 -+++ tmp-xxx/drivers/net/hamradio/mkiss.c	2006-11-27 10:52:42.000000000 +0000
  15.376 -@@ -357,9 +357,9 @@
  15.377 - {
  15.378 - 	struct sockaddr_ax25 *sa = addr;
  15.379 - 
  15.380 --	spin_lock_irq(&dev->xmit_lock);
  15.381 -+	netif_tx_lock_bh(dev);
  15.382 - 	memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
  15.383 --	spin_unlock_irq(&dev->xmit_lock);
  15.384 -+	netif_tx_unlock_bh(dev);
  15.385 - 
  15.386 - 	return 0;
  15.387 - }
  15.388 -@@ -886,9 +886,9 @@
  15.389 - 			break;
  15.390 - 		}
  15.391 - 
  15.392 --		spin_lock_irq(&dev->xmit_lock);
  15.393 -+		netif_tx_lock_bh(dev);
  15.394 - 		memcpy(dev->dev_addr, addr, AX25_ADDR_LEN);
  15.395 --		spin_unlock_irq(&dev->xmit_lock);
  15.396 -+		netif_tx_unlock_bh(dev);
  15.397 - 
  15.398 - 		err = 0;
  15.399 - 		break;
  15.400 -Index: tmp-xxx/drivers/net/ifb.c
  15.401 -===================================================================
  15.402 ---- tmp-xxx.orig/drivers/net/ifb.c	2006-11-15 10:38:39.000000000 +0000
  15.403 -+++ tmp-xxx/drivers/net/ifb.c	2006-11-27 10:52:42.000000000 +0000
  15.404 -@@ -76,13 +76,13 @@
  15.405 - 	dp->st_task_enter++;
  15.406 - 	if ((skb = skb_peek(&dp->tq)) == NULL) {
  15.407 - 		dp->st_txq_refl_try++;
  15.408 --		if (spin_trylock(&_dev->xmit_lock)) {
  15.409 -+		if (netif_tx_trylock(_dev)) {
  15.410 - 			dp->st_rxq_enter++;
  15.411 - 			while ((skb = skb_dequeue(&dp->rq)) != NULL) {
  15.412 - 				skb_queue_tail(&dp->tq, skb);
  15.413 - 				dp->st_rx2tx_tran++;
  15.414 - 			}
  15.415 --			spin_unlock(&_dev->xmit_lock);
  15.416 -+			netif_tx_unlock(_dev);
  15.417 - 		} else {
  15.418 - 			/* reschedule */
  15.419 - 			dp->st_rxq_notenter++;
  15.420 -@@ -110,7 +110,7 @@
  15.421 - 		}
  15.422 - 	}
  15.423 - 
  15.424 --	if (spin_trylock(&_dev->xmit_lock)) {
  15.425 -+	if (netif_tx_trylock(_dev)) {
  15.426 - 		dp->st_rxq_check++;
  15.427 - 		if ((skb = skb_peek(&dp->rq)) == NULL) {
  15.428 - 			dp->tasklet_pending = 0;
  15.429 -@@ -118,10 +118,10 @@
  15.430 - 				netif_wake_queue(_dev);
  15.431 - 		} else {
  15.432 - 			dp->st_rxq_rsch++;
  15.433 --			spin_unlock(&_dev->xmit_lock);
  15.434 -+			netif_tx_unlock(_dev);
  15.435 - 			goto resched;
  15.436 - 		}
  15.437 --		spin_unlock(&_dev->xmit_lock);
  15.438 -+		netif_tx_unlock(_dev);
  15.439 - 	} else {
  15.440 - resched:
  15.441 - 		dp->tasklet_pending = 1;
  15.442 -Index: tmp-xxx/drivers/net/irda/vlsi_ir.c
  15.443 -===================================================================
  15.444 ---- tmp-xxx.orig/drivers/net/irda/vlsi_ir.c	2006-11-15 10:38:39.000000000 +0000
  15.445 -+++ tmp-xxx/drivers/net/irda/vlsi_ir.c	2006-11-27 10:52:42.000000000 +0000
  15.446 -@@ -959,7 +959,7 @@
  15.447 - 			    ||  (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec))
  15.448 - 			    	break;
  15.449 - 			udelay(100);
  15.450 --			/* must not sleep here - we are called under xmit_lock! */
  15.451 -+			/* must not sleep here - called under netif_tx_lock! */
  15.452 - 		}
  15.453 - 	}
  15.454 - 
  15.455 -Index: tmp-xxx/drivers/net/ixgb/ixgb_main.c
  15.456 -===================================================================
  15.457 ---- tmp-xxx.orig/drivers/net/ixgb/ixgb_main.c	2006-11-15 10:38:39.000000000 +0000
  15.458 -+++ tmp-xxx/drivers/net/ixgb/ixgb_main.c	2006-11-27 10:52:42.000000000 +0000
  15.459 -@@ -1163,7 +1163,7 @@
  15.460 - 	uint16_t ipcse, tucse, mss;
  15.461 - 	int err;
  15.462 - 
  15.463 --	if(likely(skb_shinfo(skb)->tso_size)) {
  15.464 -+	if(likely(skb_shinfo(skb)->gso_size)) {
  15.465 - 		if (skb_header_cloned(skb)) {
  15.466 - 			err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
  15.467 - 			if (err)
  15.468 -@@ -1171,7 +1171,7 @@
  15.469 - 		}
  15.470 - 
  15.471 - 		hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
  15.472 --		mss = skb_shinfo(skb)->tso_size;
  15.473 -+		mss = skb_shinfo(skb)->gso_size;
  15.474 - 		skb->nh.iph->tot_len = 0;
  15.475 - 		skb->nh.iph->check = 0;
  15.476 - 		skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr,
  15.477 -Index: tmp-xxx/drivers/net/loopback.c
  15.478 -===================================================================
  15.479 ---- tmp-xxx.orig/drivers/net/loopback.c	2006-11-15 10:38:39.000000000 +0000
  15.480 -+++ tmp-xxx/drivers/net/loopback.c	2006-11-27 10:52:42.000000000 +0000
  15.481 -@@ -74,7 +74,7 @@
  15.482 - 	struct iphdr *iph = skb->nh.iph;
  15.483 - 	struct tcphdr *th = (struct tcphdr*)(skb->nh.raw + (iph->ihl * 4));
  15.484 - 	unsigned int doffset = (iph->ihl + th->doff) * 4;
  15.485 --	unsigned int mtu = skb_shinfo(skb)->tso_size + doffset;
  15.486 -+	unsigned int mtu = skb_shinfo(skb)->gso_size + doffset;
  15.487 - 	unsigned int offset = 0;
  15.488 - 	u32 seq = ntohl(th->seq);
  15.489 - 	u16 id  = ntohs(iph->id);
  15.490 -@@ -139,7 +139,7 @@
  15.491 - #endif
  15.492 - 
  15.493 - #ifdef LOOPBACK_TSO
  15.494 --	if (skb_shinfo(skb)->tso_size) {
  15.495 -+	if (skb_shinfo(skb)->gso_size) {
  15.496 - 		BUG_ON(skb->protocol != htons(ETH_P_IP));
  15.497 - 		BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP);
  15.498 - 
  15.499 -Index: tmp-xxx/drivers/net/mv643xx_eth.c
  15.500 -===================================================================
  15.501 ---- tmp-xxx.orig/drivers/net/mv643xx_eth.c	2006-11-15 10:38:39.000000000 +0000
  15.502 -+++ tmp-xxx/drivers/net/mv643xx_eth.c	2006-11-27 10:52:42.000000000 +0000
  15.503 -@@ -1107,7 +1107,7 @@
  15.504 - 
  15.505 - #ifdef MV643XX_CHECKSUM_OFFLOAD_TX
  15.506 - 	if (has_tiny_unaligned_frags(skb)) {
  15.507 --		if ((skb_linearize(skb, GFP_ATOMIC) != 0)) {
  15.508 -+		if (__skb_linearize(skb)) {
  15.509 - 			stats->tx_dropped++;
  15.510 - 			printk(KERN_DEBUG "%s: failed to linearize tiny "
  15.511 - 					"unaligned fragment\n", dev->name);
  15.512 -Index: tmp-xxx/drivers/net/natsemi.c
  15.513 -===================================================================
  15.514 ---- tmp-xxx.orig/drivers/net/natsemi.c	2006-11-15 10:38:39.000000000 +0000
  15.515 -+++ tmp-xxx/drivers/net/natsemi.c	2006-11-27 10:52:42.000000000 +0000
  15.516 -@@ -323,12 +323,12 @@
  15.517 - The rx process only runs in the interrupt handler. Access from outside
  15.518 - the interrupt handler is only permitted after disable_irq().
  15.519 - 
  15.520 --The rx process usually runs under the dev->xmit_lock. If np->intr_tx_reap
  15.521 -+The rx process usually runs under the netif_tx_lock. If np->intr_tx_reap
  15.522 - is set, then access is permitted under spin_lock_irq(&np->lock).
  15.523 - 
  15.524 - Thus configuration functions that want to access everything must call
  15.525 - 	disable_irq(dev->irq);
  15.526 --	spin_lock_bh(dev->xmit_lock);
  15.527 -+	netif_tx_lock_bh(dev);
  15.528 - 	spin_lock_irq(&np->lock);
  15.529 - 
  15.530 - IV. Notes
  15.531 -Index: tmp-xxx/drivers/net/r8169.c
  15.532 -===================================================================
  15.533 ---- tmp-xxx.orig/drivers/net/r8169.c	2006-11-15 10:38:39.000000000 +0000
  15.534 -+++ tmp-xxx/drivers/net/r8169.c	2006-11-27 10:52:42.000000000 +0000
  15.535 -@@ -2171,7 +2171,7 @@
  15.536 - static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev)
  15.537 - {
  15.538 - 	if (dev->features & NETIF_F_TSO) {
  15.539 --		u32 mss = skb_shinfo(skb)->tso_size;
  15.540 -+		u32 mss = skb_shinfo(skb)->gso_size;
  15.541 - 
  15.542 - 		if (mss)
  15.543 - 			return LargeSend | ((mss & MSSMask) << MSSShift);
  15.544 -Index: tmp-xxx/drivers/net/s2io.c
  15.545 -===================================================================
  15.546 ---- tmp-xxx.orig/drivers/net/s2io.c	2006-11-15 10:38:39.000000000 +0000
  15.547 -+++ tmp-xxx/drivers/net/s2io.c	2006-11-27 10:52:42.000000000 +0000
  15.548 -@@ -3522,8 +3522,8 @@
  15.549 - 	txdp->Control_1 = 0;
  15.550 - 	txdp->Control_2 = 0;
  15.551 - #ifdef NETIF_F_TSO
  15.552 --	mss = skb_shinfo(skb)->tso_size;
  15.553 --	if (mss) {
  15.554 -+	mss = skb_shinfo(skb)->gso_size;
  15.555 -+	if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV4) {
  15.556 - 		txdp->Control_1 |= TXD_TCP_LSO_EN;
  15.557 - 		txdp->Control_1 |= TXD_TCP_LSO_MSS(mss);
  15.558 - 	}
  15.559 -@@ -3543,10 +3543,10 @@
  15.560 - 	}
  15.561 - 
  15.562 - 	frg_len = skb->len - skb->data_len;
  15.563 --	if (skb_shinfo(skb)->ufo_size) {
  15.564 -+	if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) {
  15.565 - 		int ufo_size;
  15.566 - 
  15.567 --		ufo_size = skb_shinfo(skb)->ufo_size;
  15.568 -+		ufo_size = skb_shinfo(skb)->gso_size;
  15.569 - 		ufo_size &= ~7;
  15.570 - 		txdp->Control_1 |= TXD_UFO_EN;
  15.571 - 		txdp->Control_1 |= TXD_UFO_MSS(ufo_size);
  15.572 -@@ -3572,7 +3572,7 @@
  15.573 - 	txdp->Host_Control = (unsigned long) skb;
  15.574 - 	txdp->Control_1 |= TXD_BUFFER0_SIZE(frg_len);
  15.575 - 
  15.576 --	if (skb_shinfo(skb)->ufo_size)
  15.577 -+	if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
  15.578 - 		txdp->Control_1 |= TXD_UFO_EN;
  15.579 - 
  15.580 - 	frg_cnt = skb_shinfo(skb)->nr_frags;
  15.581 -@@ -3587,12 +3587,12 @@
  15.582 - 		    (sp->pdev, frag->page, frag->page_offset,
  15.583 - 		     frag->size, PCI_DMA_TODEVICE);
  15.584 - 		txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size);
  15.585 --		if (skb_shinfo(skb)->ufo_size)
  15.586 -+		if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
  15.587 - 			txdp->Control_1 |= TXD_UFO_EN;
  15.588 - 	}
  15.589 - 	txdp->Control_1 |= TXD_GATHER_CODE_LAST;
  15.590 - 
  15.591 --	if (skb_shinfo(skb)->ufo_size)
  15.592 -+	if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
  15.593 - 		frg_cnt++; /* as Txd0 was used for inband header */
  15.594 - 
  15.595 - 	tx_fifo = mac_control->tx_FIFO_start[queue];
  15.596 -@@ -3606,7 +3606,7 @@
  15.597 - 	if (mss)
  15.598 - 		val64 |= TX_FIFO_SPECIAL_FUNC;
  15.599 - #endif
  15.600 --	if (skb_shinfo(skb)->ufo_size)
  15.601 -+	if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
  15.602 - 		val64 |= TX_FIFO_SPECIAL_FUNC;
  15.603 - 	writeq(val64, &tx_fifo->List_Control);
  15.604 - 
  15.605 -Index: tmp-xxx/drivers/net/sky2.c
  15.606 -===================================================================
  15.607 ---- tmp-xxx.orig/drivers/net/sky2.c	2006-11-15 10:38:39.000000000 +0000
  15.608 -+++ tmp-xxx/drivers/net/sky2.c	2006-11-27 10:52:42.000000000 +0000
  15.609 -@@ -1141,7 +1141,7 @@
  15.610 - 	count = sizeof(dma_addr_t) / sizeof(u32);
  15.611 - 	count += skb_shinfo(skb)->nr_frags * count;
  15.612 - 
  15.613 --	if (skb_shinfo(skb)->tso_size)
  15.614 -+	if (skb_shinfo(skb)->gso_size)
  15.615 - 		++count;
  15.616 - 
  15.617 - 	if (skb->ip_summed == CHECKSUM_HW)
  15.618 -@@ -1213,7 +1213,7 @@
  15.619 - 	}
  15.620 - 
  15.621 - 	/* Check for TCP Segmentation Offload */
  15.622 --	mss = skb_shinfo(skb)->tso_size;
  15.623 -+	mss = skb_shinfo(skb)->gso_size;
  15.624 - 	if (mss != 0) {
  15.625 - 		/* just drop the packet if non-linear expansion fails */
  15.626 - 		if (skb_header_cloned(skb) &&
  15.627 -Index: tmp-xxx/drivers/net/tg3.c
  15.628 -===================================================================
  15.629 ---- tmp-xxx.orig/drivers/net/tg3.c	2006-11-15 10:38:39.000000000 +0000
  15.630 -+++ tmp-xxx/drivers/net/tg3.c	2006-11-27 10:52:42.000000000 +0000
  15.631 -@@ -3664,7 +3664,7 @@
  15.632 - #if TG3_TSO_SUPPORT != 0
  15.633 - 	mss = 0;
  15.634 - 	if (skb->len > (tp->dev->mtu + ETH_HLEN) &&
  15.635 --	    (mss = skb_shinfo(skb)->tso_size) != 0) {
  15.636 -+	    (mss = skb_shinfo(skb)->gso_size) != 0) {
  15.637 - 		int tcp_opt_len, ip_tcp_len;
  15.638 - 
  15.639 - 		if (skb_header_cloned(skb) &&
  15.640 -Index: tmp-xxx/drivers/net/tulip/winbond-840.c
  15.641 -===================================================================
  15.642 ---- tmp-xxx.orig/drivers/net/tulip/winbond-840.c	2006-11-15 10:38:39.000000000 +0000
  15.643 -+++ tmp-xxx/drivers/net/tulip/winbond-840.c	2006-11-27 10:52:42.000000000 +0000
  15.644 -@@ -1605,11 +1605,11 @@
  15.645 -  * - get_stats:
  15.646 -  * 	spin_lock_irq(np->lock), doesn't touch hw if not present
  15.647 -  * - hard_start_xmit:
  15.648 -- * 	netif_stop_queue + spin_unlock_wait(&dev->xmit_lock);
  15.649 -+ * 	synchronize_irq + netif_tx_disable;
  15.650 -  * - tx_timeout:
  15.651 -- * 	netif_device_detach + spin_unlock_wait(&dev->xmit_lock);
  15.652 -+ * 	netif_device_detach + netif_tx_disable;
  15.653 -  * - set_multicast_list
  15.654 -- * 	netif_device_detach + spin_unlock_wait(&dev->xmit_lock);
  15.655 -+ * 	netif_device_detach + netif_tx_disable;
  15.656 -  * - interrupt handler
  15.657 -  * 	doesn't touch hw if not present, synchronize_irq waits for
  15.658 -  * 	running instances of the interrupt handler.
  15.659 -@@ -1635,11 +1635,10 @@
  15.660 - 		netif_device_detach(dev);
  15.661 - 		update_csr6(dev, 0);
  15.662 - 		iowrite32(0, ioaddr + IntrEnable);
  15.663 --		netif_stop_queue(dev);
  15.664 - 		spin_unlock_irq(&np->lock);
  15.665 - 
  15.666 --		spin_unlock_wait(&dev->xmit_lock);
  15.667 - 		synchronize_irq(dev->irq);
  15.668 -+		netif_tx_disable(dev);
  15.669 - 	
  15.670 - 		np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff;
  15.671 - 
  15.672 -Index: tmp-xxx/drivers/net/typhoon.c
  15.673 -===================================================================
  15.674 ---- tmp-xxx.orig/drivers/net/typhoon.c	2006-11-15 10:38:39.000000000 +0000
  15.675 -+++ tmp-xxx/drivers/net/typhoon.c	2006-11-27 10:52:42.000000000 +0000
  15.676 -@@ -340,7 +340,7 @@
  15.677 - #endif
  15.678 - 
  15.679 - #if defined(NETIF_F_TSO)
  15.680 --#define skb_tso_size(x)		(skb_shinfo(x)->tso_size)
  15.681 -+#define skb_tso_size(x)		(skb_shinfo(x)->gso_size)
  15.682 - #define TSO_NUM_DESCRIPTORS	2
  15.683 - #define TSO_OFFLOAD_ON		TYPHOON_OFFLOAD_TCP_SEGMENT
  15.684 - #else
  15.685 -Index: tmp-xxx/drivers/net/via-velocity.c
  15.686 -===================================================================
  15.687 ---- tmp-xxx.orig/drivers/net/via-velocity.c	2006-11-15 10:38:39.000000000 +0000
  15.688 -+++ tmp-xxx/drivers/net/via-velocity.c	2006-11-27 10:52:42.000000000 +0000
  15.689 -@@ -1905,6 +1905,13 @@
  15.690 - 
  15.691 - 	int pktlen = skb->len;
  15.692 - 
  15.693 -+#ifdef VELOCITY_ZERO_COPY_SUPPORT
  15.694 -+	if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) {
  15.695 -+		kfree_skb(skb);
  15.696 -+		return 0;
  15.697 -+	}
  15.698 -+#endif
  15.699 -+
  15.700 - 	spin_lock_irqsave(&vptr->lock, flags);
  15.701 - 
  15.702 - 	index = vptr->td_curr[qnum];
  15.703 -@@ -1920,8 +1927,6 @@
  15.704 - 	 */
  15.705 - 	if (pktlen < ETH_ZLEN) {
  15.706 - 		/* Cannot occur until ZC support */
  15.707 --		if(skb_linearize(skb, GFP_ATOMIC))
  15.708 --			return 0; 
  15.709 - 		pktlen = ETH_ZLEN;
  15.710 - 		memcpy(tdinfo->buf, skb->data, skb->len);
  15.711 - 		memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len);
  15.712 -@@ -1939,7 +1944,6 @@
  15.713 - 		int nfrags = skb_shinfo(skb)->nr_frags;
  15.714 - 		tdinfo->skb = skb;
  15.715 - 		if (nfrags > 6) {
  15.716 --			skb_linearize(skb, GFP_ATOMIC);
  15.717 - 			memcpy(tdinfo->buf, skb->data, skb->len);
  15.718 - 			tdinfo->skb_dma[0] = tdinfo->buf_dma;
  15.719 - 			td_ptr->tdesc0.pktsize = 
  15.720 -Index: tmp-xxx/drivers/net/wireless/orinoco.c
  15.721 -===================================================================
  15.722 ---- tmp-xxx.orig/drivers/net/wireless/orinoco.c	2006-11-15 10:38:39.000000000 +0000
  15.723 -+++ tmp-xxx/drivers/net/wireless/orinoco.c	2006-11-27 10:52:42.000000000 +0000
  15.724 -@@ -1835,7 +1835,9 @@
  15.725 - 	/* Set promiscuity / multicast*/
  15.726 - 	priv->promiscuous = 0;
  15.727 - 	priv->mc_count = 0;
  15.728 --	__orinoco_set_multicast_list(dev); /* FIXME: what about the xmit_lock */
  15.729 -+
  15.730 -+	/* FIXME: what about netif_tx_lock */
  15.731 -+	__orinoco_set_multicast_list(dev);
  15.732 - 
  15.733 - 	return 0;
  15.734 - }
  15.735 -Index: tmp-xxx/drivers/s390/net/qeth_eddp.c
  15.736 -===================================================================
  15.737 ---- tmp-xxx.orig/drivers/s390/net/qeth_eddp.c	2006-11-15 10:38:39.000000000 +0000
  15.738 -+++ tmp-xxx/drivers/s390/net/qeth_eddp.c	2006-11-27 10:52:42.000000000 +0000
  15.739 -@@ -421,7 +421,7 @@
  15.740 -        }
  15.741 - 	tcph = eddp->skb->h.th;
  15.742 - 	while (eddp->skb_offset < eddp->skb->len) {
  15.743 --		data_len = min((int)skb_shinfo(eddp->skb)->tso_size,
  15.744 -+		data_len = min((int)skb_shinfo(eddp->skb)->gso_size,
  15.745 - 			       (int)(eddp->skb->len - eddp->skb_offset));
  15.746 - 		/* prepare qdio hdr */
  15.747 - 		if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2){
  15.748 -@@ -516,20 +516,20 @@
  15.749 - 	
  15.750 - 	QETH_DBF_TEXT(trace, 5, "eddpcanp");
  15.751 - 	/* can we put multiple skbs in one page? */
  15.752 --	skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->tso_size + hdr_len);
  15.753 -+	skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->gso_size + hdr_len);
  15.754 - 	if (skbs_per_page > 1){
  15.755 --		ctx->num_pages = (skb_shinfo(skb)->tso_segs + 1) /
  15.756 -+		ctx->num_pages = (skb_shinfo(skb)->gso_segs + 1) /
  15.757 - 				 skbs_per_page + 1;
  15.758 - 		ctx->elements_per_skb = 1;
  15.759 - 	} else {
  15.760 - 		/* no -> how many elements per skb? */
  15.761 --		ctx->elements_per_skb = (skb_shinfo(skb)->tso_size + hdr_len +
  15.762 -+		ctx->elements_per_skb = (skb_shinfo(skb)->gso_size + hdr_len +
  15.763 - 				     PAGE_SIZE) >> PAGE_SHIFT;
  15.764 - 		ctx->num_pages = ctx->elements_per_skb *
  15.765 --				 (skb_shinfo(skb)->tso_segs + 1);
  15.766 -+				 (skb_shinfo(skb)->gso_segs + 1);
  15.767 - 	}
  15.768 - 	ctx->num_elements = ctx->elements_per_skb *
  15.769 --			    (skb_shinfo(skb)->tso_segs + 1);
  15.770 -+			    (skb_shinfo(skb)->gso_segs + 1);
  15.771 - }
  15.772 - 
  15.773 - static inline struct qeth_eddp_context *
  15.774 -Index: tmp-xxx/drivers/s390/net/qeth_main.c
  15.775 -===================================================================
  15.776 ---- tmp-xxx.orig/drivers/s390/net/qeth_main.c	2006-11-15 10:38:39.000000000 +0000
  15.777 -+++ tmp-xxx/drivers/s390/net/qeth_main.c	2006-11-27 10:52:42.000000000 +0000
  15.778 -@@ -4454,7 +4454,7 @@
  15.779 - 	queue = card->qdio.out_qs
  15.780 - 		[qeth_get_priority_queue(card, skb, ipv, cast_type)];
  15.781 - 
  15.782 --	if (skb_shinfo(skb)->tso_size)
  15.783 -+	if (skb_shinfo(skb)->gso_size)
  15.784 - 		large_send = card->options.large_send;
  15.785 - 
  15.786 - 	/*are we able to do TSO ? If so ,prepare and send it from here */
  15.787 -@@ -4501,7 +4501,7 @@
  15.788 - 		card->stats.tx_packets++;
  15.789 - 		card->stats.tx_bytes += skb->len;
  15.790 - #ifdef CONFIG_QETH_PERF_STATS
  15.791 --		if (skb_shinfo(skb)->tso_size &&
  15.792 -+		if (skb_shinfo(skb)->gso_size &&
  15.793 - 		   !(large_send == QETH_LARGE_SEND_NO)) {
  15.794 - 			card->perf_stats.large_send_bytes += skb->len;
  15.795 - 			card->perf_stats.large_send_cnt++;
  15.796 -Index: tmp-xxx/drivers/s390/net/qeth_tso.h
  15.797 -===================================================================
  15.798 ---- tmp-xxx.orig/drivers/s390/net/qeth_tso.h	2006-11-15 10:38:39.000000000 +0000
  15.799 -+++ tmp-xxx/drivers/s390/net/qeth_tso.h	2006-11-27 10:52:42.000000000 +0000
  15.800 -@@ -51,7 +51,7 @@
  15.801 - 	hdr->ext.hdr_version = 1;
  15.802 - 	hdr->ext.hdr_len     = 28;
  15.803 - 	/*insert non-fix values */
  15.804 --	hdr->ext.mss = skb_shinfo(skb)->tso_size;
  15.805 -+	hdr->ext.mss = skb_shinfo(skb)->gso_size;
  15.806 - 	hdr->ext.dg_hdr_len = (__u16)(iph->ihl*4 + tcph->doff*4);
  15.807 - 	hdr->ext.payload_len = (__u16)(skb->len - hdr->ext.dg_hdr_len -
  15.808 - 				       sizeof(struct qeth_hdr_tso));
  15.809 -Index: tmp-xxx/include/linux/ethtool.h
  15.810 -===================================================================
  15.811 ---- tmp-xxx.orig/include/linux/ethtool.h	2006-11-15 10:38:39.000000000 +0000
  15.812 -+++ tmp-xxx/include/linux/ethtool.h	2006-11-27 10:52:42.000000000 +0000
  15.813 -@@ -408,6 +408,8 @@
  15.814 - #define ETHTOOL_GPERMADDR	0x00000020 /* Get permanent hardware address */
  15.815 - #define ETHTOOL_GUFO		0x00000021 /* Get UFO enable (ethtool_value) */
  15.816 - #define ETHTOOL_SUFO		0x00000022 /* Set UFO enable (ethtool_value) */
  15.817 -+#define ETHTOOL_GGSO		0x00000023 /* Get GSO enable (ethtool_value) */
  15.818 -+#define ETHTOOL_SGSO		0x00000024 /* Set GSO enable (ethtool_value) */
  15.819 - 
  15.820 - /* compatibility with older code */
  15.821 - #define SPARC_ETH_GSET		ETHTOOL_GSET
  15.822 -Index: tmp-xxx/include/linux/netdevice.h
  15.823 -===================================================================
  15.824 ---- tmp-xxx.orig/include/linux/netdevice.h	2006-11-15 10:38:39.000000000 +0000
  15.825 -+++ tmp-xxx/include/linux/netdevice.h	2006-11-27 10:52:42.000000000 +0000
  15.826 -@@ -230,7 +230,8 @@
  15.827 - 	__LINK_STATE_SCHED,
  15.828 - 	__LINK_STATE_NOCARRIER,
  15.829 - 	__LINK_STATE_RX_SCHED,
  15.830 --	__LINK_STATE_LINKWATCH_PENDING
  15.831 -+	__LINK_STATE_LINKWATCH_PENDING,
  15.832 -+	__LINK_STATE_QDISC_RUNNING,
  15.833 - };
  15.834 - 
  15.835 - 
  15.836 -@@ -306,9 +307,17 @@
  15.837 - #define NETIF_F_HW_VLAN_RX	256	/* Receive VLAN hw acceleration */
  15.838 - #define NETIF_F_HW_VLAN_FILTER	512	/* Receive filtering on VLAN */
  15.839 - #define NETIF_F_VLAN_CHALLENGED	1024	/* Device cannot handle VLAN packets */
  15.840 --#define NETIF_F_TSO		2048	/* Can offload TCP/IP segmentation */
  15.841 -+#define NETIF_F_GSO		2048	/* Enable software GSO. */
  15.842 - #define NETIF_F_LLTX		4096	/* LockLess TX */
  15.843 --#define NETIF_F_UFO             8192    /* Can offload UDP Large Send*/
  15.844 -+
  15.845 -+	/* Segmentation offload features */
  15.846 -+#define NETIF_F_GSO_SHIFT	16
  15.847 -+#define NETIF_F_TSO		(SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
  15.848 -+#define NETIF_F_UFO		(SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT)
  15.849 -+#define NETIF_F_GSO_ROBUST	(SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
  15.850 -+
  15.851 -+#define NETIF_F_GEN_CSUM	(NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
  15.852 -+#define NETIF_F_ALL_CSUM	(NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
  15.853 - 
  15.854 - 	struct net_device	*next_sched;
  15.855 - 
  15.856 -@@ -394,6 +403,9 @@
  15.857 - 	struct list_head	qdisc_list;
  15.858 - 	unsigned long		tx_queue_len;	/* Max frames per queue allowed */
  15.859 - 
  15.860 -+	/* Partially transmitted GSO packet. */
  15.861 -+	struct sk_buff		*gso_skb;
  15.862 -+
  15.863 - 	/* ingress path synchronizer */
  15.864 - 	spinlock_t		ingress_lock;
  15.865 - 	struct Qdisc		*qdisc_ingress;
  15.866 -@@ -402,7 +414,7 @@
  15.867 -  * One part is mostly used on xmit path (device)
  15.868 -  */
  15.869 - 	/* hard_start_xmit synchronizer */
  15.870 --	spinlock_t		xmit_lock ____cacheline_aligned_in_smp;
  15.871 -+	spinlock_t		_xmit_lock ____cacheline_aligned_in_smp;
  15.872 - 	/* cpu id of processor entered to hard_start_xmit or -1,
  15.873 - 	   if nobody entered there.
  15.874 - 	 */
  15.875 -@@ -527,6 +539,8 @@
  15.876 - 					 struct net_device *,
  15.877 - 					 struct packet_type *,
  15.878 - 					 struct net_device *);
  15.879 -+	struct sk_buff		*(*gso_segment)(struct sk_buff *skb,
  15.880 -+						int features);
  15.881 - 	void			*af_packet_priv;
  15.882 - 	struct list_head	list;
  15.883 - };
  15.884 -@@ -693,7 +707,8 @@
  15.885 - extern int		dev_set_mtu(struct net_device *, int);
  15.886 - extern int		dev_set_mac_address(struct net_device *,
  15.887 - 					    struct sockaddr *);
  15.888 --extern void		dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
  15.889 -+extern int		dev_hard_start_xmit(struct sk_buff *skb,
  15.890 -+					    struct net_device *dev);
  15.891 - 
  15.892 - extern void		dev_init(void);
  15.893 - 
  15.894 -@@ -900,11 +915,43 @@
  15.895 - 	clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
  15.896 - }
  15.897 - 
  15.898 -+static inline void netif_tx_lock(struct net_device *dev)
  15.899 -+{
  15.900 -+	spin_lock(&dev->_xmit_lock);
  15.901 -+	dev->xmit_lock_owner = smp_processor_id();
  15.902 -+}
  15.903 -+
  15.904 -+static inline void netif_tx_lock_bh(struct net_device *dev)
  15.905 -+{
  15.906 -+	spin_lock_bh(&dev->_xmit_lock);
  15.907 -+	dev->xmit_lock_owner = smp_processor_id();
  15.908 -+}
  15.909 -+
  15.910 -+static inline int netif_tx_trylock(struct net_device *dev)
  15.911 -+{
  15.912 -+	int err = spin_trylock(&dev->_xmit_lock);
  15.913 -+	if (!err)
  15.914 -+		dev->xmit_lock_owner = smp_processor_id();
  15.915 -+	return err;
  15.916 -+}
  15.917 -+
  15.918 -+static inline void netif_tx_unlock(struct net_device *dev)
  15.919 -+{
  15.920 -+	dev->xmit_lock_owner = -1;
  15.921 -+	spin_unlock(&dev->_xmit_lock);
  15.922 -+}
  15.923 -+
  15.924 -+static inline void netif_tx_unlock_bh(struct net_device *dev)
  15.925 -+{
  15.926 -+	dev->xmit_lock_owner = -1;
  15.927 -+	spin_unlock_bh(&dev->_xmit_lock);
  15.928 -+}
  15.929 -+
  15.930 - static inline void netif_tx_disable(struct net_device *dev)
  15.931 - {
  15.932 --	spin_lock_bh(&dev->xmit_lock);
  15.933 -+	netif_tx_lock_bh(dev);
  15.934 - 	netif_stop_queue(dev);
  15.935 --	spin_unlock_bh(&dev->xmit_lock);
  15.936 -+	netif_tx_unlock_bh(dev);
  15.937 - }
  15.938 - 
  15.939 - /* These functions live elsewhere (drivers/net/net_init.c, but related) */
  15.940 -@@ -932,6 +979,7 @@
  15.941 - extern int		weight_p;
  15.942 - extern int		netdev_set_master(struct net_device *dev, struct net_device *master);
  15.943 - extern int skb_checksum_help(struct sk_buff *skb, int inward);
  15.944 -+extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features);
  15.945 - #ifdef CONFIG_BUG
  15.946 - extern void netdev_rx_csum_fault(struct net_device *dev);
  15.947 - #else
  15.948 -@@ -951,6 +999,18 @@
  15.949 - 
  15.950 - extern void linkwatch_run_queue(void);
  15.951 - 
  15.952 -+static inline int skb_gso_ok(struct sk_buff *skb, int features)
  15.953 -+{
  15.954 -+	int feature = skb_shinfo(skb)->gso_size ?
  15.955 -+		      skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT : 0;
  15.956 -+	return (features & feature) == feature;
  15.957 -+}
  15.958 -+
  15.959 -+static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
  15.960 -+{
  15.961 -+	return !skb_gso_ok(skb, dev->features);
  15.962 -+}
  15.963 -+
  15.964 - #endif /* __KERNEL__ */
  15.965 - 
  15.966 - #endif	/* _LINUX_DEV_H */
  15.967 -Index: tmp-xxx/include/linux/skbuff.h
  15.968 -===================================================================
  15.969 ---- tmp-xxx.orig/include/linux/skbuff.h	2006-11-15 10:38:39.000000000 +0000
  15.970 -+++ tmp-xxx/include/linux/skbuff.h	2006-11-27 10:52:42.000000000 +0000
  15.971 -@@ -134,9 +134,10 @@
  15.972 - struct skb_shared_info {
  15.973 - 	atomic_t	dataref;
  15.974 - 	unsigned short	nr_frags;
  15.975 --	unsigned short	tso_size;
  15.976 --	unsigned short	tso_segs;
  15.977 --	unsigned short  ufo_size;
  15.978 -+	unsigned short	gso_size;
  15.979 -+	/* Warning: this field is not always filled in (UFO)! */
  15.980 -+	unsigned short	gso_segs;
  15.981 -+	unsigned short  gso_type;
  15.982 - 	unsigned int    ip6_frag_id;
  15.983 - 	struct sk_buff	*frag_list;
  15.984 - 	skb_frag_t	frags[MAX_SKB_FRAGS];
  15.985 -@@ -168,6 +169,14 @@
  15.986 - 	SKB_FCLONE_CLONE,
  15.987 - };
  15.988 - 
  15.989 -+enum {
  15.990 -+	SKB_GSO_TCPV4 = 1 << 0,
  15.991 -+	SKB_GSO_UDPV4 = 1 << 1,
  15.992 -+
  15.993 -+	/* This indicates the skb is from an untrusted source. */
  15.994 -+	SKB_GSO_DODGY = 1 << 2,
  15.995 -+};
  15.996 -+
  15.997 - /** 
  15.998 -  *	struct sk_buff - socket buffer
  15.999 -  *	@next: Next buffer in list
 15.1000 -@@ -1148,18 +1157,34 @@
 15.1001 - 	return 0;
 15.1002 - }
 15.1003 - 
 15.1004 -+static inline int __skb_linearize(struct sk_buff *skb)
 15.1005 -+{
 15.1006 -+	return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM;
 15.1007 -+}
 15.1008 -+
 15.1009 - /**
 15.1010 -  *	skb_linearize - convert paged skb to linear one
 15.1011 -  *	@skb: buffer to linarize
 15.1012 -- *	@gfp: allocation mode
 15.1013 -  *
 15.1014 -  *	If there is no free memory -ENOMEM is returned, otherwise zero
 15.1015 -  *	is returned and the old skb data released.
 15.1016 -  */
 15.1017 --extern int __skb_linearize(struct sk_buff *skb, gfp_t gfp);
 15.1018 --static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp)
 15.1019 -+static inline int skb_linearize(struct sk_buff *skb)
 15.1020 -+{
 15.1021 -+	return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0;
 15.1022 -+}
 15.1023 -+
 15.1024 -+/**
 15.1025 -+ *	skb_linearize_cow - make sure skb is linear and writable
 15.1026 -+ *	@skb: buffer to process
 15.1027 -+ *
 15.1028 -+ *	If there is no free memory -ENOMEM is returned, otherwise zero
 15.1029 -+ *	is returned and the old skb data released.
 15.1030 -+ */
 15.1031 -+static inline int skb_linearize_cow(struct sk_buff *skb)
 15.1032 - {
 15.1033 --	return __skb_linearize(skb, gfp);
 15.1034 -+	return skb_is_nonlinear(skb) || skb_cloned(skb) ?
 15.1035 -+	       __skb_linearize(skb) : 0;
 15.1036 - }
 15.1037 - 
 15.1038 - /**
 15.1039 -@@ -1254,6 +1279,7 @@
 15.1040 - 				 struct sk_buff *skb1, const u32 len);
 15.1041 - 
 15.1042 - extern void	       skb_release_data(struct sk_buff *skb);
 15.1043 -+extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
 15.1044 - 
 15.1045 - static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
 15.1046 - 				       int len, void *buffer)
 15.1047 -Index: tmp-xxx/include/net/pkt_sched.h
 15.1048 -===================================================================
 15.1049 ---- tmp-xxx.orig/include/net/pkt_sched.h	2006-11-15 10:38:39.000000000 +0000
 15.1050 -+++ tmp-xxx/include/net/pkt_sched.h	2006-11-27 10:52:42.000000000 +0000
 15.1051 -@@ -218,12 +218,13 @@
 15.1052 - 		struct rtattr *tab);
 15.1053 - extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
 15.1054 - 
 15.1055 --extern int qdisc_restart(struct net_device *dev);
 15.1056 -+extern void __qdisc_run(struct net_device *dev);
 15.1057 - 
 15.1058 - static inline void qdisc_run(struct net_device *dev)
 15.1059 - {
 15.1060 --	while (!netif_queue_stopped(dev) && qdisc_restart(dev) < 0)
 15.1061 --		/* NOTHING */;
 15.1062 -+	if (!netif_queue_stopped(dev) &&
 15.1063 -+	    !test_and_set_bit(__LINK_STATE_QDISC_RUNNING, &dev->state))
 15.1064 -+		__qdisc_run(dev);
 15.1065 - }
 15.1066 - 
 15.1067 - extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp,
 15.1068 -Index: tmp-xxx/include/net/protocol.h
 15.1069 -===================================================================
 15.1070 ---- tmp-xxx.orig/include/net/protocol.h	2006-11-15 10:38:39.000000000 +0000
 15.1071 -+++ tmp-xxx/include/net/protocol.h	2006-11-27 10:52:42.000000000 +0000
 15.1072 -@@ -37,6 +37,8 @@
 15.1073 - struct net_protocol {
 15.1074 - 	int			(*handler)(struct sk_buff *skb);
 15.1075 - 	void			(*err_handler)(struct sk_buff *skb, u32 info);
 15.1076 -+	struct sk_buff	       *(*gso_segment)(struct sk_buff *skb,
 15.1077 -+					       int features);
 15.1078 - 	int			no_policy;
 15.1079 - };
 15.1080 - 
 15.1081 -Index: tmp-xxx/include/net/sock.h
 15.1082 -===================================================================
 15.1083 ---- tmp-xxx.orig/include/net/sock.h	2006-11-15 10:38:39.000000000 +0000
 15.1084 -+++ tmp-xxx/include/net/sock.h	2006-11-27 10:52:42.000000000 +0000
 15.1085 -@@ -1064,9 +1064,13 @@
 15.1086 - {
 15.1087 - 	__sk_dst_set(sk, dst);
 15.1088 - 	sk->sk_route_caps = dst->dev->features;
 15.1089 -+	if (sk->sk_route_caps & NETIF_F_GSO)
 15.1090 -+		sk->sk_route_caps |= NETIF_F_TSO;
 15.1091 - 	if (sk->sk_route_caps & NETIF_F_TSO) {
 15.1092 - 		if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len)
 15.1093 - 			sk->sk_route_caps &= ~NETIF_F_TSO;
 15.1094 -+		else 
 15.1095 -+			sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
 15.1096 - 	}
 15.1097 - }
 15.1098 - 
 15.1099 -Index: tmp-xxx/include/net/tcp.h
 15.1100 -===================================================================
 15.1101 ---- tmp-xxx.orig/include/net/tcp.h	2006-11-15 10:38:39.000000000 +0000
 15.1102 -+++ tmp-xxx/include/net/tcp.h	2006-11-27 10:52:42.000000000 +0000
 15.1103 -@@ -552,13 +552,13 @@
 15.1104 -  */
 15.1105 - static inline int tcp_skb_pcount(const struct sk_buff *skb)
 15.1106 - {
 15.1107 --	return skb_shinfo(skb)->tso_segs;
 15.1108 -+	return skb_shinfo(skb)->gso_segs;
 15.1109 - }
 15.1110 - 
 15.1111 - /* This is valid iff tcp_skb_pcount() > 1. */
 15.1112 - static inline int tcp_skb_mss(const struct sk_buff *skb)
 15.1113 - {
 15.1114 --	return skb_shinfo(skb)->tso_size;
 15.1115 -+	return skb_shinfo(skb)->gso_size;
 15.1116 - }
 15.1117 - 
 15.1118 - static inline void tcp_dec_pcount_approx(__u32 *count,
 15.1119 -@@ -1063,6 +1063,8 @@
 15.1120 - 
 15.1121 - extern int tcp_v4_destroy_sock(struct sock *sk);
 15.1122 - 
 15.1123 -+extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features);
 15.1124 -+
 15.1125 - #ifdef CONFIG_PROC_FS
 15.1126 - extern int  tcp4_proc_init(void);
 15.1127 - extern void tcp4_proc_exit(void);
 15.1128 -Index: tmp-xxx/net/atm/clip.c
 15.1129 -===================================================================
 15.1130 ---- tmp-xxx.orig/net/atm/clip.c	2006-11-15 10:38:39.000000000 +0000
 15.1131 -+++ tmp-xxx/net/atm/clip.c	2006-11-27 10:52:42.000000000 +0000
 15.1132 -@@ -101,7 +101,7 @@
 15.1133 - 		printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n",clip_vcc);
 15.1134 - 		return;
 15.1135 - 	}
 15.1136 --	spin_lock_bh(&entry->neigh->dev->xmit_lock);	/* block clip_start_xmit() */
 15.1137 -+	netif_tx_lock_bh(entry->neigh->dev);	/* block clip_start_xmit() */
 15.1138 - 	entry->neigh->used = jiffies;
 15.1139 - 	for (walk = &entry->vccs; *walk; walk = &(*walk)->next)
 15.1140 - 		if (*walk == clip_vcc) {
 15.1141 -@@ -125,7 +125,7 @@
 15.1142 - 	printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc "
 15.1143 - 	  "0x%p)\n",entry,clip_vcc);
 15.1144 - out:
 15.1145 --	spin_unlock_bh(&entry->neigh->dev->xmit_lock);
 15.1146 -+	netif_tx_unlock_bh(entry->neigh->dev);
 15.1147 - }
 15.1148 - 
 15.1149 - /* The neighbour entry n->lock is held. */
 15.1150 -Index: tmp-xxx/net/bridge/br_device.c
 15.1151 -===================================================================
 15.1152 ---- tmp-xxx.orig/net/bridge/br_device.c	2006-11-15 10:38:39.000000000 +0000
 15.1153 -+++ tmp-xxx/net/bridge/br_device.c	2006-11-27 10:52:42.000000000 +0000
 15.1154 -@@ -146,9 +146,9 @@
 15.1155 - 	struct net_bridge *br = netdev_priv(dev);
 15.1156 - 
 15.1157 - 	if (data)
 15.1158 --		br->feature_mask |= NETIF_F_IP_CSUM;
 15.1159 -+		br->feature_mask |= NETIF_F_NO_CSUM;
 15.1160 - 	else
 15.1161 --		br->feature_mask &= ~NETIF_F_IP_CSUM;
 15.1162 -+		br->feature_mask &= ~NETIF_F_ALL_CSUM;
 15.1163 - 
 15.1164 - 	br_features_recompute(br);
 15.1165 - 	return 0;
 15.1166 -@@ -185,6 +185,6 @@
 15.1167 - 	dev->set_mac_address = br_set_mac_address;
 15.1168 - 	dev->priv_flags = IFF_EBRIDGE;
 15.1169 - 
 15.1170 -- 	dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
 15.1171 -- 		| NETIF_F_HIGHDMA | NETIF_F_TSO | NETIF_F_IP_CSUM;
 15.1172 -+ 	dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
 15.1173 -+ 			NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST;
 15.1174 - }
 15.1175 -Index: tmp-xxx/net/bridge/br_forward.c
 15.1176 -===================================================================
 15.1177 ---- tmp-xxx.orig/net/bridge/br_forward.c	2006-11-15 10:38:39.000000000 +0000
 15.1178 -+++ tmp-xxx/net/bridge/br_forward.c	2006-11-27 10:52:42.000000000 +0000
 15.1179 -@@ -32,7 +32,7 @@
 15.1180 - int br_dev_queue_push_xmit(struct sk_buff *skb)
 15.1181 - {
 15.1182 - 	/* drop mtu oversized packets except tso */
 15.1183 --	if (skb->len > skb->dev->mtu && !skb_shinfo(skb)->tso_size)
 15.1184 -+	if (skb->len > skb->dev->mtu && !skb_shinfo(skb)->gso_size)
 15.1185 - 		kfree_skb(skb);
 15.1186 - 	else {
 15.1187 - #ifdef CONFIG_BRIDGE_NETFILTER
 15.1188 -Index: tmp-xxx/net/bridge/br_if.c
 15.1189 -===================================================================
 15.1190 ---- tmp-xxx.orig/net/bridge/br_if.c	2006-11-15 10:38:39.000000000 +0000
 15.1191 -+++ tmp-xxx/net/bridge/br_if.c	2006-11-27 10:52:42.000000000 +0000
 15.1192 -@@ -385,17 +385,28 @@
 15.1193 - 	struct net_bridge_port *p;
 15.1194 - 	unsigned long features, checksum;
 15.1195 - 
 15.1196 --	features = br->feature_mask &~ NETIF_F_IP_CSUM;
 15.1197 --	checksum = br->feature_mask & NETIF_F_IP_CSUM;
 15.1198 -+	checksum = br->feature_mask & NETIF_F_ALL_CSUM ? NETIF_F_NO_CSUM : 0;
 15.1199 -+	features = br->feature_mask & ~NETIF_F_ALL_CSUM;
 15.1200 - 
 15.1201 - 	list_for_each_entry(p, &br->port_list, list) {
 15.1202 --		if (!(p->dev->features 
 15.1203 --		      & (NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM)))
 15.1204 -+		unsigned long feature = p->dev->features;
 15.1205 -+
 15.1206 -+		if (checksum & NETIF_F_NO_CSUM && !(feature & NETIF_F_NO_CSUM))
 15.1207 -+			checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
 15.1208 -+		if (checksum & NETIF_F_HW_CSUM && !(feature & NETIF_F_HW_CSUM))
 15.1209 -+			checksum ^= NETIF_F_HW_CSUM | NETIF_F_IP_CSUM;
 15.1210 -+		if (!(feature & NETIF_F_IP_CSUM))
 15.1211 - 			checksum = 0;
 15.1212 --		features &= p->dev->features;
 15.1213 -+
 15.1214 -+		if (feature & NETIF_F_GSO)
 15.1215 -+			feature |= NETIF_F_TSO;
 15.1216 -+		feature |= NETIF_F_GSO;
 15.1217 -+
 15.1218 -+		features &= feature;
 15.1219 - 	}
 15.1220 - 
 15.1221 --	br->dev->features = features | checksum | NETIF_F_LLTX;
 15.1222 -+	br->dev->features = features | checksum | NETIF_F_LLTX |
 15.1223 -+			    NETIF_F_GSO_ROBUST;
 15.1224 - }
 15.1225 - 
 15.1226 - /* called with RTNL */
 15.1227 -Index: tmp-xxx/net/bridge/br_netfilter.c
 15.1228 -===================================================================
 15.1229 ---- tmp-xxx.orig/net/bridge/br_netfilter.c	2006-11-15 10:38:39.000000000 +0000
 15.1230 -+++ tmp-xxx/net/bridge/br_netfilter.c	2006-11-27 10:52:42.000000000 +0000
 15.1231 -@@ -743,7 +743,7 @@
 15.1232 - {
 15.1233 - 	if (skb->protocol == htons(ETH_P_IP) &&
 15.1234 - 	    skb->len > skb->dev->mtu &&
 15.1235 --	    !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size))
 15.1236 -+	    !skb_shinfo(skb)->gso_size)
 15.1237 - 		return ip_fragment(skb, br_dev_queue_push_xmit);
 15.1238 - 	else
 15.1239 - 		return br_dev_queue_push_xmit(skb);
 15.1240 -Index: tmp-xxx/net/core/dev.c
 15.1241 -===================================================================
 15.1242 ---- tmp-xxx.orig/net/core/dev.c	2006-11-15 10:38:39.000000000 +0000
 15.1243 -+++ tmp-xxx/net/core/dev.c	2006-11-27 10:57:31.000000000 +0000
 15.1244 -@@ -115,6 +115,7 @@
 15.1245 - #include <net/iw_handler.h>
 15.1246 - #endif	/* CONFIG_NET_RADIO */
 15.1247 - #include <asm/current.h>
 15.1248 -+#include <linux/err.h>
 15.1249 - 
 15.1250 - /*
 15.1251 -  *	The list of packet types we will receive (as opposed to discard)
 15.1252 -@@ -1032,7 +1033,7 @@
 15.1253 -  *	taps currently in use.
 15.1254 -  */
 15.1255 - 
 15.1256 --void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
 15.1257 -+static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
 15.1258 - {
 15.1259 - 	struct packet_type *ptype;
 15.1260 - 
 15.1261 -@@ -1106,6 +1107,45 @@
 15.1262 - 	return ret;
 15.1263 - }
 15.1264 - 
 15.1265 -+/**
 15.1266 -+ *	skb_gso_segment - Perform segmentation on skb.
 15.1267 -+ *	@skb: buffer to segment
 15.1268 -+ *	@features: features for the output path (see dev->features)
 15.1269 -+ *
 15.1270 -+ *	This function segments the given skb and returns a list of segments.
 15.1271 -+ *
 15.1272 -+ *	It may return NULL if the skb requires no segmentation.  This is
 15.1273 -+ *	only possible when GSO is used for verifying header integrity.
 15.1274 -+ */
 15.1275 -+struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
 15.1276 -+{
 15.1277 -+	struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
 15.1278 -+	struct packet_type *ptype;
 15.1279 -+	int type = skb->protocol;
 15.1280 -+
 15.1281 -+	BUG_ON(skb_shinfo(skb)->frag_list);
 15.1282 -+	BUG_ON(skb->ip_summed != CHECKSUM_HW);
 15.1283 -+
 15.1284 -+	skb->mac.raw = skb->data;
 15.1285 -+	skb->mac_len = skb->nh.raw - skb->data;
 15.1286 -+	__skb_pull(skb, skb->mac_len);
 15.1287 -+
 15.1288 -+	rcu_read_lock();
 15.1289 -+	list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) {
 15.1290 -+		if (ptype->type == type && !ptype->dev && ptype->gso_segment) {
 15.1291 -+			segs = ptype->gso_segment(skb, features);
 15.1292 -+			break;
 15.1293 -+		}
 15.1294 -+	}
 15.1295 -+	rcu_read_unlock();
 15.1296 -+
 15.1297 -+	__skb_push(skb, skb->data - skb->mac.raw);
 15.1298 -+
 15.1299 -+	return segs;
 15.1300 -+}
 15.1301 -+
 15.1302 -+EXPORT_SYMBOL(skb_gso_segment);
 15.1303 -+
 15.1304 - /* Take action when hardware reception checksum errors are detected. */
 15.1305 - #ifdef CONFIG_BUG
 15.1306 - void netdev_rx_csum_fault(struct net_device *dev)
 15.1307 -@@ -1142,76 +1182,107 @@
 15.1308 - #define illegal_highdma(dev, skb)	(0)
 15.1309 - #endif
 15.1310 - 
 15.1311 --/* Keep head the same: replace data */
 15.1312 --int __skb_linearize(struct sk_buff *skb, gfp_t gfp_mask)
 15.1313 -+struct dev_gso_cb {
 15.1314 -+	void (*destructor)(struct sk_buff *skb);
 15.1315 -+};
 15.1316 -+
 15.1317 -+#define DEV_GSO_CB(skb) ((struct dev_gso_cb *)(skb)->cb)
 15.1318 -+
 15.1319 -+static void dev_gso_skb_destructor(struct sk_buff *skb)
 15.1320 - {
 15.1321 --	unsigned int size;
 15.1322 --	u8 *data;
 15.1323 --	long offset;
 15.1324 --	struct skb_shared_info *ninfo;
 15.1325 --	int headerlen = skb->data - skb->head;
 15.1326 --	int expand = (skb->tail + skb->data_len) - skb->end;
 15.1327 --
 15.1328 --	if (skb_shared(skb))
 15.1329 --		BUG();
 15.1330 --
 15.1331 --	if (expand <= 0)
 15.1332 --		expand = 0;
 15.1333 --
 15.1334 --	size = skb->end - skb->head + expand;
 15.1335 --	size = SKB_DATA_ALIGN(size);
 15.1336 --	data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
 15.1337 --	if (!data)
 15.1338 --		return -ENOMEM;
 15.1339 --
 15.1340 --	/* Copy entire thing */
 15.1341 --	if (skb_copy_bits(skb, -headerlen, data, headerlen + skb->len))
 15.1342 --		BUG();
 15.1343 --
 15.1344 --	/* Set up shinfo */
 15.1345 --	ninfo = (struct skb_shared_info*)(data + size);
 15.1346 --	atomic_set(&ninfo->dataref, 1);
 15.1347 --	ninfo->tso_size = skb_shinfo(skb)->tso_size;
 15.1348 --	ninfo->tso_segs = skb_shinfo(skb)->tso_segs;
 15.1349 --	ninfo->ufo_size = skb_shinfo(skb)->ufo_size;
 15.1350 --	ninfo->nr_frags = 0;
 15.1351 --	ninfo->frag_list = NULL;
 15.1352 --
 15.1353 --	/* Offset between the two in bytes */
 15.1354 --	offset = data - skb->head;
 15.1355 --
 15.1356 --	/* Free old data. */
 15.1357 --	skb_release_data(skb);
 15.1358 --
 15.1359 --	skb->head = data;
 15.1360 --	skb->end  = data + size;
 15.1361 --
 15.1362 --	/* Set up new pointers */
 15.1363 --	skb->h.raw   += offset;
 15.1364 --	skb->nh.raw  += offset;
 15.1365 --	skb->mac.raw += offset;
 15.1366 --	skb->tail    += offset;
 15.1367 --	skb->data    += offset;
 15.1368 -+	struct dev_gso_cb *cb;
 15.1369 - 
 15.1370 --	/* We are no longer a clone, even if we were. */
 15.1371 --	skb->cloned    = 0;
 15.1372 -+	do {
 15.1373 -+		struct sk_buff *nskb = skb->next;
 15.1374 - 
 15.1375 --	skb->tail     += skb->data_len;
 15.1376 --	skb->data_len  = 0;
 15.1377 -+		skb->next = nskb->next;
 15.1378 -+		nskb->next = NULL;
 15.1379 -+		kfree_skb(nskb);
 15.1380 -+	} while (skb->next);
 15.1381 -+
 15.1382 -+	cb = DEV_GSO_CB(skb);
 15.1383 -+	if (cb->destructor)
 15.1384 -+		cb->destructor(skb);
 15.1385 -+}
 15.1386 -+
 15.1387 -+/**
 15.1388 -+ *	dev_gso_segment - Perform emulated hardware segmentation on skb.
 15.1389 -+ *	@skb: buffer to segment
 15.1390 -+ *
 15.1391 -+ *	This function segments the given skb and stores the list of segments
 15.1392 -+ *	in skb->next.
 15.1393 -+ */
 15.1394 -+static int dev_gso_segment(struct sk_buff *skb)
 15.1395 -+{
 15.1396 -+	struct net_device *dev = skb->dev;
 15.1397 -+	struct sk_buff *segs;
 15.1398 -+	int features = dev->features & ~(illegal_highdma(dev, skb) ?
 15.1399 -+					 NETIF_F_SG : 0);
 15.1400 -+
 15.1401 -+	segs = skb_gso_segment(skb, features);
 15.1402 -+
 15.1403 -+	/* Verifying header integrity only. */
 15.1404 -+	if (!segs)
 15.1405 -+		return 0;
 15.1406 -+  
 15.1407 -+	if (unlikely(IS_ERR(segs)))
 15.1408 -+		return PTR_ERR(segs);
 15.1409 -+
 15.1410 -+	skb->next = segs;
 15.1411 -+	DEV_GSO_CB(skb)->destructor = skb->destructor;
 15.1412 -+	skb->destructor = dev_gso_skb_destructor;
 15.1413 -+	return 0;
 15.1414 -+}
 15.1415 -+
 15.1416 -+int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 15.1417 -+{
 15.1418 -+	if (likely(!skb->next)) {
 15.1419 -+		if (netdev_nit)
 15.1420 -+			dev_queue_xmit_nit(skb, dev);
 15.1421 -+
 15.1422 -+		if (netif_needs_gso(dev, skb)) {
 15.1423 -+			if (unlikely(dev_gso_segment(skb)))
 15.1424 -+				goto out_kfree_skb;
 15.1425 -+			if (skb->next)
 15.1426 -+				goto gso;
 15.1427 -+		}
 15.1428 -+
 15.1429 -+		return dev->hard_start_xmit(skb, dev);
 15.1430 -+	}
 15.1431 -+
 15.1432 -+gso:
 15.1433 -+	do {
 15.1434 -+		struct sk_buff *nskb = skb->next;
 15.1435 -+		int rc;
 15.1436 -+
 15.1437 -+		skb->next = nskb->next;
 15.1438 -+		nskb->next = NULL;
 15.1439 -+		rc = dev->hard_start_xmit(nskb, dev);
 15.1440 -+		if (unlikely(rc)) {
 15.1441 -+			nskb->next = skb->next;
 15.1442 -+			skb->next = nskb;
 15.1443 -+			return rc;
 15.1444 -+		}
 15.1445 -+		if (unlikely(netif_queue_stopped(dev) && skb->next))
 15.1446 -+			return NETDEV_TX_BUSY;
 15.1447 -+	} while (skb->next);
 15.1448 -+	
 15.1449 -+	skb->destructor = DEV_GSO_CB(skb)->destructor;
 15.1450 -+
 15.1451 -+out_kfree_skb:
 15.1452 -+	kfree_skb(skb);
 15.1453 - 	return 0;
 15.1454 - }
 15.1455 - 
 15.1456 - #define HARD_TX_LOCK(dev, cpu) {			\
 15.1457 - 	if ((dev->features & NETIF_F_LLTX) == 0) {	\
 15.1458 --		spin_lock(&dev->xmit_lock);		\
 15.1459 --		dev->xmit_lock_owner = cpu;		\
 15.1460 -+		netif_tx_lock(dev);			\
 15.1461 - 	}						\
 15.1462 - }
 15.1463 - 
 15.1464 - #define HARD_TX_UNLOCK(dev) {				\
 15.1465 - 	if ((dev->features & NETIF_F_LLTX) == 0) {	\
 15.1466 --		dev->xmit_lock_owner = -1;		\
 15.1467 --		spin_unlock(&dev->xmit_lock);		\
 15.1468 -+		netif_tx_unlock(dev);			\
 15.1469 - 	}						\
 15.1470 - }
 15.1471 - 
 15.1472 -@@ -1247,9 +1318,13 @@
 15.1473 - 	struct Qdisc *q;
 15.1474 - 	int rc = -ENOMEM;
 15.1475 - 
 15.1476 -+	/* GSO will handle the following emulations directly. */
 15.1477 -+	if (netif_needs_gso(dev, skb))
 15.1478 -+		goto gso;
 15.1479 -+
 15.1480 - 	if (skb_shinfo(skb)->frag_list &&
 15.1481 - 	    !(dev->features & NETIF_F_FRAGLIST) &&
 15.1482 --	    __skb_linearize(skb, GFP_ATOMIC))
 15.1483 -+	    __skb_linearize(skb))
 15.1484 - 		goto out_kfree_skb;
 15.1485 - 
 15.1486 - 	/* Fragmented skb is linearized if device does not support SG,
 15.1487 -@@ -1258,25 +1333,26 @@
 15.1488 - 	 */
 15.1489 - 	if (skb_shinfo(skb)->nr_frags &&
 15.1490 - 	    (!(dev->features & NETIF_F_SG) || illegal_highdma(dev, skb)) &&
 15.1491 --	    __skb_linearize(skb, GFP_ATOMIC))
 15.1492 -+	    __skb_linearize(skb))
 15.1493 - 		goto out_kfree_skb;
 15.1494 - 
 15.1495 - 	/* If packet is not checksummed and device does not support
 15.1496 - 	 * checksumming for this protocol, complete checksumming here.
 15.1497 - 	 */
 15.1498 - 	if (skb->ip_summed == CHECKSUM_HW &&
 15.1499 --	    (!(dev->features & (NETIF_F_HW_CSUM | NETIF_F_NO_CSUM)) &&
 15.1500 -+	    (!(dev->features & NETIF_F_GEN_CSUM) &&
 15.1501 - 	     (!(dev->features & NETIF_F_IP_CSUM) ||
 15.1502 - 	      skb->protocol != htons(ETH_P_IP))))
 15.1503 - 	      	if (skb_checksum_help(skb, 0))
 15.1504 - 	      		goto out_kfree_skb;
 15.1505 - 
 15.1506 -+gso:
 15.1507 - 	spin_lock_prefetch(&dev->queue_lock);
 15.1508 - 
 15.1509 - 	/* Disable soft irqs for various locks below. Also 
 15.1510 - 	 * stops preemption for RCU. 
 15.1511 - 	 */
 15.1512 --	local_bh_disable(); 
 15.1513 -+	rcu_read_lock_bh(); 
 15.1514 - 
 15.1515 - 	/* Updates of qdisc are serialized by queue_lock. 
 15.1516 - 	 * The struct Qdisc which is pointed to by qdisc is now a 
 15.1517 -@@ -1310,8 +1386,8 @@
 15.1518 - 	/* The device has no queue. Common case for software devices:
 15.1519 - 	   loopback, all the sorts of tunnels...
 15.1520 - 
 15.1521 --	   Really, it is unlikely that xmit_lock protection is necessary here.
 15.1522 --	   (f.e. loopback and IP tunnels are clean ignoring statistics
 15.1523 -+	   Really, it is unlikely that netif_tx_lock protection is necessary
 15.1524 -+	   here.  (f.e. loopback and IP tunnels are clean ignoring statistics
 15.1525 - 	   counters.)
 15.1526 - 	   However, it is possible, that they rely on protection
 15.1527 - 	   made by us here.
 15.1528 -@@ -1327,11 +1403,8 @@
 15.1529 - 			HARD_TX_LOCK(dev, cpu);
 15.1530 - 
 15.1531 - 			if (!netif_queue_stopped(dev)) {
 15.1532 --				if (netdev_nit)
 15.1533 --					dev_queue_xmit_nit(skb, dev);
 15.1534 --
 15.1535 - 				rc = 0;
 15.1536 --				if (!dev->hard_start_xmit(skb, dev)) {
 15.1537 -+				if (!dev_hard_start_xmit(skb, dev)) {
 15.1538 - 					HARD_TX_UNLOCK(dev);
 15.1539 - 					goto out;
 15.1540 - 				}
 15.1541 -@@ -1350,13 +1423,13 @@
 15.1542 - 	}
 15.1543 - 
 15.1544 - 	rc = -ENETDOWN;
 15.1545 --	local_bh_enable();
 15.1546 -+	rcu_read_unlock_bh();
 15.1547 - 
 15.1548 - out_kfree_skb:
 15.1549 - 	kfree_skb(skb);
 15.1550 - 	return rc;
 15.1551 - out:
 15.1552 --	local_bh_enable();
 15.1553 -+	rcu_read_unlock_bh();
 15.1554 - 	return rc;
 15.1555 - }
 15.1556 - 
 15.1557 -@@ -2671,7 +2744,7 @@
 15.1558 - 	BUG_ON(dev->reg_state != NETREG_UNINITIALIZED);
 15.1559 - 
 15.1560 - 	spin_lock_init(&dev->queue_lock);
 15.1561 --	spin_lock_init(&dev->xmit_lock);
 15.1562 -+	spin_lock_init(&dev->_xmit_lock);
 15.1563 - 	dev->xmit_lock_owner = -1;
 15.1564 - #ifdef CONFIG_NET_CLS_ACT
 15.1565 - 	spin_lock_init(&dev->ingress_lock);
 15.1566 -@@ -2715,9 +2788,7 @@
 15.1567 - 
 15.1568 - 	/* Fix illegal SG+CSUM combinations. */
 15.1569 - 	if ((dev->features & NETIF_F_SG) &&
 15.1570 --	    !(dev->features & (NETIF_F_IP_CSUM |
 15.1571 --			       NETIF_F_NO_CSUM |
 15.1572 --			       NETIF_F_HW_CSUM))) {
 15.1573 -+	    !(dev->features & NETIF_F_ALL_CSUM)) {
 15.1574 - 		printk("%s: Dropping NETIF_F_SG since no checksum feature.\n",
 15.1575 - 		       dev->name);
 15.1576 - 		dev->features &= ~NETIF_F_SG;
 15.1577 -@@ -3269,7 +3340,6 @@
 15.1578 - EXPORT_SYMBOL(__dev_get_by_index);
 15.1579 - EXPORT_SYMBOL(__dev_get_by_name);
 15.1580 - EXPORT_SYMBOL(__dev_remove_pack);
 15.1581 --EXPORT_SYMBOL(__skb_linearize);
 15.1582 - EXPORT_SYMBOL(dev_valid_name);
 15.1583 - EXPORT_SYMBOL(dev_add_pack);
 15.1584 - EXPORT_SYMBOL(dev_alloc_name);
 15.1585 -Index: tmp-xxx/net/core/dev_mcast.c
 15.1586 -===================================================================
 15.1587 ---- tmp-xxx.orig/net/core/dev_mcast.c	2006-11-15 10:38:39.000000000 +0000
 15.1588 -+++ tmp-xxx/net/core/dev_mcast.c	2006-11-27 10:52:42.000000000 +0000
 15.1589 -@@ -62,7 +62,7 @@
 15.1590 -  *	Device mc lists are changed by bh at least if IPv6 is enabled,
 15.1591 -  *	so that it must be bh protected.
 15.1592 -  *
 15.1593 -- *	We block accesses to device mc filters with dev->xmit_lock.
 15.1594 -+ *	We block accesses to device mc filters with netif_tx_lock.
 15.1595 -  */
 15.1596 - 
 15.1597 - /*
 15.1598 -@@ -93,9 +93,9 @@
 15.1599 - 
 15.1600 - void dev_mc_upload(struct net_device *dev)
 15.1601 - {
 15.1602 --	spin_lock_bh(&dev->xmit_lock);
 15.1603 -+	netif_tx_lock_bh(dev);
 15.1604 - 	__dev_mc_upload(dev);
 15.1605 --	spin_unlock_bh(&dev->xmit_lock);
 15.1606 -+	netif_tx_unlock_bh(dev);
 15.1607 - }
 15.1608 - 
 15.1609 - /*
 15.1610 -@@ -107,7 +107,7 @@
 15.1611 - 	int err = 0;
 15.1612 - 	struct dev_mc_list *dmi, **dmip;
 15.1613 - 
 15.1614 --	spin_lock_bh(&dev->xmit_lock);
 15.1615 -+	netif_tx_lock_bh(dev);
 15.1616 - 
 15.1617 - 	for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; dmip = &dmi->next) {
 15.1618 - 		/*
 15.1619 -@@ -139,13 +139,13 @@
 15.1620 - 			 */
 15.1621 - 			__dev_mc_upload(dev);
 15.1622 - 			
 15.1623 --			spin_unlock_bh(&dev->xmit_lock);
 15.1624 -+			netif_tx_unlock_bh(dev);
 15.1625 - 			return 0;
 15.1626 - 		}
 15.1627 - 	}
 15.1628 - 	err = -ENOENT;
 15.1629 - done:
 15.1630 --	spin_unlock_bh(&dev->xmit_lock);
 15.1631 -+	netif_tx_unlock_bh(dev);
 15.1632 - 	return err;
 15.1633 - }
 15.1634 - 
 15.1635 -@@ -160,7 +160,7 @@
 15.1636 - 
 15.1637 - 	dmi1 = kmalloc(sizeof(*dmi), GFP_ATOMIC);
 15.1638 - 
 15.1639 --	spin_lock_bh(&dev->xmit_lock);
 15.1640 -+	netif_tx_lock_bh(dev);
 15.1641 - 	for (dmi = dev->mc_list; dmi != NULL; dmi = dmi->next) {
 15.1642 - 		if (memcmp(dmi->dmi_addr, addr, dmi->dmi_addrlen) == 0 &&
 15.1643 - 		    dmi->dmi_addrlen == alen) {
 15.1644 -@@ -176,7 +176,7 @@
 15.1645 - 	}
 15.1646 - 
 15.1647 - 	if ((dmi = dmi1) == NULL) {
 15.1648 --		spin_unlock_bh(&dev->xmit_lock);
 15.1649 -+		netif_tx_unlock_bh(dev);
 15.1650 - 		return -ENOMEM;
 15.1651 - 	}
 15.1652 - 	memcpy(dmi->dmi_addr, addr, alen);
 15.1653 -@@ -189,11 +189,11 @@
 15.1654 - 
 15.1655 - 	__dev_mc_upload(dev);
 15.1656 - 	
 15.1657 --	spin_unlock_bh(&dev->xmit_lock);
 15.1658 -+	netif_tx_unlock_bh(dev);
 15.1659 - 	return 0;
 15.1660 - 
 15.1661 - done:
 15.1662 --	spin_unlock_bh(&dev->xmit_lock);
 15.1663 -+	netif_tx_unlock_bh(dev);
 15.1664 - 	kfree(dmi1);
 15.1665 - 	return err;
 15.1666 - }
 15.1667 -@@ -204,7 +204,7 @@
 15.1668 - 
 15.1669 - void dev_mc_discard(struct net_device *dev)
 15.1670 - {
 15.1671 --	spin_lock_bh(&dev->xmit_lock);
 15.1672 -+	netif_tx_lock_bh(dev);
 15.1673 - 	
 15.1674 - 	while (dev->mc_list != NULL) {
 15.1675 - 		struct dev_mc_list *tmp = dev->mc_list;
 15.1676 -@@ -215,7 +215,7 @@
 15.1677 - 	}
 15.1678 - 	dev->mc_count = 0;
 15.1679 - 
 15.1680 --	spin_unlock_bh(&dev->xmit_lock);
 15.1681 -+	netif_tx_unlock_bh(dev);
 15.1682 - }
 15.1683 - 
 15.1684 - #ifdef CONFIG_PROC_FS
 15.1685 -@@ -250,7 +250,7 @@
 15.1686 - 	struct dev_mc_list *m;
 15.1687 - 	struct net_device *dev = v;
 15.1688 - 
 15.1689 --	spin_lock_bh(&dev->xmit_lock);
 15.1690 -+	netif_tx_lock_bh(dev);
 15.1691 - 	for (m = dev->mc_list; m; m = m->next) {
 15.1692 - 		int i;
 15.1693 - 
 15.1694 -@@ -262,7 +262,7 @@
 15.1695 - 
 15.1696 - 		seq_putc(seq, '\n');
 15.1697 - 	}
 15.1698 --	spin_unlock_bh(&dev->xmit_lock);
 15.1699 -+	netif_tx_unlock_bh(dev);
 15.1700 - 	return 0;
 15.1701 - }
 15.1702 - 
 15.1703 -Index: tmp-xxx/net/core/ethtool.c
 15.1704 -===================================================================
 15.1705 ---- tmp-xxx.orig/net/core/ethtool.c	2006-11-15 10:38:39.000000000 +0000
 15.1706 -+++ tmp-xxx/net/core/ethtool.c	2006-11-27 10:52:42.000000000 +0000
 15.1707 -@@ -30,7 +30,7 @@
 15.1708 - 
 15.1709 - u32 ethtool_op_get_tx_csum(struct net_device *dev)
 15.1710 - {
 15.1711 --	return (dev->features & (NETIF_F_IP_CSUM | NETIF_F_HW_CSUM)) != 0;
 15.1712 -+	return (dev->features & NETIF_F_ALL_CSUM) != 0;
 15.1713 - }
 15.1714 - 
 15.1715 - int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
 15.1716 -@@ -551,9 +551,7 @@
 15.1717 - 		return -EFAULT;
 15.1718 - 
 15.1719 - 	if (edata.data && 
 15.1720 --	    !(dev->features & (NETIF_F_IP_CSUM |
 15.1721 --			       NETIF_F_NO_CSUM |
 15.1722 --			       NETIF_F_HW_CSUM)))
 15.1723 -+	    !(dev->features & NETIF_F_ALL_CSUM))
 15.1724 - 		return -EINVAL;
 15.1725 - 
 15.1726 - 	return __ethtool_set_sg(dev, edata.data);
 15.1727 -@@ -561,7 +559,7 @@
 15.1728 - 
 15.1729 - static int ethtool_get_tso(struct net_device *dev, char __user *useraddr)
 15.1730 - {
 15.1731 --	struct ethtool_value edata = { ETHTOOL_GTSO };
 15.1732 -+	struct ethtool_value edata = { ETHTOOL_GUFO };
 15.1733 - 
 15.1734 - 	if (!dev->ethtool_ops->get_tso)
 15.1735 - 		return -EOPNOTSUPP;
 15.1736 -@@ -616,6 +614,29 @@
 15.1737 - 	return dev->ethtool_ops->set_ufo(dev, edata.data);
 15.1738 - }
 15.1739 - 
 15.1740 -+static int ethtool_get_gso(struct net_device *dev, char __user *useraddr)
 15.1741 -+{
 15.1742 -+	struct ethtool_value edata = { ETHTOOL_GGSO };
 15.1743 -+
 15.1744 -+	edata.data = dev->features & NETIF_F_GSO;
 15.1745 -+	if (copy_to_user(useraddr, &edata, sizeof(edata)))
 15.1746 -+		 return -EFAULT;
 15.1747 -+	return 0;
 15.1748 -+}
 15.1749 -+
 15.1750 -+static int ethtool_set_gso(struct net_device *dev, char __user *useraddr)
 15.1751 -+{
 15.1752 -+	struct ethtool_value edata;
 15.1753 -+
 15.1754 -+	if (copy_from_user(&edata, useraddr, sizeof(edata)))
 15.1755 -+		return -EFAULT;
 15.1756 -+	if (edata.data)
 15.1757 -+		dev->features |= NETIF_F_GSO;
 15.1758 -+	else
 15.1759 -+		dev->features &= ~NETIF_F_GSO;
 15.1760 -+	return 0;
 15.1761 -+}
 15.1762 -+
 15.1763 - static int ethtool_self_test(struct net_device *dev, char __user *useraddr)
 15.1764 - {
 15.1765 - 	struct ethtool_test test;
 15.1766 -@@ -907,6 +928,12 @@
 15.1767 - 	case ETHTOOL_SUFO:
 15.1768 - 		rc = ethtool_set_ufo(dev, useraddr);
 15.1769 - 		break;
 15.1770 -+	case ETHTOOL_GGSO:
 15.1771 -+		rc = ethtool_get_gso(dev, useraddr);
 15.1772 -+		break;
 15.1773 -+	case ETHTOOL_SGSO:
 15.1774 -+		rc = ethtool_set_gso(dev, useraddr);
 15.1775 -+		break;
 15.1776 - 	default:
 15.1777 - 		rc =  -EOPNOTSUPP;
 15.1778 - 	}
 15.1779 -Index: tmp-xxx/net/core/netpoll.c
 15.1780 -===================================================================
 15.1781 ---- tmp-xxx.orig/net/core/netpoll.c	2006-11-15 10:38:39.000000000 +0000
 15.1782 -+++ tmp-xxx/net/core/netpoll.c	2006-11-27 10:52:42.000000000 +0000
 15.1783 -@@ -273,24 +273,21 @@
 15.1784 - 
 15.1785 - 	do {
 15.1786 - 		npinfo->tries--;
 15.1787 --		spin_lock(&np->dev->xmit_lock);
 15.1788 --		np->dev->xmit_lock_owner = smp_processor_id();
 15.1789 -+		netif_tx_lock(np->dev);
 15.1790 - 
 15.1791 - 		/*
 15.1792 - 		 * network drivers do not expect to be called if the queue is
 15.1793 - 		 * stopped.
 15.1794 - 		 */
 15.1795 - 		if (netif_queue_stopped(np->dev)) {
 15.1796 --			np->dev->xmit_lock_owner = -1;
 15.1797 --			spin_unlock(&np->dev->xmit_lock);
 15.1798 -+			netif_tx_unlock(np->dev);
 15.1799 - 			netpoll_poll(np);
 15.1800 - 			udelay(50);
 15.1801 - 			continue;
 15.1802 - 		}
 15.1803 - 
 15.1804 - 		status = np->dev->hard_start_xmit(skb, np->dev);
 15.1805 --		np->dev->xmit_lock_owner = -1;
 15.1806 --		spin_unlock(&np->dev->xmit_lock);
 15.1807 -+		netif_tx_unlock(np->dev);
 15.1808 - 
 15.1809 - 		/* success */
 15.1810 - 		if(!status) {
 15.1811 -Index: tmp-xxx/net/core/pktgen.c
 15.1812 -===================================================================
 15.1813 ---- tmp-xxx.orig/net/core/pktgen.c	2006-11-15 10:38:39.000000000 +0000
 15.1814 -+++ tmp-xxx/net/core/pktgen.c	2006-11-27 10:52:42.000000000 +0000
 15.1815 -@@ -2586,7 +2586,7 @@
 15.1816 - 		}
 15.1817 - 	}
 15.1818 - 	
 15.1819 --	spin_lock_bh(&odev->xmit_lock);
 15.1820 -+	netif_tx_lock_bh(odev);
 15.1821 - 	if (!netif_queue_stopped(odev)) {
 15.1822 - 
 15.1823 - 		atomic_inc(&(pkt_dev->skb->users));
 15.1824 -@@ -2631,7 +2631,7 @@
 15.1825 - 		pkt_dev->next_tx_ns = 0;
 15.1826 -         }
 15.1827 - 
 15.1828 --	spin_unlock_bh(&odev->xmit_lock);
 15.1829 -+	netif_tx_unlock_bh(odev);
 15.1830 - 	
 15.1831 - 	/* If pkt_dev->count is zero, then run forever */
 15.1832 - 	if ((pkt_dev->count != 0) && (pkt_dev->sofar >= pkt_dev->count)) {
 15.1833 -Index: tmp-xxx/net/core/skbuff.c
 15.1834 -===================================================================
 15.1835 ---- tmp-xxx.orig/net/core/skbuff.c	2006-11-15 10:38:39.000000000 +0000
 15.1836 -+++ tmp-xxx/net/core/skbuff.c	2006-11-27 10:58:31.000000000 +0000
 15.1837 -@@ -164,9 +164,9 @@
 15.1838 - 	shinfo = skb_shinfo(skb);
 15.1839 - 	atomic_set(&shinfo->dataref, 1);
 15.1840 - 	shinfo->nr_frags  = 0;
 15.1841 --	shinfo->tso_size = 0;
 15.1842 --	shinfo->tso_segs = 0;
 15.1843 --	shinfo->ufo_size = 0;
 15.1844 -+	shinfo->gso_size = 0;
 15.1845 -+	shinfo->gso_segs = 0;
 15.1846 -+	shinfo->gso_type = 0;
 15.1847 - 	shinfo->ip6_frag_id = 0;
 15.1848 - 	shinfo->frag_list = NULL;
 15.1849 - 
 15.1850 -@@ -230,9 +230,9 @@
 15.1851 - 
 15.1852 - 	atomic_set(&(skb_shinfo(skb)->dataref), 1);
 15.1853 - 	skb_shinfo(skb)->nr_frags  = 0;
 15.1854 --	skb_shinfo(skb)->tso_size = 0;
 15.1855 --	skb_shinfo(skb)->tso_segs = 0;
 15.1856 --	skb_shinfo(skb)->ufo_size = 0;
 15.1857 -+	skb_shinfo(skb)->gso_size = 0;
 15.1858 -+	skb_shinfo(skb)->gso_segs = 0;
 15.1859 -+	skb_shinfo(skb)->gso_type = 0;
 15.1860 - 	skb_shinfo(skb)->frag_list = NULL;
 15.1861 - out:
 15.1862 - 	return skb;
 15.1863 -@@ -507,9 +507,9 @@
 15.1864 - 	new->tc_index	= old->tc_index;
 15.1865 - #endif
 15.1866 - 	atomic_set(&new->users, 1);
 15.1867 --	skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size;
 15.1868 --	skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs;
 15.1869 --	skb_shinfo(new)->ufo_size = skb_shinfo(old)->ufo_size;
 15.1870 -+	skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
 15.1871 -+	skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
 15.1872 -+	skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type;
 15.1873 - }
 15.1874 - 
 15.1875 - /**
 15.1876 -@@ -1822,6 +1822,133 @@
 15.1877 - 	return 0;
 15.1878 - }
 15.1879 - 
 15.1880 -+/**
 15.1881 -+ *	skb_segment - Perform protocol segmentation on skb.
 15.1882 -+ *	@skb: buffer to segment
 15.1883 -+ *	@features: features for the output path (see dev->features)
 15.1884 -+ *
 15.1885 -+ *	This function performs segmentation on the given skb.  It returns
 15.1886 -+ *	the segment at the given position.  It returns NULL if there are
 15.1887 -+ *	no more segments to generate, or when an error is encountered.
 15.1888 -+ */
 15.1889 -+struct sk_buff *skb_segment(struct sk_buff *skb, int features)
 15.1890 -+{
 15.1891 -+	struct sk_buff *segs = NULL;
 15.1892 -+	struct sk_buff *tail = NULL;
 15.1893 -+	unsigned int mss = skb_shinfo(skb)->gso_size;
 15.1894 -+	unsigned int doffset = skb->data - skb->mac.raw;
 15.1895 -+	unsigned int offset = doffset;
 15.1896 -+	unsigned int headroom;
 15.1897 -+	unsigned int len;
 15.1898 -+	int sg = features & NETIF_F_SG;
 15.1899 -+	int nfrags = skb_shinfo(skb)->nr_frags;
 15.1900 -+	int err = -ENOMEM;
 15.1901 -+	int i = 0;
 15.1902 -+	int pos;
 15.1903 -+
 15.1904 -+	__skb_push(skb, doffset);
 15.1905 -+	headroom = skb_headroom(skb);
 15.1906 -+	pos = skb_headlen(skb);
 15.1907 -+
 15.1908 -+	do {
 15.1909 -+		struct sk_buff *nskb;
 15.1910 -+		skb_frag_t *frag;
 15.1911 -+		int hsize, nsize;
 15.1912 -+		int k;
 15.1913 -+		int size;
 15.1914 -+
 15.1915 -+		len = skb->len - offset;
 15.1916 -+		if (len > mss)
 15.1917 -+			len = mss;
 15.1918 -+
 15.1919 -+		hsize = skb_headlen(skb) - offset;
 15.1920 -+		if (hsize < 0)
 15.1921 -+			hsize = 0;
 15.1922 -+		nsize = hsize + doffset;
 15.1923 -+		if (nsize > len + doffset || !sg)
 15.1924 -+			nsize = len + doffset;
 15.1925 -+
 15.1926 -+		nskb = alloc_skb(nsize + headroom, GFP_ATOMIC);
 15.1927 -+		if (unlikely(!nskb))
 15.1928 -+			goto err;
 15.1929 -+
 15.1930 -+		if (segs)
 15.1931 -+			tail->next = nskb;
 15.1932 -+		else
 15.1933 -+			segs = nskb;
 15.1934 -+		tail = nskb;
 15.1935 -+
 15.1936 -+		nskb->dev = skb->dev;
 15.1937 -+		nskb->priority = skb->priority;
 15.1938 -+		nskb->protocol = skb->protocol;
 15.1939 -+		nskb->dst = dst_clone(skb->dst);
 15.1940 -+		memcpy(nskb->cb, skb->cb, sizeof(skb->cb));
 15.1941 -+		nskb->pkt_type = skb->pkt_type;
 15.1942 -+		nskb->mac_len = skb->mac_len;
 15.1943 -+
 15.1944 -+		skb_reserve(nskb, headroom);
 15.1945 -+		nskb->mac.raw = nskb->data;
 15.1946 -+		nskb->nh.raw = nskb->data + skb->mac_len;
 15.1947 -+		nskb->h.raw = nskb->nh.raw + (skb->h.raw - skb->nh.raw);
 15.1948 -+		memcpy(skb_put(nskb, doffset), skb->data, doffset);
 15.1949 -+
 15.1950 -+		if (!sg) {
 15.1951 -+			nskb->csum = skb_copy_and_csum_bits(skb, offset,
 15.1952 -+							    skb_put(nskb, len),
 15.1953 -+							    len, 0);
 15.1954 -+			continue;
 15.1955 -+		}
 15.1956 -+
 15.1957 -+		frag = skb_shinfo(nskb)->frags;
 15.1958 -+		k = 0;
 15.1959 -+
 15.1960 -+		nskb->ip_summed = CHECKSUM_HW;
 15.1961 -+		nskb->csum = skb->csum;
 15.1962 -+		memcpy(skb_put(nskb, hsize), skb->data + offset, hsize);
 15.1963 -+
 15.1964 -+		while (pos < offset + len) {
 15.1965 -+			BUG_ON(i >= nfrags);
 15.1966 -+
 15.1967 -+			*frag = skb_shinfo(skb)->frags[i];
 15.1968 -+			get_page(frag->page);
 15.1969 -+			size = frag->size;
 15.1970 -+
 15.1971 -+			if (pos < offset) {
 15.1972 -+				frag->page_offset += offset - pos;
 15.1973 -+				frag->size -= offset - pos;
 15.1974 -+			}
 15.1975 -+
 15.1976 -+			k++;
 15.1977 -+
 15.1978 -+			if (pos + size <= offset + len) {
 15.1979 -+				i++;
 15.1980 -+				pos += size;
 15.1981 -+			} else {
 15.1982 -+				frag->size -= pos + size - (offset + len);
 15.1983 -+				break;
 15.1984 -+			}
 15.1985 -+
 15.1986 -+			frag++;
 15.1987 -+		}
 15.1988 -+
 15.1989 -+		skb_shinfo(nskb)->nr_frags = k;
 15.1990 -+		nskb->data_len = len - hsize;
 15.1991 -+		nskb->len += nskb->data_len;
 15.1992 -+		nskb->truesize += nskb->data_len;
 15.1993 -+	} while ((offset += len) < skb->len);
 15.1994 -+
 15.1995 -+	return segs;
 15.1996 -+
 15.1997 -+err:
 15.1998 -+	while ((skb = segs)) {
 15.1999 -+		segs = skb->next;
 15.2000 -+		kfree(skb);
 15.2001 -+	}
 15.2002 -+	return ERR_PTR(err);
 15.2003 -+}
 15.2004 -+
 15.2005 -+EXPORT_SYMBOL_GPL(skb_segment);
 15.2006 -+
 15.2007 - void __init skb_init(void)
 15.2008 - {
 15.2009 - 	skbuff_head_cache = kmem_cache_create("skbuff_head_cache",
 15.2010 -Index: tmp-xxx/net/decnet/dn_nsp_in.c
 15.2011 -===================================================================
 15.2012 ---- tmp-xxx.orig/net/decnet/dn_nsp_in.c	2006-11-15 10:38:39.000000000 +0000
 15.2013 -+++ tmp-xxx/net/decnet/dn_nsp_in.c	2006-11-27 10:52:42.000000000 +0000
 15.2014 -@@ -801,8 +801,7 @@
 15.2015 - 		 * We linearize everything except data segments here.
 15.2016 - 		 */
 15.2017 - 		if (cb->nsp_flags & ~0x60) {
 15.2018 --			if (unlikely(skb_is_nonlinear(skb)) &&
 15.2019 --			    skb_linearize(skb, GFP_ATOMIC) != 0)
 15.2020 -+			if (unlikely(skb_linearize(skb)))
 15.2021 - 				goto free_out;
 15.2022 - 		}
 15.2023 - 
 15.2024 -Index: tmp-xxx/net/decnet/dn_route.c
 15.2025 -===================================================================
 15.2026 ---- tmp-xxx.orig/net/decnet/dn_route.c	2006-11-15 10:38:39.000000000 +0000
 15.2027 -+++ tmp-xxx/net/decnet/dn_route.c	2006-11-27 10:52:42.000000000 +0000
 15.2028 -@@ -629,8 +629,7 @@
 15.2029 - 			padlen);
 15.2030 - 
 15.2031 -         if (flags & DN_RT_PKT_CNTL) {
 15.2032 --		if (unlikely(skb_is_nonlinear(skb)) &&
 15.2033 --		    skb_linearize(skb, GFP_ATOMIC) != 0)
 15.2034 -+		if (unlikely(skb_linearize(skb)))
 15.2035 - 			goto dump_it;
 15.2036 - 
 15.2037 -                 switch(flags & DN_RT_CNTL_MSK) {
 15.2038 -Index: tmp-xxx/net/ipv4/af_inet.c
 15.2039 -===================================================================
 15.2040 ---- tmp-xxx.orig/net/ipv4/af_inet.c	2006-11-15 10:38:39.000000000 +0000
 15.2041 -+++ tmp-xxx/net/ipv4/af_inet.c	2006-11-27 10:52:42.000000000 +0000
 15.2042 -@@ -68,6 +68,7 @@
 15.2043 -  */
 15.2044 - 
 15.2045 - #include <linux/config.h>
 15.2046 -+#include <linux/err.h>
 15.2047 - #include <linux/errno.h>
 15.2048 - #include <linux/types.h>
 15.2049 - #include <linux/socket.h>
 15.2050 -@@ -1084,6 +1085,54 @@
 15.2051 - 
 15.2052 - EXPORT_SYMBOL(inet_sk_rebuild_header);
 15.2053 - 
 15.2054 -+static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features)
 15.2055 -+{
 15.2056 -+	struct sk_buff *segs = ERR_PTR(-EINVAL);
 15.2057 -+	struct iphdr *iph;
 15.2058 -+	struct net_protocol *ops;
 15.2059 -+	int proto;
 15.2060 -+	int ihl;
 15.2061 -+	int id;
 15.2062 -+
 15.2063 -+	if (!pskb_may_pull(skb, sizeof(*iph)))
 15.2064 -+		goto out;
 15.2065 -+
 15.2066 -+	iph = skb->nh.iph;
 15.2067 -+	ihl = iph->ihl * 4;
 15.2068 -+	if (ihl < sizeof(*iph))
 15.2069 -+		goto out;
 15.2070 -+
 15.2071 -+	if (!pskb_may_pull(skb, ihl))
 15.2072 -+		goto out;
 15.2073 -+
 15.2074 -+	skb->h.raw = __skb_pull(skb, ihl);
 15.2075 -+	iph = skb->nh.iph;
 15.2076 -+	id = ntohs(iph->id);
 15.2077 -+	proto = iph->protocol & (MAX_INET_PROTOS - 1);
 15.2078 -+	segs = ERR_PTR(-EPROTONOSUPPORT);
 15.2079 -+
 15.2080 -+	rcu_read_lock();
 15.2081 -+	ops = rcu_dereference(inet_protos[proto]);
 15.2082 -+	if (ops && ops->gso_segment)
 15.2083 -+		segs = ops->gso_segment(skb, features);
 15.2084 -+	rcu_read_unlock();
 15.2085 -+
 15.2086 -+	if (!segs || unlikely(IS_ERR(segs)))
 15.2087 -+		goto out;
 15.2088 -+
 15.2089 -+	skb = segs;
 15.2090 -+	do {
 15.2091 -+		iph = skb->nh.iph;
 15.2092 -+		iph->id = htons(id++);
 15.2093 -+		iph->tot_len = htons(skb->len - skb->mac_len);
 15.2094 -+		iph->check = 0;
 15.2095 -+		iph->check = ip_fast_csum(skb->nh.raw, iph->ihl);
 15.2096 -+	} while ((skb = skb->next));
 15.2097 -+
 15.2098 -+out:
 15.2099 -+	return segs;
 15.2100 -+}
 15.2101 -+
 15.2102 - #ifdef CONFIG_IP_MULTICAST
 15.2103 - static struct net_protocol igmp_protocol = {
 15.2104 - 	.handler =	igmp_rcv,
 15.2105 -@@ -1093,6 +1142,7 @@
 15.2106 - static struct net_protocol tcp_protocol = {
 15.2107 - 	.handler =	tcp_v4_rcv,
 15.2108 - 	.err_handler =	tcp_v4_err,
 15.2109 -+	.gso_segment =	tcp_tso_segment,
 15.2110 - 	.no_policy =	1,
 15.2111 - };
 15.2112 - 
 15.2113 -@@ -1138,6 +1188,7 @@
 15.2114 - static struct packet_type ip_packet_type = {
 15.2115 - 	.type = __constant_htons(ETH_P_IP),
 15.2116 - 	.func = ip_rcv,
 15.2117 -+	.gso_segment = inet_gso_segment,
 15.2118 - };
 15.2119 - 
 15.2120 - static int __init inet_init(void)
 15.2121 -Index: tmp-xxx/net/ipv4/ip_output.c
 15.2122 -===================================================================
 15.2123 ---- tmp-xxx.orig/net/ipv4/ip_output.c	2006-11-15 10:38:39.000000000 +0000
 15.2124 -+++ tmp-xxx/net/ipv4/ip_output.c	2006-11-27 10:52:42.000000000 +0000
 15.2125 -@@ -210,8 +210,7 @@
 15.2126 - 		return dst_output(skb);
 15.2127 - 	}
 15.2128 - #endif
 15.2129 --	if (skb->len > dst_mtu(skb->dst) &&
 15.2130 --	    !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size))
 15.2131 -+	if (skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->gso_size)
 15.2132 - 		return ip_fragment(skb, ip_finish_output2);
 15.2133 - 	else
 15.2134 - 		return ip_finish_output2(skb);
 15.2135 -@@ -362,7 +361,7 @@
 15.2136 - 	}
 15.2137 - 
 15.2138 - 	ip_select_ident_more(iph, &rt->u.dst, sk,
 15.2139 --			     (skb_shinfo(skb)->tso_segs ?: 1) - 1);
 15.2140 -+			     (skb_shinfo(skb)->gso_segs ?: 1) - 1);
 15.2141 - 
 15.2142 - 	/* Add an IP checksum. */
 15.2143 - 	ip_send_check(iph);
 15.2144 -@@ -743,7 +742,8 @@
 15.2145 - 			       (length - transhdrlen));
 15.2146 - 	if (!err) {
 15.2147 - 		/* specify the length of each IP datagram fragment*/
 15.2148 --		skb_shinfo(skb)->ufo_size = (mtu - fragheaderlen);
 15.2149 -+		skb_shinfo(skb)->gso_size = mtu - fragheaderlen;
 15.2150 -+		skb_shinfo(skb)->gso_type = SKB_GSO_UDPV4;
 15.2151 - 		__skb_queue_tail(&sk->sk_write_queue, skb);
 15.2152 - 
 15.2153 - 		return 0;
 15.2154 -@@ -839,7 +839,7 @@
 15.2155 - 	 */
 15.2156 - 	if (transhdrlen &&
 15.2157 - 	    length + fragheaderlen <= mtu &&
 15.2158 --	    rt->u.dst.dev->features&(NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) &&
 15.2159 -+	    rt->u.dst.dev->features & NETIF_F_ALL_CSUM &&
 15.2160 - 	    !exthdrlen)
 15.2161 - 		csummode = CHECKSUM_HW;
 15.2162 - 
 15.2163 -@@ -1086,14 +1086,16 @@
 15.2164 - 
 15.2165 - 	inet->cork.length += size;
 15.2166 - 	if ((sk->sk_protocol == IPPROTO_UDP) &&
 15.2167 --	    (rt->u.dst.dev->features & NETIF_F_UFO))
 15.2168 --		skb_shinfo(skb)->ufo_size = (mtu - fragheaderlen);
 15.2169 -+	    (rt->u.dst.dev->features & NETIF_F_UFO)) {
 15.2170 -+		skb_shinfo(skb)->gso_size = mtu - fragheaderlen;
 15.2171 -+		skb_shinfo(skb)->gso_type = SKB_GSO_UDPV4;
 15.2172 -+	}
 15.2173 - 
 15.2174 - 
 15.2175 - 	while (size > 0) {
 15.2176 - 		int i;
 15.2177 - 
 15.2178 --		if (skb_shinfo(skb)->ufo_size)
 15.2179 -+		if (skb_shinfo(skb)->gso_size)
 15.2180 - 			len = size;
 15.2181 - 		else {
 15.2182 - 
 15.2183 -Index: tmp-xxx/net/ipv4/ipcomp.c
 15.2184 -===================================================================
 15.2185 ---- tmp-xxx.orig/net/ipv4/ipcomp.c	2006-11-15 10:38:39.000000000 +0000
 15.2186 -+++ tmp-xxx/net/ipv4/ipcomp.c	2006-11-27 10:52:42.000000000 +0000
 15.2187 -@@ -84,7 +84,7 @@
 15.2188 -                         struct xfrm_decap_state *decap, struct sk_buff *skb)
 15.2189 - {
 15.2190 - 	u8 nexthdr;
 15.2191 --	int err = 0;
 15.2192 -+	int err = -ENOMEM;
 15.2193 - 	struct iphdr *iph;
 15.2194 - 	union {
 15.2195 - 		struct iphdr	iph;
 15.2196 -@@ -92,11 +92,8 @@
 15.2197 - 	} tmp_iph;
 15.2198 - 
 15.2199 - 
 15.2200 --	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
 15.2201 --	    skb_linearize(skb, GFP_ATOMIC) != 0) {
 15.2202 --	    	err = -ENOMEM;
 15.2203 -+	if (skb_linearize_cow(skb))
 15.2204 - 	    	goto out;
 15.2205 --	}
 15.2206 - 
 15.2207 - 	skb->ip_summed = CHECKSUM_NONE;
 15.2208 - 
 15.2209 -@@ -171,10 +168,8 @@
 15.2210 - 		goto out_ok;
 15.2211 - 	}
 15.2212 - 
 15.2213 --	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
 15.2214 --	    skb_linearize(skb, GFP_ATOMIC) != 0) {
 15.2215 -+	if (skb_linearize_cow(skb))
 15.2216 - 		goto out_ok;
 15.2217 --	}
 15.2218 - 	
 15.2219 - 	err = ipcomp_compress(x, skb);
 15.2220 - 	iph = skb->nh.iph;
 15.2221 -Index: tmp-xxx/net/ipv4/tcp.c
 15.2222 -===================================================================
 15.2223 ---- tmp-xxx.orig/net/ipv4/tcp.c	2006-11-15 10:38:39.000000000 +0000
 15.2224 -+++ tmp-xxx/net/ipv4/tcp.c	2006-11-27 10:52:42.000000000 +0000
 15.2225 -@@ -257,6 +257,7 @@
 15.2226 - #include <linux/fs.h>
 15.2227 - #include <linux/random.h>
 15.2228 - #include <linux/bootmem.h>
 15.2229 -+#include <linux/err.h>
 15.2230 - 
 15.2231 - #include <net/icmp.h>
 15.2232 - #include <net/tcp.h>
 15.2233 -@@ -570,7 +571,7 @@
 15.2234 - 		skb->ip_summed = CHECKSUM_HW;
 15.2235 - 		tp->write_seq += copy;
 15.2236 - 		TCP_SKB_CB(skb)->end_seq += copy;
 15.2237 --		skb_shinfo(skb)->tso_segs = 0;
 15.2238 -+		skb_shinfo(skb)->gso_segs = 0;
 15.2239 - 
 15.2240 - 		if (!copied)
 15.2241 - 			TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_PSH;
 15.2242 -@@ -621,14 +622,10 @@
 15.2243 - 	ssize_t res;
 15.2244 - 	struct sock *sk = sock->sk;
 15.2245 - 
 15.2246 --#define TCP_ZC_CSUM_FLAGS (NETIF_F_IP_CSUM | NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
 15.2247 --
 15.2248 - 	if (!(sk->sk_route_caps & NETIF_F_SG) ||
 15.2249 --	    !(sk->sk_route_caps & TCP_ZC_CSUM_FLAGS))
 15.2250 -+	    !(sk->sk_route_caps & NETIF_F_ALL_CSUM))
 15.2251 - 		return sock_no_sendpage(sock, page, offset, size, flags);
 15.2252 - 
 15.2253 --#undef TCP_ZC_CSUM_FLAGS
 15.2254 --
 15.2255 - 	lock_sock(sk);
 15.2256 - 	TCP_CHECK_TIMER(sk);
 15.2257 - 	res = do_tcp_sendpages(sk, &page, offset, size, flags);
 15.2258 -@@ -725,9 +722,7 @@
 15.2259 - 				/*
 15.2260 - 				 * Check whether we can use HW checksum.
 15.2261 - 				 */
 15.2262 --				if (sk->sk_route_caps &
 15.2263 --				    (NETIF_F_IP_CSUM | NETIF_F_NO_CSUM |
 15.2264 --				     NETIF_F_HW_CSUM))
 15.2265 -+				if (sk->sk_route_caps & NETIF_F_ALL_CSUM)
 15.2266 - 					skb->ip_summed = CHECKSUM_HW;
 15.2267 - 
 15.2268 - 				skb_entail(sk, tp, skb);
 15.2269 -@@ -823,7 +818,7 @@
 15.2270 - 
 15.2271 - 			tp->write_seq += copy;
 15.2272 - 			TCP_SKB_CB(skb)->end_seq += copy;
 15.2273 --			skb_shinfo(skb)->tso_segs = 0;
 15.2274 -+			skb_shinfo(skb)->gso_segs = 0;
 15.2275 - 
 15.2276 - 			from += copy;
 15.2277 - 			copied += copy;
 15.2278 -@@ -2026,6 +2021,71 @@
 15.2279 - }
 15.2280 - 
 15.2281 - 
 15.2282 -+struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
 15.2283 -+{
 15.2284 -+	struct sk_buff *segs = ERR_PTR(-EINVAL);
 15.2285 -+	struct tcphdr *th;
 15.2286 -+	unsigned thlen;
 15.2287 -+	unsigned int seq;
 15.2288 -+	unsigned int delta;
 15.2289 -+	unsigned int oldlen;
 15.2290 -+	unsigned int len;
 15.2291 -+
 15.2292 -+	if (!pskb_may_pull(skb, sizeof(*th)))
 15.2293 -+		goto out;
 15.2294 -+
 15.2295 -+	th = skb->h.th;
 15.2296 -+	thlen = th->doff * 4;
 15.2297 -+	if (thlen < sizeof(*th))
 15.2298 -+		goto out;
 15.2299 -+
 15.2300 -+	if (!pskb_may_pull(skb, thlen))
 15.2301 -+		goto out;
 15.2302 -+
 15.2303 -+	segs = NULL;
 15.2304 -+	if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST))
 15.2305 -+		goto out;
 15.2306 -+
 15.2307 -+	oldlen = (u16)~skb->len;
 15.2308 -+	__skb_pull(skb, thlen);
 15.2309 -+
 15.2310 -+	segs = skb_segment(skb, features);
 15.2311 -+	if (IS_ERR(segs))
 15.2312 -+		goto out;
 15.2313 -+
 15.2314 -+	len = skb_shinfo(skb)->gso_size;
 15.2315 -+	delta = htonl(oldlen + (thlen + len));
 15.2316 -+
 15.2317 -+	skb = segs;
 15.2318 -+	th = skb->h.th;
 15.2319 -+	seq = ntohl(th->seq);
 15.2320 -+
 15.2321 -+	do {
 15.2322 -+		th->fin = th->psh = 0;
 15.2323 -+
 15.2324 -+		th->check = ~csum_fold(th->check + delta);
 15.2325 -+		if (skb->ip_summed != CHECKSUM_HW)
 15.2326 -+			th->check = csum_fold(csum_partial(skb->h.raw, thlen,
 15.2327 -+							   skb->csum));
 15.2328 -+
 15.2329 -+		seq += len;
 15.2330 -+		skb = skb->next;
 15.2331 -+		th = skb->h.th;
 15.2332 -+
 15.2333 -+		th->seq = htonl(seq);
 15.2334 -+		th->cwr = 0;
 15.2335 -+	} while (skb->next);
 15.2336 -+
 15.2337 -+	delta = htonl(oldlen + (skb->tail - skb->h.raw) + skb->data_len);
 15.2338 -+	th->check = ~csum_fold(th->check + delta);
 15.2339 -+	if (skb->ip_summed != CHECKSUM_HW)
 15.2340 -+		th->check = csum_fold(csum_partial(skb->h.raw, thlen,
 15.2341 -+						   skb->csum));
 15.2342 -+
 15.2343 -+out:
 15.2344 -+	return segs;
 15.2345 -+}
 15.2346 -+
 15.2347 - extern void __skb_cb_too_small_for_tcp(int, int);
 15.2348 - extern struct tcp_congestion_ops tcp_reno;
 15.2349 - 
 15.2350 -Index: tmp-xxx/net/ipv4/tcp_input.c
 15.2351 -===================================================================
 15.2352 ---- tmp-xxx.orig/net/ipv4/tcp_input.c	2006-11-15 10:38:39.000000000 +0000
 15.2353 -+++ tmp-xxx/net/ipv4/tcp_input.c	2006-11-27 10:52:42.000000000 +0000
 15.2354 -@@ -1072,7 +1072,7 @@
 15.2355 - 				else
 15.2356 - 					pkt_len = (end_seq -
 15.2357 - 						   TCP_SKB_CB(skb)->seq);
 15.2358 --				if (tcp_fragment(sk, skb, pkt_len, skb_shinfo(skb)->tso_size))
 15.2359 -+				if (tcp_fragment(sk, skb, pkt_len, skb_shinfo(skb)->gso_size))
 15.2360 - 					break;
 15.2361 - 				pcount = tcp_skb_pcount(skb);
 15.2362 - 			}
 15.2363 -Index: tmp-xxx/net/ipv4/tcp_output.c
 15.2364 -===================================================================
 15.2365 ---- tmp-xxx.orig/net/ipv4/tcp_output.c	2006-11-15 10:38:39.000000000 +0000
 15.2366 -+++ tmp-xxx/net/ipv4/tcp_output.c	2006-11-27 10:52:42.000000000 +0000
 15.2367 -@@ -497,15 +497,17 @@
 15.2368 - 		/* Avoid the costly divide in the normal
 15.2369 - 		 * non-TSO case.
 15.2370 - 		 */
 15.2371 --		skb_shinfo(skb)->tso_segs = 1;
 15.2372 --		skb_shinfo(skb)->tso_size = 0;
 15.2373 -+		skb_shinfo(skb)->gso_segs = 1;
 15.2374 -+		skb_shinfo(skb)->gso_size = 0;
 15.2375 -+		skb_shinfo(skb)->gso_type = 0;
 15.2376 - 	} else {
 15.2377 - 		unsigned int factor;
 15.2378 - 
 15.2379 - 		factor = skb->len + (mss_now - 1);
 15.2380 - 		factor /= mss_now;
 15.2381 --		skb_shinfo(skb)->tso_segs = factor;
 15.2382 --		skb_shinfo(skb)->tso_size = mss_now;
 15.2383 -+		skb_shinfo(skb)->gso_segs = factor;
 15.2384 -+		skb_shinfo(skb)->gso_size = mss_now;
 15.2385 -+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 15.2386 - 	}
 15.2387 - }
 15.2388 - 
 15.2389 -@@ -850,7 +852,7 @@
 15.2390 - 
 15.2391 - 	if (!tso_segs ||
 15.2392 - 	    (tso_segs > 1 &&
 15.2393 --	     skb_shinfo(skb)->tso_size != mss_now)) {
 15.2394 -+	     tcp_skb_mss(skb) != mss_now)) {
 15.2395 - 		tcp_set_skb_tso_segs(sk, skb, mss_now);
 15.2396 - 		tso_segs = tcp_skb_pcount(skb);
 15.2397 - 	}
 15.2398 -@@ -1510,8 +1512,9 @@
 15.2399 - 	   tp->snd_una == (TCP_SKB_CB(skb)->end_seq - 1)) {
 15.2400 - 		if (!pskb_trim(skb, 0)) {
 15.2401 - 			TCP_SKB_CB(skb)->seq = TCP_SKB_CB(skb)->end_seq - 1;
 15.2402 --			skb_shinfo(skb)->tso_segs = 1;
 15.2403 --			skb_shinfo(skb)->tso_size = 0;
 15.2404 -+			skb_shinfo(skb)->gso_segs = 1;
 15.2405 -+			skb_shinfo(skb)->gso_size = 0;
 15.2406 -+			skb_shinfo(skb)->gso_type = 0;
 15.2407 - 			skb->ip_summed = CHECKSUM_NONE;
 15.2408 - 			skb->csum = 0;
 15.2409 - 		}
 15.2410 -@@ -1716,8 +1719,9 @@
 15.2411 - 		skb->csum = 0;
 15.2412 - 		TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_FIN);
 15.2413 - 		TCP_SKB_CB(skb)->sacked = 0;
 15.2414 --		skb_shinfo(skb)->tso_segs = 1;
 15.2415 --		skb_shinfo(skb)->tso_size = 0;
 15.2416 -+		skb_shinfo(skb)->gso_segs = 1;
 15.2417 -+		skb_shinfo(skb)->gso_size = 0;
 15.2418 -+		skb_shinfo(skb)->gso_type = 0;
 15.2419 - 
 15.2420 - 		/* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
 15.2421 - 		TCP_SKB_CB(skb)->seq = tp->write_seq;
 15.2422 -@@ -1749,8 +1753,9 @@
 15.2423 - 	skb->csum = 0;
 15.2424 - 	TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_RST);
 15.2425 - 	TCP_SKB_CB(skb)->sacked = 0;
 15.2426 --	skb_shinfo(skb)->tso_segs = 1;
 15.2427 --	skb_shinfo(skb)->tso_size = 0;
 15.2428 -+	skb_shinfo(skb)->gso_segs = 1;
 15.2429 -+	skb_shinfo(skb)->gso_size = 0;
 15.2430 -+	skb_shinfo(skb)->gso_type = 0;
 15.2431 - 
 15.2432 - 	/* Send it off. */
 15.2433 - 	TCP_SKB_CB(skb)->seq = tcp_acceptable_seq(sk, tp);
 15.2434 -@@ -1833,8 +1838,9 @@
 15.2435 - 	TCP_SKB_CB(skb)->seq = tcp_rsk(req)->snt_isn;
 15.2436 - 	TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + 1;
 15.2437 - 	TCP_SKB_CB(skb)->sacked = 0;
 15.2438 --	skb_shinfo(skb)->tso_segs = 1;
 15.2439 --	skb_shinfo(skb)->tso_size = 0;
 15.2440 -+	skb_shinfo(skb)->gso_segs = 1;
 15.2441 -+	skb_shinfo(skb)->gso_size = 0;
 15.2442 -+	skb_shinfo(skb)->gso_type = 0;
 15.2443 - 	th->seq = htonl(TCP_SKB_CB(skb)->seq);
 15.2444 - 	th->ack_seq = htonl(tcp_rsk(req)->rcv_isn + 1);
 15.2445 - 	if (req->rcv_wnd == 0) { /* ignored for retransmitted syns */
 15.2446 -@@ -1937,8 +1943,9 @@
 15.2447 - 	TCP_SKB_CB(buff)->flags = TCPCB_FLAG_SYN;
 15.2448 - 	TCP_ECN_send_syn(sk, tp, buff);
 15.2449 - 	TCP_SKB_CB(buff)->sacked = 0;
 15.2450 --	skb_shinfo(buff)->tso_segs = 1;
 15.2451 --	skb_shinfo(buff)->tso_size = 0;
 15.2452 -+	skb_shinfo(buff)->gso_segs = 1;
 15.2453 -+	skb_shinfo(buff)->gso_size = 0;
 15.2454 -+	skb_shinfo(buff)->gso_type = 0;
 15.2455 - 	buff->csum = 0;
 15.2456 - 	TCP_SKB_CB(buff)->seq = tp->write_seq++;
 15.2457 - 	TCP_SKB_CB(buff)->end_seq = tp->write_seq;
 15.2458 -@@ -2042,8 +2049,9 @@
 15.2459 - 		buff->csum = 0;
 15.2460 - 		TCP_SKB_CB(buff)->flags = TCPCB_FLAG_ACK;
 15.2461 - 		TCP_SKB_CB(buff)->sacked = 0;
 15.2462 --		skb_shinfo(buff)->tso_segs = 1;
 15.2463 --		skb_shinfo(buff)->tso_size = 0;
 15.2464 -+		skb_shinfo(buff)->gso_segs = 1;
 15.2465 -+		skb_shinfo(buff)->gso_size = 0;
 15.2466 -+		skb_shinfo(buff)->gso_type = 0;
 15.2467 - 
 15.2468 - 		/* Send it off, this clears delayed acks for us. */
 15.2469 - 		TCP_SKB_CB(buff)->seq = TCP_SKB_CB(buff)->end_seq = tcp_acceptable_seq(sk, tp);
 15.2470 -@@ -2078,8 +2086,9 @@
 15.2471 - 	skb->csum = 0;
 15.2472 - 	TCP_SKB_CB(skb)->flags = TCPCB_FLAG_ACK;
 15.2473 - 	TCP_SKB_CB(skb)->sacked = urgent;
 15.2474 --	skb_shinfo(skb)->tso_segs = 1;
 15.2475 --	skb_shinfo(skb)->tso_size = 0;
 15.2476 -+	skb_shinfo(skb)->gso_segs = 1;
 15.2477 -+	skb_shinfo(skb)->gso_size = 0;
 15.2478 -+	skb_shinfo(skb)->gso_type = 0;
 15.2479 - 
 15.2480 - 	/* Use a previous sequence.  This should cause the other
 15.2481 - 	 * end to send an ack.  Don't queue or clone SKB, just
 15.2482 -Index: tmp-xxx/net/ipv4/xfrm4_output.c
 15.2483 -===================================================================
 15.2484 ---- tmp-xxx.orig/net/ipv4/xfrm4_output.c	2006-11-27 10:52:32.000000000 +0000
 15.2485 -+++ tmp-xxx/net/ipv4/xfrm4_output.c	2006-11-27 10:52:42.000000000 +0000
 15.2486 -@@ -9,6 +9,8 @@
 15.2487 -  */
 15.2488 - 
 15.2489 - #include <linux/compiler.h>
 15.2490 -+#include <linux/if_ether.h>
 15.2491 -+#include <linux/kernel.h>
 15.2492 - #include <linux/skbuff.h>
 15.2493 - #include <linux/spinlock.h>
 15.2494 - #include <linux/netfilter_ipv4.h>
 15.2495 -@@ -158,16 +160,10 @@
 15.2496 - 	goto out_exit;
 15.2497 - }
 15.2498 - 
 15.2499 --static int xfrm4_output_finish(struct sk_buff *skb)
 15.2500 -+static int xfrm4_output_finish2(struct sk_buff *skb)
 15.2501 - {
 15.2502 - 	int err;
 15.2503 - 
 15.2504 --#ifdef CONFIG_NETFILTER
 15.2505 --	if (!skb->dst->xfrm) {
 15.2506 --		IPCB(skb)->flags |= IPSKB_REROUTED;
 15.2507 --		return dst_output(skb);
 15.2508 --	}
 15.2509 --#endif
 15.2510 - 	while (likely((err = xfrm4_output_one(skb)) == 0)) {
 15.2511 - 		nf_reset(skb);
 15.2512 - 
 15.2513 -@@ -180,7 +176,7 @@
 15.2514 - 			return dst_output(skb);
 15.2515 - 
 15.2516 - 		err = nf_hook(PF_INET, NF_IP_POST_ROUTING, &skb, NULL,
 15.2517 --			      skb->dst->dev, xfrm4_output_finish);
 15.2518 -+			      skb->dst->dev, xfrm4_output_finish2);
 15.2519 - 		if (unlikely(err != 1))
 15.2520 - 			break;
 15.2521 - 	}
 15.2522 -@@ -188,6 +184,48 @@
 15.2523 - 	return err;
 15.2524 - }
 15.2525 - 
 15.2526 -+static int xfrm4_output_finish(struct sk_buff *skb)
 15.2527 -+{
 15.2528 -+	struct sk_buff *segs;
 15.2529 -+
 15.2530 -+#ifdef CONFIG_NETFILTER
 15.2531 -+	if (!skb->dst->xfrm) {
 15.2532 -+		IPCB(skb)->flags |= IPSKB_REROUTED;
 15.2533 -+		return dst_output(skb);
 15.2534 -+	}
 15.2535 -+#endif
 15.2536 -+
 15.2537 -+	if (!skb_shinfo(skb)->gso_size)
 15.2538 -+		return xfrm4_output_finish2(skb);
 15.2539 -+
 15.2540 -+	skb->protocol = htons(ETH_P_IP);
 15.2541 -+	segs = skb_gso_segment(skb, 0);
 15.2542 -+	kfree_skb(skb);
 15.2543 -+	if (unlikely(IS_ERR(segs)))
 15.2544 -+		return PTR_ERR(segs);
 15.2545 -+
 15.2546 -+	do {
 15.2547 -+		struct sk_buff *nskb = segs->next;
 15.2548 -+		int err;
 15.2549 -+
 15.2550 -+		segs->next = NULL;
 15.2551 -+		err = xfrm4_output_finish2(segs);
 15.2552 -+
 15.2553 -+		if (unlikely(err)) {
 15.2554 -+			while ((segs = nskb)) {
 15.2555 -+				nskb = segs->next;
 15.2556 -+				segs->next = NULL;
 15.2557 -+				kfree_skb(segs);
 15.2558 -+			}
 15.2559 -+			return err;
 15.2560 -+		}
 15.2561 -+
 15.2562 -+		segs = nskb;
 15.2563 -+	} while (segs);
 15.2564 -+
 15.2565 -+	return 0;
 15.2566 -+}
 15.2567 -+
 15.2568 - int xfrm4_output(struct sk_buff *skb)
 15.2569 - {
 15.2570 - 	return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
 15.2571 -Index: tmp-xxx/net/ipv6/ip6_output.c
 15.2572 -===================================================================
 15.2573 ---- tmp-xxx.orig/net/ipv6/ip6_output.c	2006-11-15 10:38:39.000000000 +0000
 15.2574 -+++ tmp-xxx/net/ipv6/ip6_output.c	2006-11-27 10:52:42.000000000 +0000
 15.2575 -@@ -147,7 +147,7 @@
 15.2576 - 
 15.2577 - int ip6_output(struct sk_buff *skb)
 15.2578 - {
 15.2579 --	if ((skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->ufo_size) ||
 15.2580 -+	if ((skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->gso_size) ||
 15.2581 - 				dst_allfrag(skb->dst))
 15.2582 - 		return ip6_fragment(skb, ip6_output2);
 15.2583 - 	else
 15.2584 -@@ -829,8 +829,9 @@
 15.2585 - 		struct frag_hdr fhdr;
 15.2586 - 
 15.2587 - 		/* specify the length of each IP datagram fragment*/
 15.2588 --		skb_shinfo(skb)->ufo_size = (mtu - fragheaderlen) - 
 15.2589 --						sizeof(struct frag_hdr);
 15.2590 -+		skb_shinfo(skb)->gso_size = mtu - fragheaderlen - 
 15.2591 -+					    sizeof(struct frag_hdr);
 15.2592 -+		skb_shinfo(skb)->gso_type = SKB_GSO_UDPV4;
 15.2593 - 		ipv6_select_ident(skb, &fhdr);
 15.2594 - 		skb_shinfo(skb)->ip6_frag_id = fhdr.identification;
 15.2595 - 		__skb_queue_tail(&sk->sk_write_queue, skb);
 15.2596 -Index: tmp-xxx/net/ipv6/ipcomp6.c
 15.2597 -===================================================================
 15.2598 ---- tmp-xxx.orig/net/ipv6/ipcomp6.c	2006-11-15 10:38:39.000000000 +0000
 15.2599 -+++ tmp-xxx/net/ipv6/ipcomp6.c	2006-11-27 10:52:42.000000000 +0000
 15.2600 -@@ -64,7 +64,7 @@
 15.2601 - 
 15.2602 - static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb)
 15.2603 - {
 15.2604 --	int err = 0;
 15.2605 -+	int err = -ENOMEM;
 15.2606 - 	u8 nexthdr = 0;
 15.2607 - 	int hdr_len = skb->h.raw - skb->nh.raw;
 15.2608 - 	unsigned char *tmp_hdr = NULL;
 15.2609 -@@ -75,11 +75,8 @@
 15.2610 - 	struct crypto_tfm *tfm;
 15.2611 - 	int cpu;
 15.2612 - 
 15.2613 --	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
 15.2614 --		skb_linearize(skb, GFP_ATOMIC) != 0) {
 15.2615 --		err = -ENOMEM;
 15.2616 -+	if (skb_linearize_cow(skb))
 15.2617 - 		goto out;
 15.2618 --	}
 15.2619 - 
 15.2620 - 	skb->ip_summed = CHECKSUM_NONE;
 15.2621 - 
 15.2622 -@@ -158,10 +155,8 @@
 15.2623 - 		goto out_ok;
 15.2624 - 	}
 15.2625 - 
 15.2626 --	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
 15.2627 --		skb_linearize(skb, GFP_ATOMIC) != 0) {
 15.2628 -+	if (skb_linearize_cow(skb))
 15.2629 - 		goto out_ok;
 15.2630 --	}
 15.2631 - 
 15.2632 - 	/* compression */
 15.2633 - 	plen = skb->len - hdr_len;
 15.2634 -Index: tmp-xxx/net/ipv6/xfrm6_output.c
 15.2635 -===================================================================
 15.2636 ---- tmp-xxx.orig/net/ipv6/xfrm6_output.c	2006-11-15 10:38:39.000000000 +0000
 15.2637 -+++ tmp-xxx/net/ipv6/xfrm6_output.c	2006-11-27 10:52:42.000000000 +0000
 15.2638 -@@ -151,7 +151,7 @@
 15.2639 - 	goto out_exit;
 15.2640 - }
 15.2641 - 
 15.2642 --static int xfrm6_output_finish(struct sk_buff *skb)
 15.2643 -+static int xfrm6_output_finish2(struct sk_buff *skb)
 15.2644 - {
 15.2645 - 	int err;
 15.2646 - 
 15.2647 -@@ -167,7 +167,7 @@
 15.2648 - 			return dst_output(skb);
 15.2649 - 
 15.2650 - 		err = nf_hook(PF_INET6, NF_IP6_POST_ROUTING, &skb, NULL,
 15.2651 --			      skb->dst->dev, xfrm6_output_finish);
 15.2652 -+			      skb->dst->dev, xfrm6_output_finish2);
 15.2653 - 		if (unlikely(err != 1))
 15.2654 - 			break;
 15.2655 - 	}
 15.2656 -@@ -175,6 +175,41 @@
 15.2657 - 	return err;
 15.2658 - }
 15.2659 - 
 15.2660 -+static int xfrm6_output_finish(struct sk_buff *skb)
 15.2661 -+{
 15.2662 -+	struct sk_buff *segs;
 15.2663 -+
 15.2664 -+	if (!skb_shinfo(skb)->gso_size)
 15.2665 -+		return xfrm6_output_finish2(skb);
 15.2666 -+
 15.2667 -+	skb->protocol = htons(ETH_P_IP);
 15.2668 -+	segs = skb_gso_segment(skb, 0);
 15.2669 -+	kfree_skb(skb);
 15.2670 -+	if (unlikely(IS_ERR(segs)))
 15.2671 -+		return PTR_ERR(segs);
 15.2672 -+
 15.2673 -+	do {
 15.2674 -+		struct sk_buff *nskb = segs->next;
 15.2675 -+		int err;
 15.2676 -+
 15.2677 -+		segs->next = NULL;
 15.2678 -+		err = xfrm6_output_finish2(segs);
 15.2679 -+
 15.2680 -+		if (unlikely(err)) {
 15.2681 -+			while ((segs = nskb)) {
 15.2682 -+				nskb = segs->next;
 15.2683 -+				segs->next = NULL;
 15.2684 -+				kfree_skb(segs);
 15.2685 -+			}
 15.2686 -+			return err;
 15.2687 -+		}
 15.2688 -+
 15.2689 -+		segs = nskb;
 15.2690 -+	} while (segs);
 15.2691 -+
 15.2692 -+	return 0;
 15.2693 -+}
 15.2694 -+
 15.2695 - int xfrm6_output(struct sk_buff *skb)
 15.2696 - {
 15.2697 - 	return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dst->dev,
 15.2698 -Index: tmp-xxx/net/sched/sch_generic.c
 15.2699 -===================================================================
 15.2700 ---- tmp-xxx.orig/net/sched/sch_generic.c	2006-11-15 10:38:39.000000000 +0000
 15.2701 -+++ tmp-xxx/net/sched/sch_generic.c	2006-11-27 10:52:42.000000000 +0000
 15.2702 -@@ -72,9 +72,9 @@
 15.2703 -    dev->queue_lock serializes queue accesses for this device
 15.2704 -    AND dev->qdisc pointer itself.
 15.2705 - 
 15.2706 --   dev->xmit_lock serializes accesses to device driver.
 15.2707 -+   netif_tx_lock serializes accesses to device driver.
 15.2708 - 
 15.2709 --   dev->queue_lock and dev->xmit_lock are mutually exclusive,
 15.2710 -+   dev->queue_lock and netif_tx_lock are mutually exclusive,
 15.2711 -    if one is grabbed, another must be free.
 15.2712 -  */
 15.2713 - 
 15.2714 -@@ -90,14 +90,17 @@
 15.2715 -    NOTE: Called under dev->queue_lock with locally disabled BH.
 15.2716 - */
 15.2717 - 
 15.2718 --int qdisc_restart(struct net_device *dev)
 15.2719 -+static inline int qdisc_restart(struct net_device *dev)
 15.2720 - {
 15.2721 - 	struct Qdisc *q = dev->qdisc;
 15.2722 - 	struct sk_buff *skb;
 15.2723 - 
 15.2724 - 	/* Dequeue packet */
 15.2725 --	if ((skb = q->dequeue(q)) != NULL) {
 15.2726 -+	if (((skb = dev->gso_skb)) || ((skb = q->dequeue(q)))) {
 15.2727 - 		unsigned nolock = (dev->features & NETIF_F_LLTX);
 15.2728 -+
 15.2729 -+		dev->gso_skb = NULL;
 15.2730 -+
 15.2731 - 		/*
 15.2732 - 		 * When the driver has LLTX set it does its own locking
 15.2733 - 		 * in start_xmit. No need to add additional overhead by
 15.2734 -@@ -108,7 +111,7 @@
 15.2735 - 		 * will be requeued.
 15.2736 - 		 */
 15.2737 - 		if (!nolock) {
 15.2738 --			if (!spin_trylock(&dev->xmit_lock)) {
 15.2739 -+			if (!netif_tx_trylock(dev)) {
 15.2740 - 			collision:
 15.2741 - 				/* So, someone grabbed the driver. */
 15.2742 - 				
 15.2743 -@@ -126,8 +129,6 @@
 15.2744 - 				__get_cpu_var(netdev_rx_stat).cpu_collision++;
 15.2745 - 				goto requeue;
 15.2746 - 			}
 15.2747 --			/* Remember that the driver is grabbed by us. */
 15.2748 --			dev->xmit_lock_owner = smp_processor_id();
 15.2749 - 		}
 15.2750 - 		
 15.2751 - 		{
 15.2752 -@@ -136,14 +137,11 @@
 15.2753 - 
 15.2754 - 			if (!netif_queue_stopped(dev)) {
 15.2755 - 				int ret;
 15.2756 --				if (netdev_nit)
 15.2757 --					dev_queue_xmit_nit(skb, dev);
 15.2758 - 
 15.2759 --				ret = dev->hard_start_xmit(skb, dev);
 15.2760 -+				ret = dev_hard_start_xmit(skb, dev);
 15.2761 - 				if (ret == NETDEV_TX_OK) { 
 15.2762 - 					if (!nolock) {
 15.2763 --						dev->xmit_lock_owner = -1;
 15.2764 --						spin_unlock(&dev->xmit_lock);
 15.2765 -+						netif_tx_unlock(dev);
 15.2766 - 					}
 15.2767 - 					spin_lock(&dev->queue_lock);
 15.2768 - 					return -1;
 15.2769 -@@ -157,8 +155,7 @@
 15.2770 - 			/* NETDEV_TX_BUSY - we need to requeue */
 15.2771 - 			/* Release the driver */
 15.2772 - 			if (!nolock) { 
 15.2773 --				dev->xmit_lock_owner = -1;
 15.2774 --				spin_unlock(&dev->xmit_lock);
 15.2775 -+				netif_tx_unlock(dev);
 15.2776 - 			} 
 15.2777 - 			spin_lock(&dev->queue_lock);
 15.2778 - 			q = dev->qdisc;
 15.2779 -@@ -175,7 +172,10 @@
 15.2780 - 		 */
 15.2781 - 
 15.2782 - requeue:
 15.2783 --		q->ops->requeue(skb, q);
 15.2784 -+		if (skb->next)
 15.2785 -+			dev->gso_skb = skb;
 15.2786 -+		else
 15.2787 -+			q->ops->requeue(skb, q);
 15.2788 - 		netif_schedule(dev);
 15.2789 - 		return 1;
 15.2790 - 	}
 15.2791 -@@ -183,11 +183,23 @@
 15.2792 - 	return q->q.qlen;
 15.2793 - }
 15.2794 - 
 15.2795 -+void __qdisc_run(struct net_device *dev)
 15.2796 -+{
 15.2797 -+	if (unlikely(dev->qdisc == &noop_qdisc))
 15.2798 -+		goto out;
 15.2799 -+
 15.2800 -+	while (qdisc_restart(dev) < 0 && !netif_queue_stopped(dev))
 15.2801 -+		/* NOTHING */;
 15.2802 -+
 15.2803 -+out:
 15.2804 -+	clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state);
 15.2805 -+}
 15.2806 -+
 15.2807 - static void dev_watchdog(unsigned long arg)
 15.2808 - {
 15.2809 - 	struct net_device *dev = (struct net_device *)arg;
 15.2810 - 
 15.2811 --	spin_lock(&dev->xmit_lock);
 15.2812 -+	netif_tx_lock(dev);
 15.2813 - 	if (dev->qdisc != &noop_qdisc) {
 15.2814 - 		if (netif_device_present(dev) &&
 15.2815 - 		    netif_running(dev) &&
 15.2816 -@@ -201,7 +213,7 @@
 15.2817 - 				dev_hold(dev);
 15.2818 - 		}
 15.2819 - 	}
 15.2820 --	spin_unlock(&dev->xmit_lock);
 15.2821 -+	netif_tx_unlock(dev);
 15.2822 - 
 15.2823 - 	dev_put(dev);
 15.2824 - }
 15.2825 -@@ -225,17 +237,17 @@
 15.2826 - 
 15.2827 - static void dev_watchdog_up(struct net_device *dev)
 15.2828 - {
 15.2829 --	spin_lock_bh(&dev->xmit_lock);
 15.2830 -+	netif_tx_lock_bh(dev);
 15.2831 - 	__netdev_watchdog_up(dev);
 15.2832 --	spin_unlock_bh(&dev->xmit_lock);
 15.2833 -+	netif_tx_unlock_bh(dev);
 15.2834 - }
 15.2835 - 
 15.2836 - static void dev_watchdog_down(struct net_device *dev)
 15.2837 - {
 15.2838 --	spin_lock_bh(&dev->xmit_lock);
 15.2839 -+	netif_tx_lock_bh(dev);
 15.2840 - 	if (del_timer(&dev->watchdog_timer))
 15.2841 - 		__dev_put(dev);
 15.2842 --	spin_unlock_bh(&dev->xmit_lock);
 15.2843 -+	netif_tx_unlock_bh(dev);
 15.2844 - }
 15.2845 - 
 15.2846 - void netif_carrier_on(struct net_device *dev)
 15.2847 -@@ -577,10 +589,17 @@
 15.2848 - 
 15.2849 - 	dev_watchdog_down(dev);
 15.2850 - 
 15.2851 --	while (test_bit(__LINK_STATE_SCHED, &dev->state))
 15.2852 -+	/* Wait for outstanding dev_queue_xmit calls. */
 15.2853 -+	synchronize_rcu();
 15.2854 -+
 15.2855 -+	/* Wait for outstanding qdisc_run calls. */
 15.2856 -+	while (test_bit(__LINK_STATE_QDISC_RUNNING, &dev->state))
 15.2857 - 		yield();
 15.2858 - 
 15.2859 --	spin_unlock_wait(&dev->xmit_lock);
 15.2860 -+	if (dev->gso_skb) {
 15.2861 -+		kfree_skb(dev->gso_skb);
 15.2862 -+		dev->gso_skb = NULL;
 15.2863 -+	}
 15.2864 - }
 15.2865 - 
 15.2866 - void dev_init_scheduler(struct net_device *dev)
 15.2867 -@@ -622,6 +641,5 @@
 15.2868 - EXPORT_SYMBOL(qdisc_alloc);
 15.2869 - EXPORT_SYMBOL(qdisc_destroy);
 15.2870 - EXPORT_SYMBOL(qdisc_reset);
 15.2871 --EXPORT_SYMBOL(qdisc_restart);
 15.2872 - EXPORT_SYMBOL(qdisc_lock_tree);
 15.2873 - EXPORT_SYMBOL(qdisc_unlock_tree);
 15.2874 -Index: tmp-xxx/net/sched/sch_teql.c
 15.2875 -===================================================================
 15.2876 ---- tmp-xxx.orig/net/sched/sch_teql.c	2006-11-15 10:38:39.000000000 +0000
 15.2877 -+++ tmp-xxx/net/sched/sch_teql.c	2006-11-27 10:52:42.000000000 +0000
 15.2878 -@@ -302,20 +302,17 @@
 15.2879 - 
 15.2880 - 		switch (teql_resolve(skb, skb_res, slave)) {
 15.2881 - 		case 0:
 15.2882 --			if (spin_trylock(&slave->xmit_lock)) {
 15.2883 --				slave->xmit_lock_owner = smp_processor_id();
 15.2884 -+			if (netif_tx_trylock(slave)) {
 15.2885 - 				if (!netif_queue_stopped(slave) &&
 15.2886 - 				    slave->hard_start_xmit(skb, slave) == 0) {
 15.2887 --					slave->xmit_lock_owner = -1;
 15.2888 --					spin_unlock(&slave->xmit_lock);
 15.2889 -+					netif_tx_unlock(slave);
 15.2890 - 					master->slaves = NEXT_SLAVE(q);
 15.2891 - 					netif_wake_queue(dev);
 15.2892 - 					master->stats.tx_packets++;
 15.2893 - 					master->stats.tx_bytes += len;
 15.2894 - 					return 0;
 15.2895 - 				}
 15.2896 --				slave->xmit_lock_owner = -1;
 15.2897 --				spin_unlock(&slave->xmit_lock);
 15.2898 -+				netif_tx_unlock(slave);
 15.2899 - 			}
 15.2900 - 			if (netif_queue_stopped(dev))
 15.2901 - 				busy = 1;
    16.1 --- a/patches/linux-2.6.16.32/net-gso-1-check-dodgy.patch	Wed Nov 29 11:05:02 2006 -0700
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,27 +0,0 @@
    16.4 -diff -pruN ../orig-linux-2.6.16.29/net/ipv4/tcp.c ./net/ipv4/tcp.c
    16.5 ---- ../orig-linux-2.6.16.29/net/ipv4/tcp.c	2006-09-19 13:59:20.000000000 +0100
    16.6 -+++ ./net/ipv4/tcp.c	2006-09-19 13:59:42.000000000 +0100
    16.7 -@@ -2042,13 +2042,19 @@ struct sk_buff *tcp_tso_segment(struct s
    16.8 - 	if (!pskb_may_pull(skb, thlen))
    16.9 - 		goto out;
   16.10 - 
   16.11 --	segs = NULL;
   16.12 --	if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST))
   16.13 --		goto out;
   16.14 --
   16.15 - 	oldlen = (u16)~skb->len;
   16.16 - 	__skb_pull(skb, thlen);
   16.17 - 
   16.18 -+	if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
   16.19 -+		/* Packet is from an untrusted source, reset gso_segs. */
   16.20 -+		int mss = skb_shinfo(skb)->gso_size;
   16.21 -+
   16.22 -+		skb_shinfo(skb)->gso_segs = (skb->len + mss - 1) / mss;
   16.23 -+
   16.24 -+		segs = NULL;
   16.25 -+		goto out;
   16.26 -+	}
   16.27 -+
   16.28 - 	segs = skb_segment(skb, features);
   16.29 - 	if (IS_ERR(segs))
   16.30 - 		goto out;
    17.1 --- a/patches/linux-2.6.16.32/net-gso-2-checksum-fix.patch	Wed Nov 29 11:05:02 2006 -0700
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,451 +0,0 @@
    17.4 -diff -pruN ../orig-linux-2.6.16.29/drivers/net/bnx2.c ./drivers/net/bnx2.c
    17.5 ---- ../orig-linux-2.6.16.29/drivers/net/bnx2.c	2006-09-19 13:59:20.000000000 +0100
    17.6 -+++ ./drivers/net/bnx2.c	2006-09-19 13:59:46.000000000 +0100
    17.7 -@@ -1593,7 +1593,7 @@ bnx2_tx_int(struct bnx2 *bp)
    17.8 - 		skb = tx_buf->skb;
    17.9 - #ifdef BCM_TSO 
   17.10 - 		/* partial BD completions possible with TSO packets */
   17.11 --		if (skb_shinfo(skb)->gso_size) {
   17.12 -+		if (skb_is_gso(skb)) {
   17.13 - 			u16 last_idx, last_ring_idx;
   17.14 - 
   17.15 - 			last_idx = sw_cons +
   17.16 -diff -pruN ../orig-linux-2.6.16.29/drivers/net/chelsio/sge.c ./drivers/net/chelsio/sge.c
   17.17 ---- ../orig-linux-2.6.16.29/drivers/net/chelsio/sge.c	2006-09-19 13:59:20.000000000 +0100
   17.18 -+++ ./drivers/net/chelsio/sge.c	2006-09-19 13:59:46.000000000 +0100
   17.19 -@@ -1419,7 +1419,7 @@ int t1_start_xmit(struct sk_buff *skb, s
   17.20 - 	struct cpl_tx_pkt *cpl;
   17.21 - 
   17.22 - #ifdef NETIF_F_TSO
   17.23 --	if (skb_shinfo(skb)->gso_size) {
   17.24 -+	if (skb_is_gso(skb)) {
   17.25 - 		int eth_type;
   17.26 - 		struct cpl_tx_pkt_lso *hdr;
   17.27 - 
   17.28 -diff -pruN ../orig-linux-2.6.16.29/drivers/net/e1000/e1000_main.c ./drivers/net/e1000/e1000_main.c
   17.29 ---- ../orig-linux-2.6.16.29/drivers/net/e1000/e1000_main.c	2006-09-19 13:59:20.000000000 +0100
   17.30 -+++ ./drivers/net/e1000/e1000_main.c	2006-09-19 13:59:46.000000000 +0100
   17.31 -@@ -2526,7 +2526,7 @@ e1000_tso(struct e1000_adapter *adapter,
   17.32 - 	uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
   17.33 - 	int err;
   17.34 - 
   17.35 --	if (skb_shinfo(skb)->gso_size) {
   17.36 -+	if (skb_is_gso(skb)) {
   17.37 - 		if (skb_header_cloned(skb)) {
   17.38 - 			err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
   17.39 - 			if (err)
   17.40 -@@ -2651,7 +2651,7 @@ e1000_tx_map(struct e1000_adapter *adapt
   17.41 - 		 * tso gets written back prematurely before the data is fully
   17.42 - 		 * DMAd to the controller */
   17.43 - 		if (!skb->data_len && tx_ring->last_tx_tso &&
   17.44 --				!skb_shinfo(skb)->gso_size) {
   17.45 -+		    !skb_is_gso(skb)) {
   17.46 - 			tx_ring->last_tx_tso = 0;
   17.47 - 			size -= 4;
   17.48 - 		}
   17.49 -@@ -2934,8 +2934,7 @@ e1000_xmit_frame(struct sk_buff *skb, st
   17.50 - 
   17.51 - #ifdef NETIF_F_TSO
   17.52 - 	/* Controller Erratum workaround */
   17.53 --	if (!skb->data_len && tx_ring->last_tx_tso &&
   17.54 --		!skb_shinfo(skb)->gso_size)
   17.55 -+	if (!skb->data_len && tx_ring->last_tx_tso && !skb_is_gso(skb))
   17.56 - 		count++;
   17.57 - #endif
   17.58 - 
   17.59 -diff -pruN ../orig-linux-2.6.16.29/drivers/net/forcedeth.c ./drivers/net/forcedeth.c
   17.60 ---- ../orig-linux-2.6.16.29/drivers/net/forcedeth.c	2006-09-19 13:59:20.000000000 +0100
   17.61 -+++ ./drivers/net/forcedeth.c	2006-09-19 13:59:46.000000000 +0100
   17.62 -@@ -1105,7 +1105,7 @@ static int nv_start_xmit(struct sk_buff 
   17.63 - 	np->tx_skbuff[nr] = skb;
   17.64 - 
   17.65 - #ifdef NETIF_F_TSO
   17.66 --	if (skb_shinfo(skb)->gso_size)
   17.67 -+	if (skb_is_gso(skb))
   17.68 - 		tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->gso_size << NV_TX2_TSO_SHIFT);
   17.69 - 	else
   17.70 - #endif
   17.71 -diff -pruN ../orig-linux-2.6.16.29/drivers/net/ixgb/ixgb_main.c ./drivers/net/ixgb/ixgb_main.c
   17.72 ---- ../orig-linux-2.6.16.29/drivers/net/ixgb/ixgb_main.c	2006-09-19 13:59:20.000000000 +0100
   17.73 -+++ ./drivers/net/ixgb/ixgb_main.c	2006-09-19 13:59:46.000000000 +0100
   17.74 -@@ -1163,7 +1163,7 @@ ixgb_tso(struct ixgb_adapter *adapter, s
   17.75 - 	uint16_t ipcse, tucse, mss;
   17.76 - 	int err;
   17.77 - 
   17.78 --	if(likely(skb_shinfo(skb)->gso_size)) {
   17.79 -+	if (likely(skb_is_gso(skb))) {
   17.80 - 		if (skb_header_cloned(skb)) {
   17.81 - 			err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
   17.82 - 			if (err)
   17.83 -diff -pruN ../orig-linux-2.6.16.29/drivers/net/loopback.c ./drivers/net/loopback.c
   17.84 ---- ../orig-linux-2.6.16.29/drivers/net/loopback.c	2006-09-19 13:59:20.000000000 +0100
   17.85 -+++ ./drivers/net/loopback.c	2006-09-19 13:59:46.000000000 +0100
   17.86 -@@ -139,7 +139,7 @@ static int loopback_xmit(struct sk_buff 
   17.87 - #endif
   17.88 - 
   17.89 - #ifdef LOOPBACK_TSO
   17.90 --	if (skb_shinfo(skb)->gso_size) {
   17.91 -+	if (skb_is_gso(skb)) {
   17.92 - 		BUG_ON(skb->protocol != htons(ETH_P_IP));
   17.93 - 		BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP);
   17.94 - 
   17.95 -diff -pruN ../orig-linux-2.6.16.29/drivers/net/sky2.c ./drivers/net/sky2.c
   17.96 ---- ../orig-linux-2.6.16.29/drivers/net/sky2.c	2006-09-19 13:59:20.000000000 +0100
   17.97 -+++ ./drivers/net/sky2.c	2006-09-19 13:59:46.000000000 +0100
   17.98 -@@ -1125,7 +1125,7 @@ static unsigned tx_le_req(const struct s
   17.99 - 	count = sizeof(dma_addr_t) / sizeof(u32);
  17.100 - 	count += skb_shinfo(skb)->nr_frags * count;
  17.101 - 
  17.102 --	if (skb_shinfo(skb)->gso_size)
  17.103 -+	if (skb_is_gso(skb))
  17.104 - 		++count;
  17.105 - 
  17.106 - 	if (skb->ip_summed == CHECKSUM_HW)
  17.107 -diff -pruN ../orig-linux-2.6.16.29/drivers/net/typhoon.c ./drivers/net/typhoon.c
  17.108 ---- ../orig-linux-2.6.16.29/drivers/net/typhoon.c	2006-09-19 13:59:20.000000000 +0100
  17.109 -+++ ./drivers/net/typhoon.c	2006-09-19 13:59:46.000000000 +0100
  17.110 -@@ -805,7 +805,7 @@ typhoon_start_tx(struct sk_buff *skb, st
  17.111 - 	 * If problems develop with TSO, check this first.
  17.112 - 	 */
  17.113 - 	numDesc = skb_shinfo(skb)->nr_frags + 1;
  17.114 --	if(skb_tso_size(skb))
  17.115 -+	if (skb_is_gso(skb))
  17.116 - 		numDesc++;
  17.117 - 
  17.118 - 	/* When checking for free space in the ring, we need to also
  17.119 -@@ -845,7 +845,7 @@ typhoon_start_tx(struct sk_buff *skb, st
  17.120 - 				TYPHOON_TX_PF_VLAN_TAG_SHIFT);
  17.121 - 	}
  17.122 - 
  17.123 --	if(skb_tso_size(skb)) {
  17.124 -+	if (skb_is_gso(skb)) {
  17.125 - 		first_txd->processFlags |= TYPHOON_TX_PF_TCP_SEGMENT;
  17.126 - 		first_txd->numDesc++;
  17.127 - 
  17.128 -diff -pruN ../orig-linux-2.6.16.29/drivers/s390/net/qeth_main.c ./drivers/s390/net/qeth_main.c
  17.129 ---- ../orig-linux-2.6.16.29/drivers/s390/net/qeth_main.c	2006-09-19 13:59:20.000000000 +0100
  17.130 -+++ ./drivers/s390/net/qeth_main.c	2006-09-19 13:59:46.000000000 +0100
  17.131 -@@ -4454,7 +4454,7 @@ qeth_send_packet(struct qeth_card *card,
  17.132 - 	queue = card->qdio.out_qs
  17.133 - 		[qeth_get_priority_queue(card, skb, ipv, cast_type)];
  17.134 - 
  17.135 --	if (skb_shinfo(skb)->gso_size)
  17.136 -+	if (skb_is_gso(skb))
  17.137 - 		large_send = card->options.large_send;
  17.138 - 
  17.139 - 	/*are we able to do TSO ? If so ,prepare and send it from here */
  17.140 -@@ -4501,8 +4501,7 @@ qeth_send_packet(struct qeth_card *card,
  17.141 - 		card->stats.tx_packets++;
  17.142 - 		card->stats.tx_bytes += skb->len;
  17.143 - #ifdef CONFIG_QETH_PERF_STATS
  17.144 --		if (skb_shinfo(skb)->gso_size &&
  17.145 --		   !(large_send == QETH_LARGE_SEND_NO)) {
  17.146 -+		if (skb_is_gso(skb) && !(large_send == QETH_LARGE_SEND_NO)) {
  17.147 - 			card->perf_stats.large_send_bytes += skb->len;
  17.148 - 			card->perf_stats.large_send_cnt++;
  17.149 - 		}
  17.150 -diff -pruN ../orig-linux-2.6.16.29/include/linux/netdevice.h ./include/linux/netdevice.h
  17.151 ---- ../orig-linux-2.6.16.29/include/linux/netdevice.h	2006-09-19 13:59:20.000000000 +0100
  17.152 -+++ ./include/linux/netdevice.h	2006-09-19 13:59:46.000000000 +0100
  17.153 -@@ -541,6 +541,7 @@ struct packet_type {
  17.154 - 					 struct net_device *);
  17.155 - 	struct sk_buff		*(*gso_segment)(struct sk_buff *skb,
  17.156 - 						int features);
  17.157 -+	int			(*gso_send_check)(struct sk_buff *skb);
  17.158 - 	void			*af_packet_priv;
  17.159 - 	struct list_head	list;
  17.160 - };
  17.161 -@@ -1001,14 +1002,15 @@ extern void linkwatch_run_queue(void);
  17.162 - 
  17.163 - static inline int skb_gso_ok(struct sk_buff *skb, int features)
  17.164 - {
  17.165 --	int feature = skb_shinfo(skb)->gso_size ?
  17.166 --		      skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT : 0;
  17.167 -+	int feature = skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT;
  17.168 - 	return (features & feature) == feature;
  17.169 - }
  17.170 - 
  17.171 - static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
  17.172 - {
  17.173 --	return !skb_gso_ok(skb, dev->features);
  17.174 -+	return skb_is_gso(skb) &&
  17.175 -+	       (!skb_gso_ok(skb, dev->features) ||
  17.176 -+		unlikely(skb->ip_summed != CHECKSUM_HW));
  17.177 - }
  17.178 - 
  17.179 - #endif /* __KERNEL__ */
  17.180 -diff -pruN ../orig-linux-2.6.16.29/include/linux/skbuff.h ./include/linux/skbuff.h
  17.181 ---- ../orig-linux-2.6.16.29/include/linux/skbuff.h	2006-09-19 13:59:20.000000000 +0100
  17.182 -+++ ./include/linux/skbuff.h	2006-09-19 13:59:46.000000000 +0100
  17.183 -@@ -1403,5 +1403,10 @@ static inline void nf_bridge_get(struct 
  17.184 - static inline void nf_reset(struct sk_buff *skb) {}
  17.185 - #endif /* CONFIG_NETFILTER */
  17.186 - 
  17.187 -+static inline int skb_is_gso(const struct sk_buff *skb)
  17.188 -+{
  17.189 -+	return skb_shinfo(skb)->gso_size;
  17.190 -+}
  17.191 -+
  17.192 - #endif	/* __KERNEL__ */
  17.193 - #endif	/* _LINUX_SKBUFF_H */
  17.194 -diff -pruN ../orig-linux-2.6.16.29/include/net/protocol.h ./include/net/protocol.h
  17.195 ---- ../orig-linux-2.6.16.29/include/net/protocol.h	2006-09-19 13:59:20.000000000 +0100
  17.196 -+++ ./include/net/protocol.h	2006-09-19 13:59:46.000000000 +0100
  17.197 -@@ -37,6 +37,7 @@
  17.198 - struct net_protocol {
  17.199 - 	int			(*handler)(struct sk_buff *skb);
  17.200 - 	void			(*err_handler)(struct sk_buff *skb, u32 info);
  17.201 -+	int			(*gso_send_check)(struct sk_buff *skb);
  17.202 - 	struct sk_buff	       *(*gso_segment)(struct sk_buff *skb,
  17.203 - 					       int features);
  17.204 - 	int			no_policy;
  17.205 -diff -pruN ../orig-linux-2.6.16.29/include/net/tcp.h ./include/net/tcp.h
  17.206 ---- ../orig-linux-2.6.16.29/include/net/tcp.h	2006-09-19 13:59:20.000000000 +0100
  17.207 -+++ ./include/net/tcp.h	2006-09-19 13:59:46.000000000 +0100
  17.208 -@@ -1063,6 +1063,7 @@ extern struct request_sock_ops tcp_reque
  17.209 - 
  17.210 - extern int tcp_v4_destroy_sock(struct sock *sk);
  17.211 - 
  17.212 -+extern int tcp_v4_gso_send_check(struct sk_buff *skb);
  17.213 - extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features);
  17.214 - 
  17.215 - #ifdef CONFIG_PROC_FS
  17.216 -diff -pruN ../orig-linux-2.6.16.29/net/bridge/br_forward.c ./net/bridge/br_forward.c
  17.217 ---- ../orig-linux-2.6.16.29/net/bridge/br_forward.c	2006-09-19 13:59:20.000000000 +0100
  17.218 -+++ ./net/bridge/br_forward.c	2006-09-19 13:59:46.000000000 +0100
  17.219 -@@ -32,7 +32,7 @@ static inline int should_deliver(const s
  17.220 - int br_dev_queue_push_xmit(struct sk_buff *skb)
  17.221 - {
  17.222 - 	/* drop mtu oversized packets except tso */
  17.223 --	if (skb->len > skb->dev->mtu && !skb_shinfo(skb)->gso_size)
  17.224 -+	if (skb->len > skb->dev->mtu && !skb_is_gso(skb))
  17.225 - 		kfree_skb(skb);
  17.226 - 	else {
  17.227 - #ifdef CONFIG_BRIDGE_NETFILTER
  17.228 -diff -pruN ../orig-linux-2.6.16.29/net/bridge/br_netfilter.c ./net/bridge/br_netfilter.c
  17.229 ---- ../orig-linux-2.6.16.29/net/bridge/br_netfilter.c	2006-09-19 13:59:20.000000000 +0100
  17.230 -+++ ./net/bridge/br_netfilter.c	2006-09-19 13:59:46.000000000 +0100
  17.231 -@@ -743,7 +743,7 @@ static int br_nf_dev_queue_xmit(struct s
  17.232 - {
  17.233 - 	if (skb->protocol == htons(ETH_P_IP) &&
  17.234 - 	    skb->len > skb->dev->mtu &&
  17.235 --	    !skb_shinfo(skb)->gso_size)
  17.236 -+	    !skb_is_gso(skb))
  17.237 - 		return ip_fragment(skb, br_dev_queue_push_xmit);
  17.238 - 	else
  17.239 - 		return br_dev_queue_push_xmit(skb);
  17.240 -diff -pruN ../orig-linux-2.6.16.29/net/core/dev.c ./net/core/dev.c
  17.241 ---- ../orig-linux-2.6.16.29/net/core/dev.c	2006-09-19 13:59:20.000000000 +0100
  17.242 -+++ ./net/core/dev.c	2006-09-19 13:59:46.000000000 +0100
  17.243 -@@ -1083,9 +1083,17 @@ int skb_checksum_help(struct sk_buff *sk
  17.244 - 	unsigned int csum;
  17.245 - 	int ret = 0, offset = skb->h.raw - skb->data;
  17.246 - 
  17.247 --	if (inward) {
  17.248 --		skb->ip_summed = CHECKSUM_NONE;
  17.249 --		goto out;
  17.250 -+	if (inward)
  17.251 -+		goto out_set_summed;
  17.252 -+
  17.253 -+	if (unlikely(skb_shinfo(skb)->gso_size)) {
  17.254 -+		static int warned;
  17.255 -+
  17.256 -+		WARN_ON(!warned);
  17.257 -+		warned = 1;
  17.258 -+
  17.259 -+		/* Let GSO fix up the checksum. */
  17.260 -+		goto out_set_summed;
  17.261 - 	}
  17.262 - 
  17.263 - 	if (skb_cloned(skb)) {
  17.264 -@@ -1102,6 +1110,8 @@ int skb_checksum_help(struct sk_buff *sk
  17.265 - 	BUG_ON(skb->csum + 2 > offset);
  17.266 - 
  17.267 - 	*(u16*)(skb->h.raw + skb->csum) = csum_fold(csum);
  17.268 -+
  17.269 -+out_set_summed:
  17.270 - 	skb->ip_summed = CHECKSUM_NONE;
  17.271 - out:	
  17.272 - 	return ret;
  17.273 -@@ -1122,17 +1132,35 @@ struct sk_buff *skb_gso_segment(struct s
  17.274 - 	struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
  17.275 - 	struct packet_type *ptype;
  17.276 - 	int type = skb->protocol;
  17.277 -+	int err;
  17.278 - 
  17.279 - 	BUG_ON(skb_shinfo(skb)->frag_list);
  17.280 --	BUG_ON(skb->ip_summed != CHECKSUM_HW);
  17.281 - 
  17.282 - 	skb->mac.raw = skb->data;
  17.283 - 	skb->mac_len = skb->nh.raw - skb->data;
  17.284 - 	__skb_pull(skb, skb->mac_len);
  17.285 - 
  17.286 -+	if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
  17.287 -+		static int warned;
  17.288 -+
  17.289 -+		WARN_ON(!warned);
  17.290 -+		warned = 1;
  17.291 -+
  17.292 -+		if (skb_header_cloned(skb) &&
  17.293 -+		    (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
  17.294 -+			return ERR_PTR(err);
  17.295 -+	}
  17.296 -+
  17.297 - 	rcu_read_lock();
  17.298 - 	list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) {
  17.299 - 		if (ptype->type == type && !ptype->dev && ptype->gso_segment) {
  17.300 -+			if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
  17.301 -+				err = ptype->gso_send_check(skb);
  17.302 -+				segs = ERR_PTR(err);
  17.303 -+				if (err || skb_gso_ok(skb, features))
  17.304 -+					break;
  17.305 -+				__skb_push(skb, skb->data - skb->nh.raw);
  17.306 -+			}
  17.307 - 			segs = ptype->gso_segment(skb, features);
  17.308 - 			break;
  17.309 - 		}
  17.310 -diff -pruN ../orig-linux-2.6.16.29/net/ipv4/af_inet.c ./net/ipv4/af_inet.c
  17.311 ---- ../orig-linux-2.6.16.29/net/ipv4/af_inet.c	2006-09-19 13:59:20.000000000 +0100
  17.312 -+++ ./net/ipv4/af_inet.c	2006-09-19 13:59:46.000000000 +0100
  17.313 -@@ -1085,6 +1085,40 @@ int inet_sk_rebuild_header(struct sock *
  17.314 - 
  17.315 - EXPORT_SYMBOL(inet_sk_rebuild_header);
  17.316 - 
  17.317 -+static int inet_gso_send_check(struct sk_buff *skb)
  17.318 -+{
  17.319 -+	struct iphdr *iph;
  17.320 -+	struct net_protocol *ops;
  17.321 -+	int proto;
  17.322 -+	int ihl;
  17.323 -+	int err = -EINVAL;
  17.324 -+
  17.325 -+	if (unlikely(!pskb_may_pull(skb, sizeof(*iph))))
  17.326 -+		goto out;
  17.327 -+
  17.328 -+	iph = skb->nh.iph;
  17.329 -+	ihl = iph->ihl * 4;
  17.330 -+	if (ihl < sizeof(*iph))
  17.331 -+		goto out;
  17.332 -+
  17.333 -+	if (unlikely(!pskb_may_pull(skb, ihl)))
  17.334 -+		goto out;
  17.335 -+
  17.336 -+	skb->h.raw = __skb_pull(skb, ihl);
  17.337 -+	iph = skb->nh.iph;
  17.338 -+	proto = iph->protocol & (MAX_INET_PROTOS - 1);
  17.339 -+	err = -EPROTONOSUPPORT;
  17.340 -+
  17.341 -+	rcu_read_lock();
  17.342 -+	ops = rcu_dereference(inet_protos[proto]);
  17.343 -+	if (likely(ops && ops->gso_send_check))
  17.344 -+		err = ops->gso_send_check(skb);
  17.345 -+	rcu_read_unlock();
  17.346 -+
  17.347 -+out:
  17.348 -+	return err;
  17.349 -+}
  17.350 -+
  17.351 - static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features)
  17.352 - {
  17.353 - 	struct sk_buff *segs = ERR_PTR(-EINVAL);
  17.354 -@@ -1142,6 +1176,7 @@ static struct net_protocol igmp_protocol
  17.355 - static struct net_protocol tcp_protocol = {
  17.356 - 	.handler =	tcp_v4_rcv,
  17.357 - 	.err_handler =	tcp_v4_err,
  17.358 -+	.gso_send_check = tcp_v4_gso_send_check,
  17.359 - 	.gso_segment =	tcp_tso_segment,
  17.360 - 	.no_policy =	1,
  17.361 - };
  17.362 -@@ -1188,6 +1223,7 @@ static int ipv4_proc_init(void);
  17.363 - static struct packet_type ip_packet_type = {
  17.364 - 	.type = __constant_htons(ETH_P_IP),
  17.365 - 	.func = ip_rcv,
  17.366 -+	.gso_send_check = inet_gso_send_check,
  17.367 - 	.gso_segment = inet_gso_segment,
  17.368 - };
  17.369 - 
  17.370 -diff -pruN ../orig-linux-2.6.16.29/net/ipv4/ip_output.c ./net/ipv4/ip_output.c
  17.371 ---- ../orig-linux-2.6.16.29/net/ipv4/ip_output.c	2006-09-19 13:59:20.000000000 +0100
  17.372 -+++ ./net/ipv4/ip_output.c	2006-09-19 13:59:46.000000000 +0100
  17.373 -@@ -210,7 +210,7 @@ static inline int ip_finish_output(struc
  17.374 - 		return dst_output(skb);
  17.375 - 	}
  17.376 - #endif
  17.377 --	if (skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->gso_size)
  17.378 -+	if (skb->len > dst_mtu(skb->dst) && !skb_is_gso(skb))
  17.379 - 		return ip_fragment(skb, ip_finish_output2);
  17.380 - 	else
  17.381 - 		return ip_finish_output2(skb);
  17.382 -@@ -1095,7 +1095,7 @@ ssize_t	ip_append_page(struct sock *sk, 
  17.383 - 	while (size > 0) {
  17.384 - 		int i;
  17.385 - 
  17.386 --		if (skb_shinfo(skb)->gso_size)
  17.387 -+		if (skb_is_gso(skb))
  17.388 - 			len = size;
  17.389 - 		else {
  17.390 - 
  17.391 -diff -pruN ../orig-linux-2.6.16.29/net/ipv4/tcp_ipv4.c ./net/ipv4/tcp_ipv4.c
  17.392 ---- ../orig-linux-2.6.16.29/net/ipv4/tcp_ipv4.c	2006-09-12 19:02:10.000000000 +0100
  17.393 -+++ ./net/ipv4/tcp_ipv4.c	2006-09-19 13:59:46.000000000 +0100
  17.394 -@@ -495,6 +495,24 @@ void tcp_v4_send_check(struct sock *sk, 
  17.395 - 	}
  17.396 - }
  17.397 - 
  17.398 -+int tcp_v4_gso_send_check(struct sk_buff *skb)
  17.399 -+{
  17.400 -+	struct iphdr *iph;
  17.401 -+	struct tcphdr *th;
  17.402 -+
  17.403 -+	if (!pskb_may_pull(skb, sizeof(*th)))
  17.404 -+		return -EINVAL;
  17.405 -+
  17.406 -+	iph = skb->nh.iph;
  17.407 -+	th = skb->h.th;
  17.408 -+
  17.409 -+	th->check = 0;
  17.410 -+	th->check = ~tcp_v4_check(th, skb->len, iph->saddr, iph->daddr, 0);
  17.411 -+	skb->csum = offsetof(struct tcphdr, check);
  17.412 -+	skb->ip_summed = CHECKSUM_HW;
  17.413 -+	return 0;
  17.414 -+}
  17.415 -+
  17.416 - /*
  17.417 -  *	This routine will send an RST to the other tcp.
  17.418 -  *
  17.419 -diff -pruN ../orig-linux-2.6.16.29/net/ipv4/xfrm4_output.c ./net/ipv4/xfrm4_output.c
  17.420 ---- ../orig-linux-2.6.16.29/net/ipv4/xfrm4_output.c	2006-09-19 13:59:20.000000000 +0100
  17.421 -+++ ./net/ipv4/xfrm4_output.c	2006-09-19 13:59:46.000000000 +0100
  17.422 -@@ -195,7 +195,7 @@ static int xfrm4_output_finish(struct sk
  17.423 - 	}
  17.424 - #endif
  17.425 - 
  17.426 --	if (!skb_shinfo(skb)->gso_size)
  17.427 -+	if (!skb_is_gso(skb))
  17.428 - 		return xfrm4_output_finish2(skb);
  17.429 - 
  17.430 - 	skb->protocol = htons(ETH_P_IP);
  17.431 -diff -pruN ../orig-linux-2.6.16.29/net/ipv6/ip6_output.c ./net/ipv6/ip6_output.c
  17.432 ---- ../orig-linux-2.6.16.29/net/ipv6/ip6_output.c	2006-09-19 13:59:20.000000000 +0100
  17.433 -+++ ./net/ipv6/ip6_output.c	2006-09-19 13:59:46.000000000 +0100
  17.434 -@@ -147,7 +147,7 @@ static int ip6_output2(struct sk_buff *s
  17.435 - 
  17.436 - int ip6_output(struct sk_buff *skb)
  17.437 - {
  17.438 --	if ((skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->gso_size) ||
  17.439 -+	if ((skb->len > dst_mtu(skb->dst) && !skb_is_gso(skb)) ||
  17.440 - 				dst_allfrag(skb->dst))
  17.441 - 		return ip6_fragment(skb, ip6_output2);
  17.442 - 	else
  17.443 -diff -pruN ../orig-linux-2.6.16.29/net/ipv6/xfrm6_output.c ./net/ipv6/xfrm6_output.c
  17.444 ---- ../orig-linux-2.6.16.29/net/ipv6/xfrm6_output.c	2006-09-19 13:59:20.000000000 +0100
  17.445 -+++ ./net/ipv6/xfrm6_output.c	2006-09-19 13:59:46.000000000 +0100
  17.446 -@@ -179,7 +179,7 @@ static int xfrm6_output_finish(struct sk
  17.447 - {
  17.448 - 	struct sk_buff *segs;
  17.449 - 
  17.450 --	if (!skb_shinfo(skb)->gso_size)
  17.451 -+	if (!skb_is_gso(skb))
  17.452 - 		return xfrm6_output_finish2(skb);
  17.453 - 
  17.454 - 	skb->protocol = htons(ETH_P_IP);
    18.1 --- a/patches/linux-2.6.16.32/net-gso-3-fix-errorcheck.patch	Wed Nov 29 11:05:02 2006 -0700
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,17 +0,0 @@
    18.4 -diff -pruN ../orig-linux-2.6.16.29/include/linux/netdevice.h ./include/linux/netdevice.h
    18.5 ---- ../orig-linux-2.6.16.29/include/linux/netdevice.h	2006-09-19 13:59:46.000000000 +0100
    18.6 -+++ ./include/linux/netdevice.h	2006-09-19 14:05:28.000000000 +0100
    18.7 -@@ -930,10 +930,10 @@ static inline void netif_tx_lock_bh(stru
    18.8 - 
    18.9 - static inline int netif_tx_trylock(struct net_device *dev)
   18.10 - {
   18.11 --	int err = spin_trylock(&dev->_xmit_lock);
   18.12 --	if (!err)
   18.13 -+	int ok = spin_trylock(&dev->_xmit_lock);
   18.14 -+	if (likely(ok))
   18.15 - 		dev->xmit_lock_owner = smp_processor_id();
   18.16 --	return err;
   18.17 -+	return ok;
   18.18 - }
   18.19 - 
   18.20 - static inline void netif_tx_unlock(struct net_device *dev)
    19.1 --- a/patches/linux-2.6.16.32/net-gso-4-kill-warnon.patch	Wed Nov 29 11:05:02 2006 -0700
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,27 +0,0 @@
    19.4 -diff -pruN ../orig-linux-2.6.16.29/net/core/dev.c ./net/core/dev.c
    19.5 ---- ../orig-linux-2.6.16.29/net/core/dev.c	2006-09-19 13:59:46.000000000 +0100
    19.6 -+++ ./net/core/dev.c	2006-09-19 14:05:32.000000000 +0100
    19.7 -@@ -1087,11 +1087,6 @@ int skb_checksum_help(struct sk_buff *sk
    19.8 - 		goto out_set_summed;
    19.9 - 
   19.10 - 	if (unlikely(skb_shinfo(skb)->gso_size)) {
   19.11 --		static int warned;
   19.12 --
   19.13 --		WARN_ON(!warned);
   19.14 --		warned = 1;
   19.15 --
   19.16 - 		/* Let GSO fix up the checksum. */
   19.17 - 		goto out_set_summed;
   19.18 - 	}
   19.19 -@@ -1141,11 +1136,6 @@ struct sk_buff *skb_gso_segment(struct s
   19.20 - 	__skb_pull(skb, skb->mac_len);
   19.21 - 
   19.22 - 	if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
   19.23 --		static int warned;
   19.24 --
   19.25 --		WARN_ON(!warned);
   19.26 --		warned = 1;
   19.27 --
   19.28 - 		if (skb_header_cloned(skb) &&
   19.29 - 		    (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
   19.30 - 			return ERR_PTR(err);
    20.1 --- a/patches/linux-2.6.16.32/net-gso-5-rcv-mss.patch	Wed Nov 29 11:05:02 2006 -0700
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,13 +0,0 @@
    20.4 -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
    20.5 -index 104af5d..1fa1536 100644
    20.6 ---- a/net/ipv4/tcp_input.c
    20.7 -+++ b/net/ipv4/tcp_input.c
    20.8 -@@ -127,7 +127,7 @@ static void tcp_measure_rcv_mss(struct s
    20.9 - 	/* skb->len may jitter because of SACKs, even if peer
   20.10 - 	 * sends good full-sized frames.
   20.11 - 	 */
   20.12 --	len = skb->len;
   20.13 -+	len = skb_shinfo(skb)->gso_size ?: skb->len;
   20.14 - 	if (len >= icsk->icsk_ack.rcv_mss) {
   20.15 - 		icsk->icsk_ack.rcv_mss = len;
   20.16 - 	} else {
    21.1 --- a/patches/linux-2.6.16.32/pci-mmconfig-fix-from-2.6.17.patch	Wed Nov 29 11:05:02 2006 -0700
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,292 +0,0 @@
    21.4 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/pci/mmconfig.c ./arch/i386/pci/mmconfig.c
    21.5 ---- ../orig-linux-2.6.16.29/arch/i386/pci/mmconfig.c	2006-09-12 19:02:10.000000000 +0100
    21.6 -+++ ./arch/i386/pci/mmconfig.c	2006-09-21 09:35:27.000000000 +0100
    21.7 -@@ -12,14 +12,22 @@
    21.8 - #include <linux/pci.h>
    21.9 - #include <linux/init.h>
   21.10 - #include <linux/acpi.h>
   21.11 -+#include <asm/e820.h>
   21.12 - #include "pci.h"
   21.13 - 
   21.14 -+/* aperture is up to 256MB but BIOS may reserve less */
   21.15 -+#define MMCONFIG_APER_MIN	(2 * 1024*1024)
   21.16 -+#define MMCONFIG_APER_MAX	(256 * 1024*1024)
   21.17 -+
   21.18 -+/* Assume systems with more busses have correct MCFG */
   21.19 -+#define MAX_CHECK_BUS 16
   21.20 -+
   21.21 - #define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG))
   21.22 - 
   21.23 - /* The base address of the last MMCONFIG device accessed */
   21.24 - static u32 mmcfg_last_accessed_device;
   21.25 - 
   21.26 --static DECLARE_BITMAP(fallback_slots, 32);
   21.27 -+static DECLARE_BITMAP(fallback_slots, MAX_CHECK_BUS*32);
   21.28 - 
   21.29 - /*
   21.30 -  * Functions for accessing PCI configuration space with MMCONFIG accesses
   21.31 -@@ -29,8 +37,8 @@ static u32 get_base_addr(unsigned int se
   21.32 - 	int cfg_num = -1;
   21.33 - 	struct acpi_table_mcfg_config *cfg;
   21.34 - 
   21.35 --	if (seg == 0 && bus == 0 &&
   21.36 --	    test_bit(PCI_SLOT(devfn), fallback_slots))
   21.37 -+	if (seg == 0 && bus < MAX_CHECK_BUS &&
   21.38 -+	    test_bit(PCI_SLOT(devfn) + 32*bus, fallback_slots))
   21.39 - 		return 0;
   21.40 - 
   21.41 - 	while (1) {
   21.42 -@@ -74,8 +82,10 @@ static int pci_mmcfg_read(unsigned int s
   21.43 - 	unsigned long flags;
   21.44 - 	u32 base;
   21.45 - 
   21.46 --	if (!value || (bus > 255) || (devfn > 255) || (reg > 4095))
   21.47 -+	if ((bus > 255) || (devfn > 255) || (reg > 4095)) {
   21.48 -+		*value = -1;
   21.49 - 		return -EINVAL;
   21.50 -+	}
   21.51 - 
   21.52 - 	base = get_base_addr(seg, bus, devfn);
   21.53 - 	if (!base)
   21.54 -@@ -146,30 +156,66 @@ static struct pci_raw_ops pci_mmcfg = {
   21.55 -    Normally this can be expressed in the MCFG by not listing them
   21.56 -    and assigning suitable _SEGs, but this isn't implemented in some BIOS.
   21.57 -    Instead try to discover all devices on bus 0 that are unreachable using MM
   21.58 --   and fallback for them.
   21.59 --   We only do this for bus 0/seg 0 */
   21.60 -+   and fallback for them. */
   21.61 - static __init void unreachable_devices(void)
   21.62 - {
   21.63 --	int i;
   21.64 -+	int i, k;
   21.65 - 	unsigned long flags;
   21.66 - 
   21.67 --	for (i = 0; i < 32; i++) {
   21.68 --		u32 val1;
   21.69 --		u32 addr;
   21.70 -+	for (k = 0; k < MAX_CHECK_BUS; k++) {
   21.71 -+		for (i = 0; i < 32; i++) {
   21.72 -+			u32 val1;
   21.73 -+			u32 addr;
   21.74 -+
   21.75 -+			pci_conf1_read(0, k, PCI_DEVFN(i, 0), 0, 4, &val1);
   21.76 -+			if (val1 == 0xffffffff)
   21.77 -+				continue;
   21.78 -+
   21.79 -+			/* Locking probably not needed, but safer */
   21.80 -+			spin_lock_irqsave(&pci_config_lock, flags);
   21.81 -+			addr = get_base_addr(0, k, PCI_DEVFN(i, 0));
   21.82 -+			if (addr != 0)
   21.83 -+				pci_exp_set_dev_base(addr, k, PCI_DEVFN(i, 0));
   21.84 -+			if (addr == 0 ||
   21.85 -+			    readl((u32 __iomem *)mmcfg_virt_addr) != val1) {
   21.86 -+				set_bit(i, fallback_slots);
   21.87 -+				printk(KERN_NOTICE
   21.88 -+			"PCI: No mmconfig possible on %x:%x\n", k, i);
   21.89 -+			}
   21.90 -+			spin_unlock_irqrestore(&pci_config_lock, flags);
   21.91 -+		}
   21.92 -+	}
   21.93 -+}
   21.94 - 
   21.95 --		pci_conf1_read(0, 0, PCI_DEVFN(i, 0), 0, 4, &val1);
   21.96 --		if (val1 == 0xffffffff)
   21.97 -+/* NB. Ripped from arch/i386/kernel/setup.c for this Xen bugfix patch. */
   21.98 -+#ifdef CONFIG_XEN
   21.99 -+extern struct e820map machine_e820;
  21.100 -+#define e820 machine_e820
  21.101 -+#endif
  21.102 -+static int __init
  21.103 -+e820_all_mapped(unsigned long s, unsigned long e, unsigned type)
  21.104 -+{
  21.105 -+	u64 start = s;
  21.106 -+	u64 end = e;
  21.107 -+	int i;
  21.108 -+	for (i = 0; i < e820.nr_map; i++) {
  21.109 -+		struct e820entry *ei = &e820.map[i];
  21.110 -+		if (type && ei->type != type)
  21.111 - 			continue;
  21.112 --
  21.113 --		/* Locking probably not needed, but safer */
  21.114 --		spin_lock_irqsave(&pci_config_lock, flags);
  21.115 --		addr = get_base_addr(0, 0, PCI_DEVFN(i, 0));
  21.116 --		if (addr != 0)
  21.117 --			pci_exp_set_dev_base(addr, 0, PCI_DEVFN(i, 0));
  21.118 --		if (addr == 0 || readl((u32 __iomem *)mmcfg_virt_addr) != val1)
  21.119 --			set_bit(i, fallback_slots);
  21.120 --		spin_unlock_irqrestore(&pci_config_lock, flags);
  21.121 -+		/* is the region (part) in overlap with the current region ?*/
  21.122 -+		if (ei->addr >= end || ei->addr + ei->size <= start)
  21.123 -+			continue;
  21.124 -+		/* if the region is at the beginning of <start,end> we move
  21.125 -+		 * start to the end of the region since it's ok until there
  21.126 -+		 */
  21.127 -+		if (ei->addr <= start)
  21.128 -+			start = ei->addr + ei->size;
  21.129 -+		/* if start is now at or beyond end, we're done, full
  21.130 -+		 * coverage */
  21.131 -+		if (start >= end)
  21.132 -+			return 1; /* we're done */
  21.133 - 	}
  21.134 -+	return 0;
  21.135 - }
  21.136 - 
  21.137 - static int __init pci_mmcfg_init(void)
  21.138 -@@ -183,6 +229,15 @@ static int __init pci_mmcfg_init(void)
  21.139 - 	    (pci_mmcfg_config[0].base_address == 0))
  21.140 - 		goto out;
  21.141 - 
  21.142 -+	if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
  21.143 -+			pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN,
  21.144 -+			E820_RESERVED)) {
  21.145 -+		printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n",
  21.146 -+				pci_mmcfg_config[0].base_address);
  21.147 -+		printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
  21.148 -+		goto out;
  21.149 -+	}
  21.150 -+
  21.151 - 	printk(KERN_INFO "PCI: Using MMCONFIG\n");
  21.152 - 	raw_pci_ops = &pci_mmcfg;
  21.153 - 	pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
  21.154 -diff -pruN ../orig-linux-2.6.16.29/arch/x86_64/pci/mmconfig.c ./arch/x86_64/pci/mmconfig.c
  21.155 ---- ../orig-linux-2.6.16.29/arch/x86_64/pci/mmconfig.c	2006-09-12 19:02:10.000000000 +0100
  21.156 -+++ ./arch/x86_64/pci/mmconfig.c	2006-09-21 09:35:40.000000000 +0100
  21.157 -@@ -9,11 +9,19 @@
  21.158 - #include <linux/init.h>
  21.159 - #include <linux/acpi.h>
  21.160 - #include <linux/bitmap.h>
  21.161 -+#include <asm/e820.h>
  21.162 -+
  21.163 - #include "pci.h"
  21.164 - 
  21.165 --#define MMCONFIG_APER_SIZE (256*1024*1024)
  21.166 -+/* aperture is up to 256MB but BIOS may reserve less */
  21.167 -+#define MMCONFIG_APER_MIN	(2 * 1024*1024)
  21.168 -+#define MMCONFIG_APER_MAX	(256 * 1024*1024)
  21.169 -+
  21.170 -+/* Verify the first 16 busses. We assume that systems with more busses
  21.171 -+   get MCFG right. */
  21.172 -+#define MAX_CHECK_BUS 16
  21.173 - 
  21.174 --static DECLARE_BITMAP(fallback_slots, 32);
  21.175 -+static DECLARE_BITMAP(fallback_slots, 32*MAX_CHECK_BUS);
  21.176 - 
  21.177 - /* Static virtual mapping of the MMCONFIG aperture */
  21.178 - struct mmcfg_virt {
  21.179 -@@ -55,7 +63,8 @@ static char __iomem *get_virt(unsigned i
  21.180 - static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
  21.181 - {
  21.182 - 	char __iomem *addr;
  21.183 --	if (seg == 0 && bus == 0 && test_bit(PCI_SLOT(devfn), &fallback_slots))
  21.184 -+	if (seg == 0 && bus < MAX_CHECK_BUS &&
  21.185 -+		test_bit(32*bus + PCI_SLOT(devfn), fallback_slots))
  21.186 - 		return NULL;
  21.187 - 	addr = get_virt(seg, bus);
  21.188 - 	if (!addr)
  21.189 -@@ -69,8 +78,10 @@ static int pci_mmcfg_read(unsigned int s
  21.190 - 	char __iomem *addr;
  21.191 - 
  21.192 - 	/* Why do we have this when nobody checks it. How about a BUG()!? -AK */
  21.193 --	if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095)))
  21.194 -+	if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) {
  21.195 -+		*value = -1;
  21.196 - 		return -EINVAL;
  21.197 -+	}
  21.198 - 
  21.199 - 	addr = pci_dev_base(seg, bus, devfn);
  21.200 - 	if (!addr)
  21.201 -@@ -129,23 +140,56 @@ static struct pci_raw_ops pci_mmcfg = {
  21.202 -    Normally this can be expressed in the MCFG by not listing them
  21.203 -    and assigning suitable _SEGs, but this isn't implemented in some BIOS.
  21.204 -    Instead try to discover all devices on bus 0 that are unreachable using MM
  21.205 --   and fallback for them.
  21.206 --   We only do this for bus 0/seg 0 */
  21.207 -+   and fallback for them. */
  21.208 - static __init void unreachable_devices(void)
  21.209 - {
  21.210 --	int i;
  21.211 --	for (i = 0; i < 32; i++) {
  21.212 --		u32 val1;
  21.213 --		char __iomem *addr;
  21.214 -+	int i, k;
  21.215 -+	/* Use the max bus number from ACPI here? */
  21.216 -+	for (k = 0; k < MAX_CHECK_BUS; k++) {
  21.217 -+		for (i = 0; i < 32; i++) {
  21.218 -+			u32 val1;
  21.219 -+			char __iomem *addr;
  21.220 -+
  21.221 -+			pci_conf1_read(0, k, PCI_DEVFN(i,0), 0, 4, &val1);
  21.222 -+			if (val1 == 0xffffffff)
  21.223 -+				continue;
  21.224 -+			addr = pci_dev_base(0, k, PCI_DEVFN(i, 0));
  21.225 -+			if (addr == NULL|| readl(addr) != val1) {
  21.226 -+				set_bit(i + 32*k, fallback_slots);
  21.227 -+				printk(KERN_NOTICE
  21.228 -+				"PCI: No mmconfig possible on device %x:%x\n",
  21.229 -+					k, i);
  21.230 -+			}
  21.231 -+		}
  21.232 -+	}
  21.233 -+}
  21.234 - 
  21.235 --		pci_conf1_read(0, 0, PCI_DEVFN(i,0), 0, 4, &val1);
  21.236 --		if (val1 == 0xffffffff)
  21.237 -+/* NB. Ripped from arch/x86_64/kernel/e820.c for this Xen bugfix patch. */
  21.238 -+#ifdef CONFIG_XEN
  21.239 -+extern struct e820map machine_e820;
  21.240 -+#define e820 machine_e820
  21.241 -+#endif
  21.242 -+static int __init e820_all_mapped(unsigned long start, unsigned long end, unsigned type)
  21.243 -+{
  21.244 -+	int i;
  21.245 -+	for (i = 0; i < e820.nr_map; i++) {
  21.246 -+		struct e820entry *ei = &e820.map[i];
  21.247 -+		if (type && ei->type != type)
  21.248 - 			continue;
  21.249 --		addr = pci_dev_base(0, 0, PCI_DEVFN(i, 0));
  21.250 --		if (addr == NULL|| readl(addr) != val1) {
  21.251 --			set_bit(i, &fallback_slots);
  21.252 --		}
  21.253 -+		/* is the region (part) in overlap with the current region ?*/
  21.254 -+		if (ei->addr >= end || ei->addr + ei->size <= start)
  21.255 -+			continue;
  21.256 -+
  21.257 -+		/* if the region is at the beginning of <start,end> we move
  21.258 -+		 * start to the end of the region since it's ok until there
  21.259 -+		 */
  21.260 -+		if (ei->addr <= start)
  21.261 -+			start = ei->addr + ei->size;
  21.262 -+		/* if start is now at or beyond end, we're done, full coverage */
  21.263 -+		if (start >= end)
  21.264 -+			return 1; /* we're done */
  21.265 - 	}
  21.266 -+	return 0;
  21.267 - }
  21.268 - 
  21.269 - static int __init pci_mmcfg_init(void)
  21.270 -@@ -161,6 +205,15 @@ static int __init pci_mmcfg_init(void)
  21.271 - 	    (pci_mmcfg_config[0].base_address == 0))
  21.272 - 		return 0;
  21.273 - 
  21.274 -+	if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
  21.275 -+			pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN,
  21.276 -+			E820_RESERVED)) {
  21.277 -+		printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n",
  21.278 -+				pci_mmcfg_config[0].base_address);
  21.279 -+		printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
  21.280 -+		return 0;
  21.281 -+	}
  21.282 -+
  21.283 - 	/* RED-PEN i386 doesn't do _nocache right now */
  21.284 - 	pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL);
  21.285 - 	if (pci_mmcfg_virt == NULL) {
  21.286 -@@ -169,7 +222,8 @@ static int __init pci_mmcfg_init(void)
  21.287 - 	}
  21.288 - 	for (i = 0; i < pci_mmcfg_config_num; ++i) {
  21.289 - 		pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i];
  21.290 --		pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address, MMCONFIG_APER_SIZE);
  21.291 -+		pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address,
  21.292 -+							 MMCONFIG_APER_MAX);
  21.293 - 		if (!pci_mmcfg_virt[i].virt) {
  21.294 - 			printk("PCI: Cannot map mmconfig aperture for segment %d\n",
  21.295 - 			       pci_mmcfg_config[i].pci_segment_group_number);
    22.1 --- a/patches/linux-2.6.16.32/pmd-shared.patch	Wed Nov 29 11:05:02 2006 -0700
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,111 +0,0 @@
    22.4 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/mm/pageattr.c ./arch/i386/mm/pageattr.c
    22.5 ---- ../orig-linux-2.6.16.29/arch/i386/mm/pageattr.c	2006-09-12 19:02:10.000000000 +0100
    22.6 -+++ ./arch/i386/mm/pageattr.c	2006-09-19 14:05:35.000000000 +0100
    22.7 -@@ -78,7 +78,7 @@ static void set_pmd_pte(pte_t *kpte, uns
    22.8 - 	unsigned long flags;
    22.9 - 
   22.10 - 	set_pte_atomic(kpte, pte); 	/* change init_mm */
   22.11 --	if (PTRS_PER_PMD > 1)
   22.12 -+	if (HAVE_SHARED_KERNEL_PMD)
   22.13 - 		return;
   22.14 - 
   22.15 - 	spin_lock_irqsave(&pgd_lock, flags);
   22.16 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/mm/pgtable.c ./arch/i386/mm/pgtable.c
   22.17 ---- ../orig-linux-2.6.16.29/arch/i386/mm/pgtable.c	2006-09-12 19:02:10.000000000 +0100
   22.18 -+++ ./arch/i386/mm/pgtable.c	2006-09-19 14:05:35.000000000 +0100
   22.19 -@@ -215,9 +215,10 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
   22.20 - 		spin_lock_irqsave(&pgd_lock, flags);
   22.21 - 	}
   22.22 - 
   22.23 --	clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
   22.24 --			swapper_pg_dir + USER_PTRS_PER_PGD,
   22.25 --			KERNEL_PGD_PTRS);
   22.26 -+	if (PTRS_PER_PMD == 1 || HAVE_SHARED_KERNEL_PMD)
   22.27 -+		clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
   22.28 -+				swapper_pg_dir + USER_PTRS_PER_PGD,
   22.29 -+				KERNEL_PGD_PTRS);
   22.30 - 	if (PTRS_PER_PMD > 1)
   22.31 - 		return;
   22.32 - 
   22.33 -@@ -249,6 +250,30 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
   22.34 - 			goto out_oom;
   22.35 - 		set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
   22.36 - 	}
   22.37 -+
   22.38 -+	if (!HAVE_SHARED_KERNEL_PMD) {
   22.39 -+		unsigned long flags;
   22.40 -+
   22.41 -+		for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   22.42 -+			pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
   22.43 -+			if (!pmd)
   22.44 -+				goto out_oom;
   22.45 -+			set_pgd(&pgd[USER_PTRS_PER_PGD], __pgd(1 + __pa(pmd)));
   22.46 -+		}
   22.47 -+
   22.48 -+		spin_lock_irqsave(&pgd_lock, flags);
   22.49 -+		for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   22.50 -+			unsigned long v = (unsigned long)i << PGDIR_SHIFT;
   22.51 -+			pgd_t *kpgd = pgd_offset_k(v);
   22.52 -+			pud_t *kpud = pud_offset(kpgd, v);
   22.53 -+			pmd_t *kpmd = pmd_offset(kpud, v);
   22.54 -+			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   22.55 -+			memcpy(pmd, kpmd, PAGE_SIZE);
   22.56 -+		}
   22.57 -+		pgd_list_add(pgd);
   22.58 -+		spin_unlock_irqrestore(&pgd_lock, flags);
   22.59 -+	}
   22.60 -+
   22.61 - 	return pgd;
   22.62 - 
   22.63 - out_oom:
   22.64 -@@ -263,9 +288,23 @@ void pgd_free(pgd_t *pgd)
   22.65 - 	int i;
   22.66 - 
   22.67 - 	/* in the PAE case user pgd entries are overwritten before usage */
   22.68 --	if (PTRS_PER_PMD > 1)
   22.69 --		for (i = 0; i < USER_PTRS_PER_PGD; ++i)
   22.70 --			kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1));
   22.71 -+	if (PTRS_PER_PMD > 1) {
   22.72 -+		for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
   22.73 -+			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   22.74 -+			kmem_cache_free(pmd_cache, pmd);
   22.75 -+		}
   22.76 -+		if (!HAVE_SHARED_KERNEL_PMD) {
   22.77 -+			unsigned long flags;
   22.78 -+			spin_lock_irqsave(&pgd_lock, flags);
   22.79 -+			pgd_list_del(pgd);
   22.80 -+			spin_unlock_irqrestore(&pgd_lock, flags);
   22.81 -+			for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   22.82 -+				pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   22.83 -+				memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
   22.84 -+				kmem_cache_free(pmd_cache, pmd);
   22.85 -+			}
   22.86 -+		}
   22.87 -+	}
   22.88 - 	/* in the non-PAE case, free_pgtables() clears user pgd entries */
   22.89 - 	kmem_cache_free(pgd_cache, pgd);
   22.90 - }
   22.91 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/pgtable-2level-defs.h ./include/asm-i386/pgtable-2level-defs.h
   22.92 ---- ../orig-linux-2.6.16.29/include/asm-i386/pgtable-2level-defs.h	2006-09-12 19:02:10.000000000 +0100
   22.93 -+++ ./include/asm-i386/pgtable-2level-defs.h	2006-09-19 14:05:35.000000000 +0100
   22.94 -@@ -1,6 +1,8 @@
   22.95 - #ifndef _I386_PGTABLE_2LEVEL_DEFS_H
   22.96 - #define _I386_PGTABLE_2LEVEL_DEFS_H
   22.97 - 
   22.98 -+#define HAVE_SHARED_KERNEL_PMD 0
   22.99 -+
  22.100 - /*
  22.101 -  * traditional i386 two-level paging structure:
  22.102 -  */
  22.103 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/pgtable-3level-defs.h ./include/asm-i386/pgtable-3level-defs.h
  22.104 ---- ../orig-linux-2.6.16.29/include/asm-i386/pgtable-3level-defs.h	2006-09-12 19:02:10.000000000 +0100
  22.105 -+++ ./include/asm-i386/pgtable-3level-defs.h	2006-09-19 14:05:35.000000000 +0100
  22.106 -@@ -1,6 +1,8 @@
  22.107 - #ifndef _I386_PGTABLE_3LEVEL_DEFS_H
  22.108 - #define _I386_PGTABLE_3LEVEL_DEFS_H
  22.109 - 
  22.110 -+#define HAVE_SHARED_KERNEL_PMD 1
  22.111 -+
  22.112 - /*
  22.113 -  * PGDIR_SHIFT determines what a top-level page table entry can map
  22.114 -  */
    23.1 --- a/patches/linux-2.6.16.32/rcu_needs_cpu.patch	Wed Nov 29 11:05:02 2006 -0700
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,35 +0,0 @@
    23.4 -diff -pruN ../orig-linux-2.6.16.29/include/linux/rcupdate.h ./include/linux/rcupdate.h
    23.5 ---- ../orig-linux-2.6.16.29/include/linux/rcupdate.h	2006-09-12 19:02:10.000000000 +0100
    23.6 -+++ ./include/linux/rcupdate.h	2006-09-19 14:05:39.000000000 +0100
    23.7 -@@ -134,6 +134,7 @@ static inline void rcu_bh_qsctr_inc(int 
    23.8 - }
    23.9 - 
   23.10 - extern int rcu_pending(int cpu);
   23.11 -+extern int rcu_needs_cpu(int cpu);
   23.12 - 
   23.13 - /**
   23.14 -  * rcu_read_lock - mark the beginning of an RCU read-side critical section.
   23.15 -diff -pruN ../orig-linux-2.6.16.29/kernel/rcupdate.c ./kernel/rcupdate.c
   23.16 ---- ../orig-linux-2.6.16.29/kernel/rcupdate.c	2006-09-12 19:02:10.000000000 +0100
   23.17 -+++ ./kernel/rcupdate.c	2006-09-19 14:05:39.000000000 +0100
   23.18 -@@ -485,6 +485,20 @@ int rcu_pending(int cpu)
   23.19 - 		__rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));
   23.20 - }
   23.21 - 
   23.22 -+/*
   23.23 -+ * Check to see if any future RCU-related work will need to be done
   23.24 -+ * by the current CPU, even if none need be done immediately, returning
   23.25 -+ * 1 if so.  This function is part of the RCU implementation; it is -not-
   23.26 -+ * an exported member of the RCU API.
   23.27 -+ */
   23.28 -+int rcu_needs_cpu(int cpu)
   23.29 -+{
   23.30 -+	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
   23.31 -+	struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu);
   23.32 -+
   23.33 -+	return (!!rdp->curlist || !!rdp_bh->curlist || rcu_pending(cpu));
   23.34 -+}
   23.35 -+
   23.36 - void rcu_check_callbacks(int cpu, int user)
   23.37 - {
   23.38 - 	if (user || 
    24.1 --- a/patches/linux-2.6.16.32/rename-TSS_sysenter_esp0-SYSENTER_stack_esp0.patch	Wed Nov 29 11:05:02 2006 -0700
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,30 +0,0 @@
    24.4 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/entry.S ./arch/i386/kernel/entry.S
    24.5 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/entry.S	2006-09-12 19:02:10.000000000 +0100
    24.6 -+++ ./arch/i386/kernel/entry.S	2006-09-19 14:05:44.000000000 +0100
    24.7 -@@ -177,7 +177,7 @@ need_resched:
    24.8 - 
    24.9 - 	# sysenter call handler stub
   24.10 - ENTRY(sysenter_entry)
   24.11 --	movl TSS_sysenter_esp0(%esp),%esp
   24.12 -+	movl SYSENTER_stack_esp0(%esp),%esp
   24.13 - sysenter_past_esp:
   24.14 - 	sti
   24.15 - 	pushl $(__USER_DS)
   24.16 -@@ -492,7 +492,7 @@ device_not_available_emulate:
   24.17 -  * that sets up the real kernel stack. Check here, since we can't
   24.18 -  * allow the wrong stack to be used.
   24.19 -  *
   24.20 -- * "TSS_sysenter_esp0+12" is because the NMI/debug handler will have
   24.21 -+ * "SYSENTER_stack_esp0+12" is because the NMI/debug handler will have
   24.22 -  * already pushed 3 words if it hits on the sysenter instruction:
   24.23 -  * eflags, cs and eip.
   24.24 -  *
   24.25 -@@ -504,7 +504,7 @@ device_not_available_emulate:
   24.26 - 	cmpw $__KERNEL_CS,4(%esp);		\
   24.27 - 	jne ok;					\
   24.28 - label:						\
   24.29 --	movl TSS_sysenter_esp0+offset(%esp),%esp;	\
   24.30 -+	movl SYSENTER_stack_esp0+offset(%esp),%esp;	\
   24.31 - 	pushfl;					\
   24.32 - 	pushl $__KERNEL_CS;			\
   24.33 - 	pushl $sysenter_past_esp
    25.1 --- a/patches/linux-2.6.16.32/series	Wed Nov 29 11:05:02 2006 -0700
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,27 +0,0 @@
    25.4 -blktap-aio-16_03_06.patch
    25.5 -device_bind.patch
    25.6 -fix-hz-suspend.patch
    25.7 -fix-ide-cd-pio-mode.patch
    25.8 -i386-mach-io-check-nmi.patch
    25.9 -ipv6-no-autoconf.patch
   25.10 -net-csum.patch
   25.11 -net-gso-0-base.patch
   25.12 -net-gso-1-check-dodgy.patch
   25.13 -net-gso-2-checksum-fix.patch
   25.14 -net-gso-3-fix-errorcheck.patch
   25.15 -net-gso-4-kill-warnon.patch
   25.16 -net-gso-5-rcv-mss.patch
   25.17 -pci-mmconfig-fix-from-2.6.17.patch
   25.18 -pmd-shared.patch
   25.19 -rcu_needs_cpu.patch
   25.20 -rename-TSS_sysenter_esp0-SYSENTER_stack_esp0.patch
   25.21 -smp-alts.patch
   25.22 -tpm_plugin_2.6.17.patch
   25.23 -x86-increase-interrupt-vector-range.patch
   25.24 -xen-hotplug.patch
   25.25 -xenoprof-generic.patch
   25.26 -x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch
   25.27 -x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch
   25.28 -x86-elfnote-as-preprocessor-macro.patch
   25.29 -vsnprintf.patch
   25.30 -kasprintf.patch
    26.1 --- a/patches/linux-2.6.16.32/smp-alts.patch	Wed Nov 29 11:05:02 2006 -0700
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,591 +0,0 @@
    26.4 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/Kconfig ./arch/i386/Kconfig
    26.5 ---- ../orig-linux-2.6.16.29/arch/i386/Kconfig	2006-09-12 19:02:10.000000000 +0100
    26.6 -+++ ./arch/i386/Kconfig	2006-09-19 14:05:48.000000000 +0100
    26.7 -@@ -202,6 +202,19 @@ config SMP
    26.8 - 
    26.9 - 	  If you don't know what to do here, say N.
   26.10 - 
   26.11 -+config SMP_ALTERNATIVES
   26.12 -+	bool "SMP alternatives support (EXPERIMENTAL)"
   26.13 -+	depends on SMP && EXPERIMENTAL
   26.14 -+	help
   26.15 -+	  Try to reduce the overhead of running an SMP kernel on a uniprocessor
   26.16 -+	  host slightly by replacing certain key instruction sequences
   26.17 -+	  according to whether we currently have more than one CPU available.
   26.18 -+	  This should provide a noticeable boost to performance when
   26.19 -+	  running SMP kernels on UP machines, and have negligible impact
   26.20 -+	  when running on an true SMP host.
   26.21 -+
   26.22 -+          If unsure, say N.
   26.23 -+	  
   26.24 - config NR_CPUS
   26.25 - 	int "Maximum number of CPUs (2-255)"
   26.26 - 	range 2 255
   26.27 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/Makefile ./arch/i386/kernel/Makefile
   26.28 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/Makefile	2006-09-12 19:02:10.000000000 +0100
   26.29 -+++ ./arch/i386/kernel/Makefile	2006-09-19 14:05:48.000000000 +0100
   26.30 -@@ -37,6 +37,7 @@ obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
   26.31 - obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault.o
   26.32 - obj-$(CONFIG_VM86)		+= vm86.o
   26.33 - obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
   26.34 -+obj-$(CONFIG_SMP_ALTERNATIVES)  += smpalts.o
   26.35 - 
   26.36 - EXTRA_AFLAGS   := -traditional
   26.37 - 
   26.38 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/smpalts.c ./arch/i386/kernel/smpalts.c
   26.39 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/smpalts.c	1970-01-01 01:00:00.000000000 +0100
   26.40 -+++ ./arch/i386/kernel/smpalts.c	2006-09-19 14:05:48.000000000 +0100
   26.41 -@@ -0,0 +1,85 @@
   26.42 -+#include <linux/kernel.h>
   26.43 -+#include <asm/system.h>
   26.44 -+#include <asm/smp_alt.h>
   26.45 -+#include <asm/processor.h>
   26.46 -+#include <asm/string.h>
   26.47 -+
   26.48 -+struct smp_replacement_record {
   26.49 -+	unsigned char targ_size;
   26.50 -+	unsigned char smp1_size;
   26.51 -+	unsigned char smp2_size;
   26.52 -+	unsigned char up_size;
   26.53 -+	unsigned char feature;
   26.54 -+	unsigned char data[0];
   26.55 -+};
   26.56 -+
   26.57 -+struct smp_alternative_record {
   26.58 -+	void *targ_start;
   26.59 -+	struct smp_replacement_record *repl;
   26.60 -+};
   26.61 -+
   26.62 -+extern struct smp_alternative_record __start_smp_alternatives_table,
   26.63 -+  __stop_smp_alternatives_table;
   26.64 -+extern unsigned long __init_begin, __init_end;
   26.65 -+
   26.66 -+void prepare_for_smp(void)
   26.67 -+{
   26.68 -+	struct smp_alternative_record *r;
   26.69 -+	printk(KERN_INFO "Enabling SMP...\n");
   26.70 -+	for (r = &__start_smp_alternatives_table;
   26.71 -+	     r != &__stop_smp_alternatives_table;
   26.72 -+	     r++) {
   26.73 -+		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
   26.74 -+		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
   26.75 -+		BUG_ON(r->repl->targ_size < r->repl->up_size);
   26.76 -+               if (system_state == SYSTEM_RUNNING &&
   26.77 -+                   r->targ_start >= (void *)&__init_begin &&
   26.78 -+                   r->targ_start < (void *)&__init_end)
   26.79 -+                       continue;
   26.80 -+		if (r->repl->feature != (unsigned char)-1 &&
   26.81 -+		    boot_cpu_has(r->repl->feature)) {
   26.82 -+			memcpy(r->targ_start,
   26.83 -+			       r->repl->data + r->repl->smp1_size,
   26.84 -+			       r->repl->smp2_size);
   26.85 -+			memset(r->targ_start + r->repl->smp2_size,
   26.86 -+			       0x90,
   26.87 -+			       r->repl->targ_size - r->repl->smp2_size);
   26.88 -+		} else {
   26.89 -+			memcpy(r->targ_start,
   26.90 -+			       r->repl->data,
   26.91 -+			       r->repl->smp1_size);
   26.92 -+			memset(r->targ_start + r->repl->smp1_size,
   26.93 -+			       0x90,
   26.94 -+			       r->repl->targ_size - r->repl->smp1_size);
   26.95 -+		}
   26.96 -+	}
   26.97 -+	/* Paranoia */
   26.98 -+	asm volatile ("jmp 1f\n1:");
   26.99 -+	mb();
  26.100 -+}
  26.101 -+
  26.102 -+void unprepare_for_smp(void)
  26.103 -+{
  26.104 -+	struct smp_alternative_record *r;
  26.105 -+	printk(KERN_INFO "Disabling SMP...\n");
  26.106 -+	for (r = &__start_smp_alternatives_table;
  26.107 -+	     r != &__stop_smp_alternatives_table;
  26.108 -+	     r++) {
  26.109 -+		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
  26.110 -+		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
  26.111 -+		BUG_ON(r->repl->targ_size < r->repl->up_size);
  26.112 -+               if (system_state == SYSTEM_RUNNING &&
  26.113 -+                   r->targ_start >= (void *)&__init_begin &&
  26.114 -+                   r->targ_start < (void *)&__init_end)
  26.115 -+                       continue;
  26.116 -+		memcpy(r->targ_start,
  26.117 -+		       r->repl->data + r->repl->smp1_size + r->repl->smp2_size,
  26.118 -+		       r->repl->up_size);
  26.119 -+		memset(r->targ_start + r->repl->up_size,
  26.120 -+		       0x90,
  26.121 -+		       r->repl->targ_size - r->repl->up_size);
  26.122 -+	}
  26.123 -+	/* Paranoia */
  26.124 -+	asm volatile ("jmp 1f\n1:");
  26.125 -+	mb();
  26.126 -+}
  26.127 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/smpboot.c ./arch/i386/kernel/smpboot.c
  26.128 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/smpboot.c	2006-09-12 19:02:10.000000000 +0100
  26.129 -+++ ./arch/i386/kernel/smpboot.c	2006-09-19 14:05:48.000000000 +0100
  26.130 -@@ -1218,6 +1218,11 @@ static void __init smp_boot_cpus(unsigne
  26.131 - 		if (max_cpus <= cpucount+1)
  26.132 - 			continue;
  26.133 - 
  26.134 -+#ifdef CONFIG_SMP_ALTERNATIVES
  26.135 -+		if (kicked == 1)
  26.136 -+			prepare_for_smp();
  26.137 -+#endif
  26.138 -+
  26.139 - 		if (((cpu = alloc_cpu_id()) <= 0) || do_boot_cpu(apicid, cpu))
  26.140 - 			printk("CPU #%d not responding - cannot use it.\n",
  26.141 - 								apicid);
  26.142 -@@ -1396,6 +1401,11 @@ int __devinit __cpu_up(unsigned int cpu)
  26.143 - 		return -EIO;
  26.144 - 	}
  26.145 - 
  26.146 -+#ifdef CONFIG_SMP_ALTERNATIVES
  26.147 -+	if (num_online_cpus() == 1)
  26.148 -+		prepare_for_smp();
  26.149 -+#endif
  26.150 -+
  26.151 - 	local_irq_enable();
  26.152 - 	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
  26.153 - 	/* Unleash the CPU! */
  26.154 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/vmlinux.lds.S ./arch/i386/kernel/vmlinux.lds.S
  26.155 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/vmlinux.lds.S	2006-09-12 19:02:10.000000000 +0100
  26.156 -+++ ./arch/i386/kernel/vmlinux.lds.S	2006-09-19 14:05:48.000000000 +0100
  26.157 -@@ -34,6 +34,13 @@ SECTIONS
  26.158 -   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
  26.159 -   __stop___ex_table = .;
  26.160 - 
  26.161 -+  . = ALIGN(16);
  26.162 -+  __start_smp_alternatives_table = .;
  26.163 -+  __smp_alternatives : { *(__smp_alternatives) }
  26.164 -+  __stop_smp_alternatives_table = .;
  26.165 -+
  26.166 -+  __smp_replacements : { *(__smp_replacements) }
  26.167 -+
  26.168 -   RODATA
  26.169 - 
  26.170 -   /* writeable */
  26.171 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/atomic.h ./include/asm-i386/atomic.h
  26.172 ---- ../orig-linux-2.6.16.29/include/asm-i386/atomic.h	2006-09-12 19:02:10.000000000 +0100
  26.173 -+++ ./include/asm-i386/atomic.h	2006-09-19 14:05:48.000000000 +0100
  26.174 -@@ -4,18 +4,13 @@
  26.175 - #include <linux/config.h>
  26.176 - #include <linux/compiler.h>
  26.177 - #include <asm/processor.h>
  26.178 -+#include <asm/smp_alt.h>
  26.179 - 
  26.180 - /*
  26.181 -  * Atomic operations that C can't guarantee us.  Useful for
  26.182 -  * resource counting etc..
  26.183 -  */
  26.184 - 
  26.185 --#ifdef CONFIG_SMP
  26.186 --#define LOCK "lock ; "
  26.187 --#else
  26.188 --#define LOCK ""
  26.189 --#endif
  26.190 --
  26.191 - /*
  26.192 -  * Make sure gcc doesn't try to be clever and move things around
  26.193 -  * on us. We need to use _exactly_ the address the user gave us,
  26.194 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/bitops.h ./include/asm-i386/bitops.h
  26.195 ---- ../orig-linux-2.6.16.29/include/asm-i386/bitops.h	2006-09-12 19:02:10.000000000 +0100
  26.196 -+++ ./include/asm-i386/bitops.h	2006-09-19 14:05:48.000000000 +0100
  26.197 -@@ -7,6 +7,7 @@
  26.198 - 
  26.199 - #include <linux/config.h>
  26.200 - #include <linux/compiler.h>
  26.201 -+#include <asm/smp_alt.h>
  26.202 - 
  26.203 - /*
  26.204 -  * These have to be done with inline assembly: that way the bit-setting
  26.205 -@@ -16,12 +17,6 @@
  26.206 -  * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
  26.207 -  */
  26.208 - 
  26.209 --#ifdef CONFIG_SMP
  26.210 --#define LOCK_PREFIX "lock ; "
  26.211 --#else
  26.212 --#define LOCK_PREFIX ""
  26.213 --#endif
  26.214 --
  26.215 - #define ADDR (*(volatile long *) addr)
  26.216 - 
  26.217 - /**
  26.218 -@@ -41,7 +36,7 @@
  26.219 -  */
  26.220 - static inline void set_bit(int nr, volatile unsigned long * addr)
  26.221 - {
  26.222 --	__asm__ __volatile__( LOCK_PREFIX
  26.223 -+	__asm__ __volatile__( LOCK
  26.224 - 		"btsl %1,%0"
  26.225 - 		:"+m" (ADDR)
  26.226 - 		:"Ir" (nr));
  26.227 -@@ -76,7 +71,7 @@ static inline void __set_bit(int nr, vol
  26.228 -  */
  26.229 - static inline void clear_bit(int nr, volatile unsigned long * addr)
  26.230 - {
  26.231 --	__asm__ __volatile__( LOCK_PREFIX
  26.232 -+	__asm__ __volatile__( LOCK
  26.233 - 		"btrl %1,%0"
  26.234 - 		:"+m" (ADDR)
  26.235 - 		:"Ir" (nr));
  26.236 -@@ -121,7 +116,7 @@ static inline void __change_bit(int nr, 
  26.237 -  */
  26.238 - static inline void change_bit(int nr, volatile unsigned long * addr)
  26.239 - {
  26.240 --	__asm__ __volatile__( LOCK_PREFIX
  26.241 -+	__asm__ __volatile__( LOCK
  26.242 - 		"btcl %1,%0"
  26.243 - 		:"+m" (ADDR)
  26.244 - 		:"Ir" (nr));
  26.245 -@@ -140,7 +135,7 @@ static inline int test_and_set_bit(int n
  26.246 - {
  26.247 - 	int oldbit;
  26.248 - 
  26.249 --	__asm__ __volatile__( LOCK_PREFIX
  26.250 -+	__asm__ __volatile__( LOCK
  26.251 - 		"btsl %2,%1\n\tsbbl %0,%0"
  26.252 - 		:"=r" (oldbit),"+m" (ADDR)
  26.253 - 		:"Ir" (nr) : "memory");
  26.254 -@@ -180,7 +175,7 @@ static inline int test_and_clear_bit(int
  26.255 - {
  26.256 - 	int oldbit;
  26.257 - 
  26.258 --	__asm__ __volatile__( LOCK_PREFIX
  26.259 -+	__asm__ __volatile__( LOCK
  26.260 - 		"btrl %2,%1\n\tsbbl %0,%0"
  26.261 - 		:"=r" (oldbit),"+m" (ADDR)
  26.262 - 		:"Ir" (nr) : "memory");
  26.263 -@@ -231,7 +226,7 @@ static inline int test_and_change_bit(in
  26.264 - {
  26.265 - 	int oldbit;
  26.266 - 
  26.267 --	__asm__ __volatile__( LOCK_PREFIX
  26.268 -+	__asm__ __volatile__( LOCK
  26.269 - 		"btcl %2,%1\n\tsbbl %0,%0"
  26.270 - 		:"=r" (oldbit),"+m" (ADDR)
  26.271 - 		:"Ir" (nr) : "memory");
  26.272 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/futex.h ./include/asm-i386/futex.h
  26.273 ---- ../orig-linux-2.6.16.29/include/asm-i386/futex.h	2006-09-12 19:02:10.000000000 +0100
  26.274 -+++ ./include/asm-i386/futex.h	2006-09-19 14:05:48.000000000 +0100
  26.275 -@@ -28,7 +28,7 @@
  26.276 - "1:	movl	%2, %0\n\
  26.277 - 	movl	%0, %3\n"					\
  26.278 - 	insn "\n"						\
  26.279 --"2:	" LOCK_PREFIX "cmpxchgl %3, %2\n\
  26.280 -+"2:	" LOCK "cmpxchgl %3, %2\n\
  26.281 - 	jnz	1b\n\
  26.282 - 3:	.section .fixup,\"ax\"\n\
  26.283 - 4:	mov	%5, %1\n\
  26.284 -@@ -68,7 +68,7 @@ futex_atomic_op_inuser (int encoded_op, 
  26.285 - #endif
  26.286 - 		switch (op) {
  26.287 - 		case FUTEX_OP_ADD:
  26.288 --			__futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret,
  26.289 -+			__futex_atomic_op1(LOCK "xaddl %0, %2", ret,
  26.290 - 					   oldval, uaddr, oparg);
  26.291 - 			break;
  26.292 - 		case FUTEX_OP_OR:
  26.293 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/rwsem.h ./include/asm-i386/rwsem.h
  26.294 ---- ../orig-linux-2.6.16.29/include/asm-i386/rwsem.h	2006-09-12 19:02:10.000000000 +0100
  26.295 -+++ ./include/asm-i386/rwsem.h	2006-09-19 14:05:48.000000000 +0100
  26.296 -@@ -40,6 +40,7 @@
  26.297 - 
  26.298 - #include <linux/list.h>
  26.299 - #include <linux/spinlock.h>
  26.300 -+#include <asm/smp_alt.h>
  26.301 - 
  26.302 - struct rwsem_waiter;
  26.303 - 
  26.304 -@@ -99,7 +100,7 @@ static inline void __down_read(struct rw
  26.305 - {
  26.306 - 	__asm__ __volatile__(
  26.307 - 		"# beginning down_read\n\t"
  26.308 --LOCK_PREFIX	"  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
  26.309 -+LOCK	        "  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
  26.310 - 		"  js        2f\n\t" /* jump if we weren't granted the lock */
  26.311 - 		"1:\n\t"
  26.312 - 		LOCK_SECTION_START("")
  26.313 -@@ -130,7 +131,7 @@ static inline int __down_read_trylock(st
  26.314 - 		"  movl	     %1,%2\n\t"
  26.315 - 		"  addl      %3,%2\n\t"
  26.316 - 		"  jle	     2f\n\t"
  26.317 --LOCK_PREFIX	"  cmpxchgl  %2,%0\n\t"
  26.318 -+LOCK	        "  cmpxchgl  %2,%0\n\t"
  26.319 - 		"  jnz	     1b\n\t"
  26.320 - 		"2:\n\t"
  26.321 - 		"# ending __down_read_trylock\n\t"
  26.322 -@@ -150,7 +151,7 @@ static inline void __down_write(struct r
  26.323 - 	tmp = RWSEM_ACTIVE_WRITE_BIAS;
  26.324 - 	__asm__ __volatile__(
  26.325 - 		"# beginning down_write\n\t"
  26.326 --LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
  26.327 -+LOCK	        "  xadd      %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
  26.328 - 		"  testl     %%edx,%%edx\n\t" /* was the count 0 before? */
  26.329 - 		"  jnz       2f\n\t" /* jump if we weren't granted the lock */
  26.330 - 		"1:\n\t"
  26.331 -@@ -188,7 +189,7 @@ static inline void __up_read(struct rw_s
  26.332 - 	__s32 tmp = -RWSEM_ACTIVE_READ_BIAS;
  26.333 - 	__asm__ __volatile__(
  26.334 - 		"# beginning __up_read\n\t"
  26.335 --LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
  26.336 -+LOCK	        "  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
  26.337 - 		"  js        2f\n\t" /* jump if the lock is being waited upon */
  26.338 - 		"1:\n\t"
  26.339 - 		LOCK_SECTION_START("")
  26.340 -@@ -214,7 +215,7 @@ static inline void __up_write(struct rw_
  26.341 - 	__asm__ __volatile__(
  26.342 - 		"# beginning __up_write\n\t"
  26.343 - 		"  movl      %2,%%edx\n\t"
  26.344 --LOCK_PREFIX	"  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
  26.345 -+LOCK	        "  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
  26.346 - 		"  jnz       2f\n\t" /* jump if the lock is being waited upon */
  26.347 - 		"1:\n\t"
  26.348 - 		LOCK_SECTION_START("")
  26.349 -@@ -239,7 +240,7 @@ static inline void __downgrade_write(str
  26.350 - {
  26.351 - 	__asm__ __volatile__(
  26.352 - 		"# beginning __downgrade_write\n\t"
  26.353 --LOCK_PREFIX	"  addl      %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
  26.354 -+LOCK	        "  addl      %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
  26.355 - 		"  js        2f\n\t" /* jump if the lock is being waited upon */
  26.356 - 		"1:\n\t"
  26.357 - 		LOCK_SECTION_START("")
  26.358 -@@ -263,7 +264,7 @@ LOCK_PREFIX	"  addl      %2,(%%eax)\n\t"
  26.359 - static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
  26.360 - {
  26.361 - 	__asm__ __volatile__(
  26.362 --LOCK_PREFIX	"addl %1,%0"
  26.363 -+LOCK	          "addl %1,%0"
  26.364 - 		: "=m"(sem->count)
  26.365 - 		: "ir"(delta), "m"(sem->count));
  26.366 - }
  26.367 -@@ -276,7 +277,7 @@ static inline int rwsem_atomic_update(in
  26.368 - 	int tmp = delta;
  26.369 - 
  26.370 - 	__asm__ __volatile__(
  26.371 --LOCK_PREFIX	"xadd %0,(%2)"
  26.372 -+LOCK  	          "xadd %0,(%2)"
  26.373 - 		: "+r"(tmp), "=m"(sem->count)
  26.374 - 		: "r"(sem), "m"(sem->count)
  26.375 - 		: "memory");
  26.376 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/smp_alt.h ./include/asm-i386/smp_alt.h
  26.377 ---- ../orig-linux-2.6.16.29/include/asm-i386/smp_alt.h	1970-01-01 01:00:00.000000000 +0100
  26.378 -+++ ./include/asm-i386/smp_alt.h	2006-09-19 14:05:48.000000000 +0100
  26.379 -@@ -0,0 +1,32 @@
  26.380 -+#ifndef __ASM_SMP_ALT_H__
  26.381 -+#define __ASM_SMP_ALT_H__
  26.382 -+
  26.383 -+#include <linux/config.h>
  26.384 -+
  26.385 -+#ifdef CONFIG_SMP
  26.386 -+#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE)
  26.387 -+#define LOCK \
  26.388 -+        "6677: nop\n" \
  26.389 -+	".section __smp_alternatives,\"a\"\n" \
  26.390 -+	".long 6677b\n" \
  26.391 -+	".long 6678f\n" \
  26.392 -+	".previous\n" \
  26.393 -+	".section __smp_replacements,\"a\"\n" \
  26.394 -+	"6678: .byte 1\n" \
  26.395 -+	".byte 1\n" \
  26.396 -+	".byte 0\n" \
  26.397 -+        ".byte 1\n" \
  26.398 -+	".byte -1\n" \
  26.399 -+	"lock\n" \
  26.400 -+	"nop\n" \
  26.401 -+	".previous\n"
  26.402 -+void prepare_for_smp(void);
  26.403 -+void unprepare_for_smp(void);
  26.404 -+#else
  26.405 -+#define LOCK "lock ; "
  26.406 -+#endif
  26.407 -+#else
  26.408 -+#define LOCK ""
  26.409 -+#endif
  26.410 -+
  26.411 -+#endif /* __ASM_SMP_ALT_H__ */
  26.412 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/spinlock.h ./include/asm-i386/spinlock.h
  26.413 ---- ../orig-linux-2.6.16.29/include/asm-i386/spinlock.h	2006-09-12 19:02:10.000000000 +0100
  26.414 -+++ ./include/asm-i386/spinlock.h	2006-09-19 14:05:48.000000000 +0100
  26.415 -@@ -6,6 +6,7 @@
  26.416 - #include <asm/page.h>
  26.417 - #include <linux/config.h>
  26.418 - #include <linux/compiler.h>
  26.419 -+#include <asm/smp_alt.h>
  26.420 - 
  26.421 - /*
  26.422 -  * Your basic SMP spinlocks, allowing only a single CPU anywhere
  26.423 -@@ -23,7 +24,8 @@
  26.424 - 
  26.425 - #define __raw_spin_lock_string \
  26.426 - 	"\n1:\t" \
  26.427 --	"lock ; decb %0\n\t" \
  26.428 -+	LOCK \
  26.429 -+	"decb %0\n\t" \
  26.430 - 	"jns 3f\n" \
  26.431 - 	"2:\t" \
  26.432 - 	"rep;nop\n\t" \
  26.433 -@@ -34,7 +36,8 @@
  26.434 - 
  26.435 - #define __raw_spin_lock_string_flags \
  26.436 - 	"\n1:\t" \
  26.437 --	"lock ; decb %0\n\t" \
  26.438 -+	LOCK \
  26.439 -+	"decb %0\n\t" \
  26.440 - 	"jns 4f\n\t" \
  26.441 - 	"2:\t" \
  26.442 - 	"testl $0x200, %1\n\t" \
  26.443 -@@ -65,10 +68,34 @@ static inline void __raw_spin_lock_flags
  26.444 - static inline int __raw_spin_trylock(raw_spinlock_t *lock)
  26.445 - {
  26.446 - 	char oldval;
  26.447 -+#ifdef CONFIG_SMP_ALTERNATIVES
  26.448 - 	__asm__ __volatile__(
  26.449 --		"xchgb %b0,%1"
  26.450 -+		"1:movb %1,%b0\n"
  26.451 -+		"movb $0,%1\n"
  26.452 -+		"2:"
  26.453 -+		".section __smp_alternatives,\"a\"\n"
  26.454 -+		".long 1b\n"
  26.455 -+		".long 3f\n"
  26.456 -+		".previous\n"
  26.457 -+		".section __smp_replacements,\"a\"\n"
  26.458 -+		"3: .byte 2b - 1b\n"
  26.459 -+		".byte 5f-4f\n"
  26.460 -+		".byte 0\n"
  26.461 -+		".byte 6f-5f\n"
  26.462 -+		".byte -1\n"
  26.463 -+		"4: xchgb %b0,%1\n"
  26.464 -+		"5: movb %1,%b0\n"
  26.465 -+		"movb $0,%1\n"
  26.466 -+		"6:\n"
  26.467 -+		".previous\n"
  26.468 - 		:"=q" (oldval), "=m" (lock->slock)
  26.469 - 		:"0" (0) : "memory");
  26.470 -+#else
  26.471 -+	__asm__ __volatile__(
  26.472 -+		"xchgb %b0,%1\n"
  26.473 -+		:"=q" (oldval), "=m" (lock->slock)
  26.474 -+		:"0" (0) : "memory");
  26.475 -+#endif
  26.476 - 	return oldval > 0;
  26.477 - }
  26.478 - 
  26.479 -@@ -178,12 +205,12 @@ static inline int __raw_write_trylock(ra
  26.480 - 
  26.481 - static inline void __raw_read_unlock(raw_rwlock_t *rw)
  26.482 - {
  26.483 --	asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory");
  26.484 -+	asm volatile(LOCK "incl %0" :"=m" (rw->lock) : : "memory");
  26.485 - }
  26.486 - 
  26.487 - static inline void __raw_write_unlock(raw_rwlock_t *rw)
  26.488 - {
  26.489 --	asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0"
  26.490 -+	asm volatile(LOCK "addl $" RW_LOCK_BIAS_STR ", %0"
  26.491 - 				 : "=m" (rw->lock) : : "memory");
  26.492 - }
  26.493 - 
  26.494 -diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/system.h ./include/asm-i386/system.h
  26.495 ---- ../orig-linux-2.6.16.29/include/asm-i386/system.h	2006-09-12 19:02:10.000000000 +0100
  26.496 -+++ ./include/asm-i386/system.h	2006-09-19 14:05:48.000000000 +0100
  26.497 -@@ -5,7 +5,7 @@
  26.498 - #include <linux/kernel.h>
  26.499 - #include <asm/segment.h>
  26.500 - #include <asm/cpufeature.h>
  26.501 --#include <linux/bitops.h> /* for LOCK_PREFIX */
  26.502 -+#include <asm/smp_alt.h>
  26.503 - 
  26.504 - #ifdef __KERNEL__
  26.505 - 
  26.506 -@@ -271,19 +271,19 @@ static inline unsigned long __cmpxchg(vo
  26.507 - 	unsigned long prev;
  26.508 - 	switch (size) {
  26.509 - 	case 1:
  26.510 --		__asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
  26.511 -+		__asm__ __volatile__(LOCK "cmpxchgb %b1,%2"
  26.512 - 				     : "=a"(prev)
  26.513 - 				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
  26.514 - 				     : "memory");
  26.515 - 		return prev;
  26.516 - 	case 2:
  26.517 --		__asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
  26.518 -+		__asm__ __volatile__(LOCK "cmpxchgw %w1,%2"
  26.519 - 				     : "=a"(prev)
  26.520 - 				     : "r"(new), "m"(*__xg(ptr)), "0"(old)
  26.521 - 				     : "memory");
  26.522 - 		return prev;
  26.523 - 	case 4:
  26.524 --		__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
  26.525 -+		__asm__ __volatile__(LOCK "cmpxchgl %1,%2"
  26.526 - 				     : "=a"(prev)
  26.527 - 				     : "r"(new), "m"(*__xg(ptr)), "0"(old)
  26.528 - 				     : "memory");
  26.529 -@@ -336,7 +336,7 @@ static inline unsigned long long __cmpxc
  26.530 - 				      unsigned long long new)
  26.531 - {
  26.532 - 	unsigned long long prev;
  26.533 --	__asm__ __volatile__(LOCK_PREFIX "cmpxchg8b %3"
  26.534 -+	__asm__ __volatile__(LOCK "cmpxchg8b %3"
  26.535 - 			     : "=A"(prev)
  26.536 - 			     : "b"((unsigned long)new),
  26.537 - 			       "c"((unsigned long)(new >> 32)),
  26.538 -@@ -503,11 +503,55 @@ struct alt_instr { 
  26.539 - #endif
  26.540 - 
  26.541 - #ifdef CONFIG_SMP
  26.542 -+#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE)
  26.543 -+#define smp_alt_mb(instr)                                           \
  26.544 -+__asm__ __volatile__("6667:\nnop\nnop\nnop\nnop\nnop\nnop\n6668:\n" \
  26.545 -+		     ".section __smp_alternatives,\"a\"\n"          \
  26.546 -+		     ".long 6667b\n"                                \
  26.547 -+                     ".long 6673f\n"                                \
  26.548 -+		     ".previous\n"                                  \
  26.549 -+		     ".section __smp_replacements,\"a\"\n"          \
  26.550 -+		     "6673:.byte 6668b-6667b\n"                     \
  26.551 -+		     ".byte 6670f-6669f\n"                          \
  26.552 -+		     ".byte 6671f-6670f\n"                          \
  26.553 -+                     ".byte 0\n"                                    \
  26.554 -+		     ".byte %c0\n"                                  \
  26.555 -+		     "6669:lock;addl $0,0(%%esp)\n"                 \
  26.556 -+		     "6670:" instr "\n"                             \
  26.557 -+		     "6671:\n"                                      \
  26.558 -+		     ".previous\n"                                  \
  26.559 -+		     :                                              \
  26.560 -+		     : "i" (X86_FEATURE_XMM2)                       \
  26.561 -+		     : "memory")
  26.562 -+#define smp_rmb() smp_alt_mb("lfence")
  26.563 -+#define smp_mb()  smp_alt_mb("mfence")
  26.564 -+#define set_mb(var, value) do {                                     \
  26.565 -+unsigned long __set_mb_temp;                                        \
  26.566 -+__asm__ __volatile__("6667:movl %1, %0\n6668:\n"                    \
  26.567 -+		     ".section __smp_alternatives,\"a\"\n"          \
  26.568 -+		     ".long 6667b\n"                                \
  26.569 -+		     ".long 6673f\n"                                \
  26.570 -+		     ".previous\n"                                  \
  26.571 -+		     ".section __smp_replacements,\"a\"\n"          \
  26.572 -+		     "6673: .byte 6668b-6667b\n"                    \
  26.573 -+		     ".byte 6670f-6669f\n"                          \
  26.574 -+		     ".byte 0\n"                                    \
  26.575 -+		     ".byte 6671f-6670f\n"                          \
  26.576 -+		     ".byte -1\n"                                   \
  26.577 -+		     "6669: xchg %1, %0\n"                          \
  26.578 -+		     "6670:movl %1, %0\n"                           \
  26.579 -+		     "6671:\n"                                      \
  26.580 -+		     ".previous\n"                                  \
  26.581 -+		     : "=m" (var), "=r" (__set_mb_temp)             \
  26.582 -+		     : "1" (value)                                  \
  26.583 -+		     : "memory"); } while (0)
  26.584 -+#else
  26.585 - #define smp_mb()	mb()
  26.586 - #define smp_rmb()	rmb()
  26.587 -+#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
  26.588 -+#endif
  26.589 - #define smp_wmb()	wmb()
  26.590 - #define smp_read_barrier_depends()	read_barrier_depends()
  26.591 --#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
  26.592 - #else
  26.593 - #define smp_mb()	barrier()
  26.594 - #define smp_rmb()	barrier()
    27.1 --- a/patches/linux-2.6.16.32/tpm_plugin_2.6.17.patch	Wed Nov 29 11:05:02 2006 -0700
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,1545 +0,0 @@
    27.4 -diff -pruN ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_atmel.c ./drivers/char/tpm/tpm_atmel.c
    27.5 ---- ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_atmel.c	2006-09-12 19:02:10.000000000 +0100
    27.6 -+++ ./drivers/char/tpm/tpm_atmel.c	2006-09-19 14:05:52.000000000 +0100
    27.7 -@@ -47,12 +47,12 @@ static int tpm_atml_recv(struct tpm_chip
    27.8 - 		return -EIO;
    27.9 - 
   27.10 - 	for (i = 0; i < 6; i++) {
   27.11 --		status = ioread8(chip->vendor->iobase + 1);
   27.12 -+		status = ioread8(chip->vendor.iobase + 1);
   27.13 - 		if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
   27.14 - 			dev_err(chip->dev, "error reading header\n");
   27.15 - 			return -EIO;
   27.16 - 		}
   27.17 --		*buf++ = ioread8(chip->vendor->iobase);
   27.18 -+		*buf++ = ioread8(chip->vendor.iobase);
   27.19 - 	}
   27.20 - 
   27.21 - 	/* size of the data received */
   27.22 -@@ -63,7 +63,7 @@ static int tpm_atml_recv(struct tpm_chip
   27.23 - 		dev_err(chip->dev,
   27.24 - 			"Recv size(%d) less than available space\n", size);
   27.25 - 		for (; i < size; i++) {	/* clear the waiting data anyway */
   27.26 --			status = ioread8(chip->vendor->iobase + 1);
   27.27 -+			status = ioread8(chip->vendor.iobase + 1);
   27.28 - 			if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
   27.29 - 				dev_err(chip->dev, "error reading data\n");
   27.30 - 				return -EIO;
   27.31 -@@ -74,16 +74,16 @@ static int tpm_atml_recv(struct tpm_chip
   27.32 - 
   27.33 - 	/* read all the data available */
   27.34 - 	for (; i < size; i++) {
   27.35 --		status = ioread8(chip->vendor->iobase + 1);
   27.36 -+		status = ioread8(chip->vendor.iobase + 1);
   27.37 - 		if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
   27.38 - 			dev_err(chip->dev, "error reading data\n");
   27.39 - 			return -EIO;
   27.40 - 		}
   27.41 --		*buf++ = ioread8(chip->vendor->iobase);
   27.42 -+		*buf++ = ioread8(chip->vendor.iobase);
   27.43 - 	}
   27.44 - 
   27.45 - 	/* make sure data available is gone */
   27.46 --	status = ioread8(chip->vendor->iobase + 1);
   27.47 -+	status = ioread8(chip->vendor.iobase + 1);
   27.48 - 
   27.49 - 	if (status & ATML_STATUS_DATA_AVAIL) {
   27.50 - 		dev_err(chip->dev, "data available is stuck\n");
   27.51 -@@ -100,7 +100,7 @@ static int tpm_atml_send(struct tpm_chip
   27.52 - 	dev_dbg(chip->dev, "tpm_atml_send:\n");
   27.53 - 	for (i = 0; i < count; i++) {
   27.54 - 		dev_dbg(chip->dev, "%d 0x%x(%d)\n",  i, buf[i], buf[i]);
   27.55 -- 		iowrite8(buf[i], chip->vendor->iobase);
   27.56 -+ 		iowrite8(buf[i], chip->vendor.iobase);
   27.57 - 	}
   27.58 - 
   27.59 - 	return count;
   27.60 -@@ -108,12 +108,12 @@ static int tpm_atml_send(struct tpm_chip
   27.61 - 
   27.62 - static void tpm_atml_cancel(struct tpm_chip *chip)
   27.63 - {
   27.64 --	iowrite8(ATML_STATUS_ABORT, chip->vendor->iobase + 1);
   27.65 -+	iowrite8(ATML_STATUS_ABORT, chip->vendor.iobase + 1);
   27.66 - }
   27.67 - 
   27.68 - static u8 tpm_atml_status(struct tpm_chip *chip)
   27.69 - {
   27.70 --	return ioread8(chip->vendor->iobase + 1);
   27.71 -+	return ioread8(chip->vendor.iobase + 1);
   27.72 - }
   27.73 - 
   27.74 - static struct file_operations atmel_ops = {
   27.75 -@@ -140,7 +140,7 @@ static struct attribute* atmel_attrs[] =
   27.76 - 
   27.77 - static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs };
   27.78 - 
   27.79 --static struct tpm_vendor_specific tpm_atmel = {
   27.80 -+static const struct tpm_vendor_specific tpm_atmel = {
   27.81 - 	.recv = tpm_atml_recv,
   27.82 - 	.send = tpm_atml_send,
   27.83 - 	.cancel = tpm_atml_cancel,
   27.84 -@@ -159,10 +159,10 @@ static void atml_plat_remove(void)
   27.85 - 	struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);
   27.86 - 
   27.87 - 	if (chip) {
   27.88 --		if (chip->vendor->have_region)
   27.89 --			atmel_release_region(chip->vendor->base,
   27.90 --					     chip->vendor->region_size);
   27.91 --		atmel_put_base_addr(chip->vendor);
   27.92 -+		if (chip->vendor.have_region)
   27.93 -+			atmel_release_region(chip->vendor.base,
   27.94 -+					     chip->vendor.region_size);
   27.95 -+		atmel_put_base_addr(chip->vendor.iobase);
   27.96 - 		tpm_remove_hardware(chip->dev);
   27.97 - 		platform_device_unregister(pdev);
   27.98 - 	}
   27.99 -@@ -179,18 +179,22 @@ static struct device_driver atml_drv = {
  27.100 - static int __init init_atmel(void)
  27.101 - {
  27.102 - 	int rc = 0;
  27.103 -+	void __iomem *iobase = NULL;
  27.104 -+	int have_region, region_size;
  27.105 -+	unsigned long base;
  27.106 -+	struct  tpm_chip *chip;
  27.107 - 
  27.108 - 	driver_register(&atml_drv);
  27.109 - 
  27.110 --	if ((tpm_atmel.iobase = atmel_get_base_addr(&tpm_atmel)) == NULL) {
  27.111 -+	if ((iobase = atmel_get_base_addr(&base, &region_size)) == NULL) {
  27.112 - 		rc = -ENODEV;
  27.113 - 		goto err_unreg_drv;
  27.114 - 	}
  27.115 - 
  27.116 --	tpm_atmel.have_region =
  27.117 -+	have_region =
  27.118 - 	    (atmel_request_region
  27.119 --	     (tpm_atmel.base, tpm_atmel.region_size,
  27.120 --	      "tpm_atmel0") == NULL) ? 0 : 1;
  27.121 -+	     (tpm_atmel.base, region_size, "tpm_atmel0") == NULL) ? 0 : 1;
  27.122 -+
  27.123 - 
  27.124 - 	if (IS_ERR
  27.125 - 	    (pdev =
  27.126 -@@ -199,17 +203,25 @@ static int __init init_atmel(void)
  27.127 - 		goto err_rel_reg;
  27.128 - 	}
  27.129 - 
  27.130 --	if ((rc = tpm_register_hardware(&pdev->dev, &tpm_atmel)) < 0)
  27.131 -+	if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_atmel))) {
  27.132 -+		rc = -ENODEV;
  27.133 - 		goto err_unreg_dev;
  27.134 -+	}
  27.135 -+
  27.136 -+	chip->vendor.iobase = iobase;
  27.137 -+	chip->vendor.base = base;
  27.138 -+	chip->vendor.have_region = have_region;
  27.139 -+	chip->vendor.region_size = region_size;
  27.140 -+
  27.141 - 	return 0;
  27.142 - 
  27.143 - err_unreg_dev:
  27.144 - 	platform_device_unregister(pdev);
  27.145 - err_rel_reg:
  27.146 --	atmel_put_base_addr(&tpm_atmel);
  27.147 --	if (tpm_atmel.have_region)
  27.148 --		atmel_release_region(tpm_atmel.base,
  27.149 --				     tpm_atmel.region_size);
  27.150 -+	atmel_put_base_addr(iobase);
  27.151 -+	if (have_region)
  27.152 -+		atmel_release_region(base,
  27.153 -+				     region_size);
  27.154 - err_unreg_drv:
  27.155 - 	driver_unregister(&atml_drv);
  27.156 - 	return rc;
  27.157 -diff -pruN ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_atmel.h ./drivers/char/tpm/tpm_atmel.h
  27.158 ---- ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_atmel.h	2006-09-12 19:02:10.000000000 +0100
  27.159 -+++ ./drivers/char/tpm/tpm_atmel.h	2006-09-19 14:05:52.000000000 +0100
  27.160 -@@ -28,13 +28,12 @@
  27.161 - #define atmel_request_region request_mem_region
  27.162 - #define atmel_release_region release_mem_region
  27.163 - 
  27.164 --static inline void atmel_put_base_addr(struct tpm_vendor_specific
  27.165 --					 *vendor)
  27.166 -+static inline void atmel_put_base_addr(void __iomem *iobase)
  27.167 - {
  27.168 --	iounmap(vendor->iobase);
  27.169 -+	iounmap(iobase);
  27.170 - }
  27.171 - 
  27.172 --static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific *vendor)
  27.173 -+static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size)
  27.174 - {
  27.175 - 	struct device_node *dn;
  27.176 - 	unsigned long address, size;
  27.177 -@@ -71,9 +70,9 @@ static void __iomem * atmel_get_base_add
  27.178 - 	else
  27.179 - 		size = reg[naddrc];
  27.180 - 
  27.181 --	vendor->base = address;
  27.182 --	vendor->region_size = size;
  27.183 --	return ioremap(vendor->base, vendor->region_size);
  27.184 -+	*base = address;
  27.185 -+	*region_size = size;
  27.186 -+	return ioremap(*base, *region_size);
  27.187 - }
  27.188 - #else
  27.189 - #define atmel_getb(chip, offset) inb(chip->vendor->base + offset)
  27.190 -@@ -106,14 +105,12 @@ static int atmel_verify_tpm11(void)
  27.191 - 	return 0;
  27.192 - }
  27.193 - 
  27.194 --static inline void atmel_put_base_addr(struct tpm_vendor_specific
  27.195 --					 *vendor)
  27.196 -+static inline void atmel_put_base_addr(void __iomem *iobase)
  27.197 - {
  27.198 - }
  27.199 - 
  27.200 - /* Determine where to talk to device */
  27.201 --static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific
  27.202 --					 *vendor)
  27.203 -+static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size)
  27.204 - {
  27.205 - 	int lo, hi;
  27.206 - 
  27.207 -@@ -123,9 +120,9 @@ static void __iomem * atmel_get_base_add
  27.208 - 	lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO);
  27.209 - 	hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI);
  27.210 - 
  27.211 --	vendor->base = (hi << 8) | lo;
  27.212 --	vendor->region_size = 2;
  27.213 -+	*base = (hi << 8) | lo;
  27.214 -+	*region_size = 2;
  27.215 - 
  27.216 --	return ioport_map(vendor->base, vendor->region_size);
  27.217 -+	return ioport_map(*base, *region_size);
  27.218 - }
  27.219 - #endif
  27.220 -diff -pruN ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_bios.c ./drivers/char/tpm/tpm_bios.c
  27.221 ---- ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_bios.c	2006-09-12 19:02:10.000000000 +0100
  27.222 -+++ ./drivers/char/tpm/tpm_bios.c	2006-09-19 14:05:52.000000000 +0100
  27.223 -@@ -29,6 +29,11 @@
  27.224 - #define MAX_TEXT_EVENT		1000	/* Max event string length */
  27.225 - #define ACPI_TCPA_SIG		"TCPA"	/* 0x41504354 /'TCPA' */
  27.226 - 
  27.227 -+enum bios_platform_class {
  27.228 -+	BIOS_CLIENT = 0x00,
  27.229 -+	BIOS_SERVER = 0x01,
  27.230 -+};
  27.231 -+
  27.232 - struct tpm_bios_log {
  27.233 - 	void *bios_event_log;
  27.234 - 	void *bios_event_log_end;
  27.235 -@@ -36,9 +41,18 @@ struct tpm_bios_log {
  27.236 - 
  27.237 - struct acpi_tcpa {
  27.238 - 	struct acpi_table_header hdr;
  27.239 --	u16 reserved;
  27.240 --	u32 log_max_len __attribute__ ((packed));
  27.241 --	u32 log_start_addr __attribute__ ((packed));
  27.242 -+	u16 platform_class;
  27.243 -+	union {
  27.244 -+		struct client_hdr {
  27.245 -+			u32 log_max_len __attribute__ ((packed));
  27.246 -+			u64 log_start_addr __attribute__ ((packed));
  27.247 -+		} client;
  27.248 -+		struct server_hdr {
  27.249 -+			u16 reserved;
  27.250 -+			u64 log_max_len __attribute__ ((packed));
  27.251 -+			u64 log_start_addr __attribute__ ((packed));
  27.252 -+		} server;
  27.253 -+	};
  27.254 - };
  27.255 - 
  27.256 - struct tcpa_event {
  27.257 -@@ -91,6 +105,12 @@ static const char* tcpa_event_type_strin
  27.258 - 	"Non-Host Info"
  27.259 - };
  27.260 - 
  27.261 -+struct tcpa_pc_event {
  27.262 -+	u32 event_id;
  27.263 -+	u32 event_size;
  27.264 -+	u8 event_data[0];
  27.265 -+};
  27.266 -+
  27.267 - enum tcpa_pc_event_ids {
  27.268 - 	SMBIOS = 1,
  27.269 - 	BIS_CERT,
  27.270 -@@ -100,14 +120,15 @@ enum tcpa_pc_event_ids {
  27.271 - 	NVRAM,
  27.272 - 	OPTION_ROM_EXEC,
  27.273 - 	OPTION_ROM_CONFIG,
  27.274 --	OPTION_ROM_MICROCODE,
  27.275 -+	OPTION_ROM_MICROCODE = 10,
  27.276 - 	S_CRTM_VERSION,
  27.277 - 	S_CRTM_CONTENTS,
  27.278 - 	POST_CONTENTS,
  27.279 -+	HOST_TABLE_OF_DEVICES,
  27.280 - };
  27.281 - 
  27.282 - static const char* tcpa_pc_event_id_strings[] = {
  27.283 --	""
  27.284 -+	"",
  27.285 - 	"SMBIOS",
  27.286 - 	"BIS Certificate",
  27.287 - 	"POST BIOS ",
  27.288 -@@ -116,10 +137,12 @@ static const char* tcpa_pc_event_id_stri
  27.289 - 	"NVRAM",
  27.290 - 	"Option ROM",
  27.291 - 	"Option ROM config",
  27.292 --	"Option ROM microcode",
  27.293 -+	"",
  27.294 -+	"Option ROM microcode ",
  27.295 - 	"S-CRTM Version",
  27.296 --	"S-CRTM Contents",
  27.297 --	"S-CRTM POST Contents",
  27.298 -+	"S-CRTM Contents ",
  27.299 -+	"POST Contents ",
  27.300 -+	"Table of Devices",
  27.301 - };
  27.302 - 
  27.303 - /* returns pointer to start of pos. entry of tcg log */
  27.304 -@@ -191,7 +214,7 @@ static int get_event_name(char *dest, st
  27.305 - 	const char *name = "";
  27.306 - 	char data[40] = "";
  27.307 - 	int i, n_len = 0, d_len = 0;
  27.308 --	u32 event_id;
  27.309 -+	struct tcpa_pc_event *pc_event;
  27.310 - 
  27.311 - 	switch(event->event_type) {
  27.312 - 	case PREBOOT:
  27.313 -@@ -220,31 +243,32 @@ static int get_event_name(char *dest, st
  27.314 - 		}
  27.315 - 		break;
  27.316 - 	case EVENT_TAG:
  27.317 --		event_id = be32_to_cpu(*((u32 *)event_entry));
  27.318 -+		pc_event = (struct tcpa_pc_event *)event_entry;
  27.319 - 
  27.320 - 		/* ToDo Row data -> Base64 */
  27.321 - 
  27.322 --		switch (event_id) {
  27.323 -+		switch (pc_event->event_id) {
  27.324 - 		case SMBIOS:
  27.325 - 		case BIS_CERT:
  27.326 - 		case CMOS:
  27.327 - 		case NVRAM:
  27.328 - 		case OPTION_ROM_EXEC:
  27.329 - 		case OPTION_ROM_CONFIG:
  27.330 --		case OPTION_ROM_MICROCODE:
  27.331 - 		case S_CRTM_VERSION:
  27.332 --		case S_CRTM_CONTENTS:
  27.333 --		case POST_CONTENTS:
  27.334 --			name = tcpa_pc_event_id_strings[event_id];
  27.335 -+			name = tcpa_pc_event_id_strings[pc_event->event_id];
  27.336 - 			n_len = strlen(name);
  27.337 - 			break;
  27.338 -+		/* hash data */
  27.339 - 		case POST_BIOS_ROM:
  27.340 - 		case ESCD:
  27.341 --			name = tcpa_pc_event_id_strings[event_id];
  27.342 -+		case OPTION_ROM_MICROCODE:
  27.343 -+		case S_CRTM_CONTENTS:
  27.344 -+		case POST_CONTENTS:
  27.345 -+			name = tcpa_pc_event_id_strings[pc_event->event_id];
  27.346 - 			n_len = strlen(name);
  27.347 - 			for (i = 0; i < 20; i++)
  27.348 --				d_len += sprintf(data, "%02x",
  27.349 --						event_entry[8 + i]);
  27.350 -+				d_len += sprintf(&data[2*i], "%02x",
  27.351 -+						pc_event->event_data[i]);
  27.352 - 			break;
  27.353 - 		default:
  27.354 - 			break;
  27.355 -@@ -260,52 +284,13 @@ static int get_event_name(char *dest, st
  27.356 - 
  27.357 - static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
  27.358 - {
  27.359 -+	struct tcpa_event *event = v;
  27.360 -+	char *data = v;
  27.361 -+	int i;
  27.362 - 
  27.363 --	char *eventname;
  27.364 --	char data[4];
  27.365 --	u32 help;
  27.366 --	int i, len;
  27.367 --	struct tcpa_event *event = (struct tcpa_event *) v;
  27.368 --	unsigned char *event_entry =
  27.369 --	    (unsigned char *) (v + sizeof(struct tcpa_event));
  27.370 --
  27.371 --	eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
  27.372 --	if (!eventname) {
  27.373 --		printk(KERN_ERR "%s: ERROR - No Memory for event name\n ",
  27.374 --		       __func__);
  27.375 --		return -ENOMEM;
  27.376 --	}
  27.377 --
  27.378 --	/* 1st: PCR used is in little-endian format (4 bytes) */
  27.379 --	help = le32_to_cpu(event->pcr_index);
  27.380 --	memcpy(data, &help, 4);
  27.381 --	for (i = 0; i < 4; i++)
  27.382 --		seq_putc(m, data[i]);
  27.383 --
  27.384 --	/* 2nd: SHA1 (20 bytes) */
  27.385 --	for (i = 0; i < 20; i++)
  27.386 --		seq_putc(m, event->pcr_value[i]);
  27.387 --
  27.388 --	/* 3rd: event type identifier (4 bytes) */
  27.389 --	help = le32_to_cpu(event->event_type);
  27.390 --	memcpy(data, &help, 4);
  27.391 --	for (i = 0; i < 4; i++)
  27.392 -+	for (i = 0; i < sizeof(struct tcpa_event) + event->event_size; i++)
  27.393 - 		seq_putc(m, data[i]);
  27.394 - 
  27.395 --	len = 0;
  27.396 --
  27.397 --	len += get_event_name(eventname, event, event_entry);
  27.398 --
  27.399 --	/* 4th:  filename <= 255 + \'0' delimiter */
  27.400 --	if (len > TCG_EVENT_NAME_LEN_MAX)
  27.401 --		len = TCG_EVENT_NAME_LEN_MAX;
  27.402 --
  27.403 --	for (i = 0; i < len; i++)
  27.404 --		seq_putc(m, eventname[i]);
  27.405 --
  27.406 --	/* 5th: delimiter */
  27.407 --	seq_putc(m, '\0');
  27.408 --
  27.409 - 	return 0;
  27.410 - }
  27.411 - 
  27.412 -@@ -353,6 +338,7 @@ static int tpm_ascii_bios_measurements_s
  27.413 - 	/* 4th: eventname <= max + \'0' delimiter */
  27.414 - 	seq_printf(m, " %s\n", eventname);
  27.415 - 
  27.416 -+	kfree(eventname);
  27.417 - 	return 0;
  27.418 - }
  27.419 - 
  27.420 -@@ -376,6 +362,7 @@ static int read_log(struct tpm_bios_log 
  27.421 - 	struct acpi_tcpa *buff;
  27.422 - 	acpi_status status;
  27.423 - 	struct acpi_table_header *virt;
  27.424 -+	u64 len, start;
  27.425 - 
  27.426 - 	if (log->bios_event_log != NULL) {
  27.427 - 		printk(KERN_ERR
  27.428 -@@ -396,27 +383,37 @@ static int read_log(struct tpm_bios_log 
  27.429 - 		return -EIO;
  27.430 - 	}
  27.431 - 
  27.432 --	if (buff->log_max_len == 0) {
  27.433 -+	switch(buff->platform_class) {
  27.434 -+	case BIOS_SERVER:
  27.435 -+		len = buff->server.log_max_len;
  27.436 -+		start = buff->server.log_start_addr;
  27.437 -+		break;
  27.438 -+	case BIOS_CLIENT:
  27.439 -+	default:
  27.440 -+		len = buff->client.log_max_len;
  27.441 -+		start = buff->client.log_start_addr;
  27.442 -+		break;
  27.443 -+	}
  27.444 -+	if (!len) {
  27.445 - 		printk(KERN_ERR "%s: ERROR - TCPA log area empty\n", __func__);
  27.446 - 		return -EIO;
  27.447 - 	}
  27.448 - 
  27.449 - 	/* malloc EventLog space */
  27.450 --	log->bios_event_log = kmalloc(buff->log_max_len, GFP_KERNEL);
  27.451 -+	log->bios_event_log = kmalloc(len, GFP_KERNEL);
  27.452 - 	if (!log->bios_event_log) {
  27.453 --		printk
  27.454 --		    ("%s: ERROR - Not enough  Memory for BIOS measurements\n",
  27.455 --		     __func__);
  27.456 -+		printk("%s: ERROR - Not enough  Memory for BIOS measurements\n",
  27.457 -+			__func__);
  27.458 - 		return -ENOMEM;
  27.459 - 	}
  27.460 - 
  27.461 --	log->bios_event_log_end = log->bios_event_log + buff->log_max_len;
  27.462 -+	log->bios_event_log_end = log->bios_event_log + len;
  27.463 - 
  27.464 --	acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, (void *) &virt);
  27.465 -+	acpi_os_map_memory(start, len, (void *) &virt);
  27.466 - 
  27.467 --	memcpy(log->bios_event_log, virt, buff->log_max_len);
  27.468 -+	memcpy(log->bios_event_log, virt, len);
  27.469 - 
  27.470 --	acpi_os_unmap_memory(virt, buff->log_max_len);
  27.471 -+	acpi_os_unmap_memory(virt, len);
  27.472 - 	return 0;
  27.473 - }
  27.474 - 
  27.475 -diff -pruN ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_infineon.c ./drivers/char/tpm/tpm_infineon.c
  27.476 ---- ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_infineon.c	2006-09-12 19:02:10.000000000 +0100
  27.477 -+++ ./drivers/char/tpm/tpm_infineon.c	2006-09-19 14:05:52.000000000 +0100
  27.478 -@@ -15,6 +15,7 @@
  27.479 -  * License.
  27.480 -  */
  27.481 - 
  27.482 -+#include <linux/init.h>
  27.483 - #include <linux/pnp.h>
  27.484 - #include "tpm.h"
  27.485 - 
  27.486 -@@ -104,7 +105,7 @@ static int empty_fifo(struct tpm_chip *c
  27.487 - 
  27.488 - 	if (clear_wrfifo) {
  27.489 - 		for (i = 0; i < 4096; i++) {
  27.490 --			status = inb(chip->vendor->base + WRFIFO);
  27.491 -+			status = inb(chip->vendor.base + WRFIFO);
  27.492 - 			if (status == 0xff) {
  27.493 - 				if (check == 5)
  27.494 - 					break;
  27.495 -@@ -124,8 +125,8 @@ static int empty_fifo(struct tpm_chip *c
  27.496 - 	 */
  27.497 - 	i = 0;
  27.498 - 	do {
  27.499 --		status = inb(chip->vendor->base + RDFIFO);
  27.500 --		status = inb(chip->vendor->base + STAT);
  27.501 -+		status = inb(chip->vendor.base + RDFIFO);
  27.502 -+		status = inb(chip->vendor.base + STAT);
  27.503 - 		i++;
  27.504 - 		if (i == TPM_MAX_TRIES)
  27.505 - 			return -EIO;
  27.506 -@@ -138,7 +139,7 @@ static int wait(struct tpm_chip *chip, i
  27.507 - 	int status;
  27.508 - 	int i;
  27.509 - 	for (i = 0; i < TPM_MAX_TRIES; i++) {
  27.510 --		status = inb(chip->vendor->base + STAT);
  27.511 -+		status = inb(chip->vendor.base + STAT);
  27.512 - 		/* check the status-register if wait_for_bit is set */
  27.513 - 		if (status & 1 << wait_for_bit)
  27.514 - 			break;
  27.515 -@@ -157,7 +158,7 @@ static int wait(struct tpm_chip *chip, i
  27.516 - static void wait_and_send(struct tpm_chip *chip, u8 sendbyte)
  27.517 - {
  27.518 - 	wait(chip, STAT_XFE);
  27.519 --	outb(sendbyte, chip->vendor->base + WRFIFO);
  27.520 -+	outb(sendbyte, chip->vendor.base + WRFIFO);
  27.521 - }
  27.522 - 
  27.523 -     /* Note: WTX means Waiting-Time-Extension. Whenever the TPM needs more
  27.524 -@@ -204,7 +205,7 @@ recv_begin:
  27.525 - 		ret = wait(chip, STAT_RDA);
  27.526 - 		if (ret)
  27.527 - 			return -EIO;
  27.528 --		buf[i] = inb(chip->vendor->base + RDFIFO);
  27.529 -+		buf[i] = inb(chip->vendor.base + RDFIFO);
  27.530 - 	}
  27.531 - 
  27.532 - 	if (buf[0] != TPM_VL_VER) {
  27.533 -@@ -219,7 +220,7 @@ recv_begin:
  27.534 - 
  27.535 - 		for (i = 0; i < size; i++) {
  27.536 - 			wait(chip, STAT_RDA);
  27.537 --			buf[i] = inb(chip->vendor->base + RDFIFO);
  27.538 -+			buf[i] = inb(chip->vendor.base + RDFIFO);
  27.539 - 		}
  27.540 - 
  27.541 - 		if ((size == 0x6D00) && (buf[1] == 0x80)) {
  27.542 -@@ -268,7 +269,7 @@ static int tpm_inf_send(struct tpm_chip 
  27.543 - 	u8 count_high, count_low, count_4, count_3, count_2, count_1;
  27.544 - 
  27.545 - 	/* Disabling Reset, LP and IRQC */
  27.546 --	outb(RESET_LP_IRQC_DISABLE, chip->vendor->base + CMD);
  27.547 -+	outb(RESET_LP_IRQC_DISABLE, chip->vendor.base + CMD);
  27.548 - 
  27.549 - 	ret = empty_fifo(chip, 1);
  27.550 - 	if (ret) {
  27.551 -@@ -319,7 +320,7 @@ static void tpm_inf_cancel(struct tpm_ch
  27.552 - 
  27.553 - static u8 tpm_inf_status(struct tpm_chip *chip)
  27.554 - {
  27.555 --	return inb(chip->vendor->base + STAT);
  27.556 -+	return inb(chip->vendor.base + STAT);
  27.557 - }
  27.558 - 
  27.559 - static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
  27.560 -@@ -346,7 +347,7 @@ static struct file_operations inf_ops = 
  27.561 - 	.release = tpm_release,
  27.562 - };
  27.563 - 
  27.564 --static struct tpm_vendor_specific tpm_inf = {
  27.565 -+static const struct tpm_vendor_specific tpm_inf = {
  27.566 - 	.recv = tpm_inf_recv,
  27.567 - 	.send = tpm_inf_send,
  27.568 - 	.cancel = tpm_inf_cancel,
  27.569 -@@ -375,6 +376,7 @@ static int __devinit tpm_inf_pnp_probe(s
  27.570 - 	int version[2];
  27.571 - 	int productid[2];
  27.572 - 	char chipname[20];
  27.573 -+	struct tpm_chip *chip;
  27.574 - 
  27.575 - 	/* read IO-ports through PnP */
  27.576 - 	if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) &&
  27.577 -@@ -395,14 +397,13 @@ static int __devinit tpm_inf_pnp_probe(s
  27.578 - 			goto err_last;
  27.579 - 		}
  27.580 - 		/* publish my base address and request region */
  27.581 --		tpm_inf.base = TPM_INF_BASE;
  27.582 - 		if (request_region
  27.583 --		    (tpm_inf.base, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) {
  27.584 -+		    (TPM_INF_BASE, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) {
  27.585 - 			rc = -EINVAL;
  27.586 - 			goto err_last;
  27.587 - 		}
  27.588 --		if (request_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN,
  27.589 --				"tpm_infineon0") == NULL) {
  27.590 -+		if (request_region
  27.591 -+		    (TPM_INF_ADDR, TPM_INF_ADDR_LEN, "tpm_infineon0") == NULL) {
  27.592 - 			rc = -EINVAL;
  27.593 - 			goto err_last;
  27.594 - 		}
  27.595 -@@ -442,9 +443,9 @@ static int __devinit tpm_inf_pnp_probe(s
  27.596 - 
  27.597 - 		/* configure TPM with IO-ports */
  27.598 - 		outb(IOLIMH, TPM_INF_ADDR);
  27.599 --		outb(((tpm_inf.base >> 8) & 0xff), TPM_INF_DATA);
  27.600 -+		outb(((TPM_INF_BASE >> 8) & 0xff), TPM_INF_DATA);
  27.601 - 		outb(IOLIML, TPM_INF_ADDR);
  27.602 --		outb((tpm_inf.base & 0xff), TPM_INF_DATA);
  27.603 -+		outb((TPM_INF_BASE & 0xff), TPM_INF_DATA);
  27.604 - 
  27.605 - 		/* control if IO-ports are set correctly */
  27.606 - 		outb(IOLIMH, TPM_INF_ADDR);
  27.607 -@@ -452,10 +453,10 @@ static int __devinit tpm_inf_pnp_probe(s
  27.608 - 		outb(IOLIML, TPM_INF_ADDR);
  27.609 - 		iol = inb(TPM_INF_DATA);
  27.610 - 
  27.611 --		if ((ioh << 8 | iol) != tpm_inf.base) {
  27.612 -+		if ((ioh << 8 | iol) != TPM_INF_BASE) {
  27.613 - 			dev_err(&dev->dev,
  27.614 --				"Could not set IO-ports to 0x%lx\n",
  27.615 --				tpm_inf.base);
  27.616 -+				"Could not set IO-ports to 0x%x\n",
  27.617 -+				TPM_INF_BASE);
  27.618 - 			rc = -EIO;
  27.619 - 			goto err_release_region;
  27.620 - 		}
  27.621 -@@ -466,15 +467,15 @@ static int __devinit tpm_inf_pnp_probe(s
  27.622 - 		outb(DISABLE_REGISTER_PAIR, TPM_INF_ADDR);
  27.623 - 
  27.624 - 		/* disable RESET, LP and IRQC */
  27.625 --		outb(RESET_LP_IRQC_DISABLE, tpm_inf.base + CMD);
  27.626 -+		outb(RESET_LP_IRQC_DISABLE, TPM_INF_BASE + CMD);
  27.627 - 
  27.628 - 		/* Finally, we're done, print some infos */
  27.629 - 		dev_info(&dev->dev, "TPM found: "
  27.630 - 			 "config base 0x%x, "
  27.631 - 			 "io base 0x%x, "
  27.632 --			 "chip version %02x%02x, "
  27.633 --			 "vendor id %x%x (Infineon), "
  27.634 --			 "product id %02x%02x"
  27.635 -+			 "chip version 0x%02x%02x, "
  27.636 -+			 "vendor id 0x%x%x (Infineon), "
  27.637 -+			 "product id 0x%02x%02x"
  27.638 - 			 "%s\n",
  27.639 - 			 TPM_INF_ADDR,
  27.640 - 			 TPM_INF_BASE,
  27.641 -@@ -482,11 +483,10 @@ static int __devinit tpm_inf_pnp_probe(s
  27.642 - 			 vendorid[0], vendorid[1],
  27.643 - 			 productid[0], productid[1], chipname);
  27.644 - 
  27.645 --		rc = tpm_register_hardware(&dev->dev, &tpm_inf);
  27.646 --		if (rc < 0) {
  27.647 --			rc = -ENODEV;
  27.648 -+		if (!(chip = tpm_register_hardware(&dev->dev, &tpm_inf))) {
  27.649 - 			goto err_release_region;
  27.650 - 		}
  27.651 -+		chip->vendor.base = TPM_INF_BASE;
  27.652 - 		return 0;
  27.653 - 	} else {
  27.654 - 		rc = -ENODEV;
  27.655 -@@ -494,7 +494,7 @@ static int __devinit tpm_inf_pnp_probe(s
  27.656 - 	}
  27.657 - 
  27.658 - err_release_region:
  27.659 --	release_region(tpm_inf.base, TPM_INF_PORT_LEN);
  27.660 -+	release_region(TPM_INF_BASE, TPM_INF_PORT_LEN);
  27.661 - 	release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN);
  27.662 - 
  27.663 - err_last:
  27.664 -@@ -506,7 +506,8 @@ static __devexit void tpm_inf_pnp_remove
  27.665 - 	struct tpm_chip *chip = pnp_get_drvdata(dev);
  27.666 - 
  27.667 - 	if (chip) {
  27.668 --		release_region(chip->vendor->base, TPM_INF_PORT_LEN);
  27.669 -+		release_region(TPM_INF_BASE, TPM_INF_PORT_LEN);
  27.670 -+		release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN);
  27.671 - 		tpm_remove_hardware(chip->dev);
  27.672 - 	}
  27.673 - }
  27.674 -@@ -520,7 +521,7 @@ static struct pnp_driver tpm_inf_pnp = {
  27.675 - 	},
  27.676 - 	.id_table = tpm_pnp_tbl,
  27.677 - 	.probe = tpm_inf_pnp_probe,
  27.678 --	.remove = tpm_inf_pnp_remove,
  27.679 -+	.remove = __devexit_p(tpm_inf_pnp_remove),
  27.680 - };
  27.681 - 
  27.682 - static int __init init_inf(void)
  27.683 -@@ -538,5 +539,5 @@ module_exit(cleanup_inf);
  27.684 - 
  27.685 - MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>");
  27.686 - MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2");
  27.687 --MODULE_VERSION("1.7");
  27.688 -+MODULE_VERSION("1.8");
  27.689 - MODULE_LICENSE("GPL");
  27.690 -diff -pruN ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_nsc.c ./drivers/char/tpm/tpm_nsc.c
  27.691 ---- ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_nsc.c	2006-09-12 19:02:10.000000000 +0100
  27.692 -+++ ./drivers/char/tpm/tpm_nsc.c	2006-09-19 14:05:52.000000000 +0100
  27.693 -@@ -71,7 +71,7 @@ static int wait_for_stat(struct tpm_chip
  27.694 - 	unsigned long stop;
  27.695 - 
  27.696 - 	/* status immediately available check */
  27.697 --	*data = inb(chip->vendor->base + NSC_STATUS);
  27.698 -+	*data = inb(chip->vendor.base + NSC_STATUS);
  27.699 - 	if ((*data & mask) == val)
  27.700 - 		return 0;
  27.701 - 
  27.702 -@@ -79,7 +79,7 @@ static int wait_for_stat(struct tpm_chip
  27.703 - 	stop = jiffies + 10 * HZ;
  27.704 - 	do {
  27.705 - 		msleep(TPM_TIMEOUT);
  27.706 --		*data = inb(chip->vendor->base + 1);
  27.707 -+		*data = inb(chip->vendor.base + 1);
  27.708 - 		if ((*data & mask) == val)
  27.709 - 			return 0;
  27.710 - 	}
  27.711 -@@ -94,9 +94,9 @@ static int nsc_wait_for_ready(struct tpm
  27.712 - 	unsigned long stop;
  27.713 - 
  27.714 - 	/* status immediately available check */
  27.715 --	status = inb(chip->vendor->base + NSC_STATUS);
  27.716 -+	status = inb(chip->vendor.base + NSC_STATUS);
  27.717 - 	if (status & NSC_STATUS_OBF)
  27.718 --		status = inb(chip->vendor->base + NSC_DATA);
  27.719 -+		status = inb(chip->vendor.base + NSC_DATA);
  27.720 - 	if (status & NSC_STATUS_RDY)
  27.721 - 		return 0;
  27.722 - 
  27.723 -@@ -104,9 +104,9 @@ static int nsc_wait_for_ready(struct tpm
  27.724 - 	stop = jiffies + 100;
  27.725 - 	do {
  27.726 - 		msleep(TPM_TIMEOUT);
  27.727 --		status = inb(chip->vendor->base + NSC_STATUS);
  27.728 -+		status = inb(chip->vendor.base + NSC_STATUS);
  27.729 - 		if (status & NSC_STATUS_OBF)
  27.730 --			status = inb(chip->vendor->base + NSC_DATA);
  27.731 -+			status = inb(chip->vendor.base + NSC_DATA);
  27.732 - 		if (status & NSC_STATUS_RDY)
  27.733 - 			return 0;
  27.734 - 	}
  27.735 -@@ -132,7 +132,7 @@ static int tpm_nsc_recv(struct tpm_chip 
  27.736 - 		return -EIO;
  27.737 - 	}
  27.738 - 	if ((data =
  27.739 --	     inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) {
  27.740 -+	     inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_NORMAL) {
  27.741 - 		dev_err(chip->dev, "not in normal mode (0x%x)\n",
  27.742 - 			data);
  27.743 - 		return -EIO;
  27.744 -@@ -148,7 +148,7 @@ static int tpm_nsc_recv(struct tpm_chip 
  27.745 - 		}
  27.746 - 		if (data & NSC_STATUS_F0)
  27.747 - 			break;
  27.748 --		*p = inb(chip->vendor->base + NSC_DATA);
  27.749 -+		*p = inb(chip->vendor.base + NSC_DATA);
  27.750 - 	}
  27.751 - 
  27.752 - 	if ((data & NSC_STATUS_F0) == 0 &&
  27.753 -@@ -156,7 +156,7 @@ static int tpm_nsc_recv(struct tpm_chip 
  27.754 - 		dev_err(chip->dev, "F0 not set\n");
  27.755 - 		return -EIO;
  27.756 - 	}
  27.757 --	if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) {
  27.758 -+	if ((data = inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_EOC) {
  27.759 - 		dev_err(chip->dev,
  27.760 - 			"expected end of command(0x%x)\n", data);
  27.761 - 		return -EIO;
  27.762 -@@ -182,7 +182,7 @@ static int tpm_nsc_send(struct tpm_chip 
  27.763 - 	 * fix it. Not sure why this is needed, we followed the flow
  27.764 - 	 * chart in the manual to the letter.
  27.765 - 	 */
  27.766 --	outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND);
  27.767 -+	outb(NSC_COMMAND_CANCEL, chip->vendor.base + NSC_COMMAND);
  27.768 - 
  27.769 - 	if (nsc_wait_for_ready(chip) != 0)
  27.770 - 		return -EIO;
  27.771 -@@ -192,7 +192,7 @@ static int tpm_nsc_send(struct tpm_chip 
  27.772 - 		return -EIO;
  27.773 - 	}
  27.774 - 
  27.775 --	outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND);
  27.776 -+	outb(NSC_COMMAND_NORMAL, chip->vendor.base + NSC_COMMAND);
  27.777 - 	if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) {
  27.778 - 		dev_err(chip->dev, "IBR timeout\n");
  27.779 - 		return -EIO;
  27.780 -@@ -204,26 +204,26 @@ static int tpm_nsc_send(struct tpm_chip 
  27.781 - 				"IBF timeout (while writing data)\n");
  27.782 - 			return -EIO;
  27.783 - 		}
  27.784 --		outb(buf[i], chip->vendor->base + NSC_DATA);
  27.785 -+		outb(buf[i], chip->vendor.base + NSC_DATA);
  27.786 - 	}
  27.787 - 
  27.788 - 	if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
  27.789 - 		dev_err(chip->dev, "IBF timeout\n");
  27.790 - 		return -EIO;
  27.791 - 	}
  27.792 --	outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND);
  27.793 -+	outb(NSC_COMMAND_EOC, chip->vendor.base + NSC_COMMAND);
  27.794 - 
  27.795 - 	return count;
  27.796 - }
  27.797 - 
  27.798 - static void tpm_nsc_cancel(struct tpm_chip *chip)
  27.799 - {
  27.800 --	outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND);
  27.801 -+	outb(NSC_COMMAND_CANCEL, chip->vendor.base + NSC_COMMAND);
  27.802 - }
  27.803 - 
  27.804 - static u8 tpm_nsc_status(struct tpm_chip *chip)
  27.805 - {
  27.806 --	return inb(chip->vendor->base + NSC_STATUS);
  27.807 -+	return inb(chip->vendor.base + NSC_STATUS);
  27.808 - }
  27.809 - 
  27.810 - static struct file_operations nsc_ops = {
  27.811 -@@ -250,7 +250,7 @@ static struct attribute * nsc_attrs[] = 
  27.812 - 
  27.813 - static struct attribute_group nsc_attr_grp = { .attrs = nsc_attrs };
  27.814 - 
  27.815 --static struct tpm_vendor_specific tpm_nsc = {
  27.816 -+static const struct tpm_vendor_specific tpm_nsc = {
  27.817 - 	.recv = tpm_nsc_recv,
  27.818 - 	.send = tpm_nsc_send,
  27.819 - 	.cancel = tpm_nsc_cancel,
  27.820 -@@ -268,7 +268,7 @@ static void __devexit tpm_nsc_remove(str
  27.821 - {
  27.822 - 	struct tpm_chip *chip = dev_get_drvdata(dev);
  27.823 - 	if ( chip ) {
  27.824 --		release_region(chip->vendor->base, 2);
  27.825 -+		release_region(chip->vendor.base, 2);
  27.826 - 		tpm_remove_hardware(chip->dev);
  27.827 - 	}
  27.828 - }
  27.829 -@@ -286,7 +286,8 @@ static int __init init_nsc(void)
  27.830 - 	int rc = 0;
  27.831 - 	int lo, hi;
  27.832 - 	int nscAddrBase = TPM_ADDR;
  27.833 --
  27.834 -+	struct tpm_chip *chip;
  27.835 -+	unsigned long base;
  27.836 - 
  27.837 - 	/* verify that it is a National part (SID) */
  27.838 - 	if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) {
  27.839 -@@ -300,7 +301,7 @@ static int __init init_nsc(void)
  27.840 - 
  27.841 - 	hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI);
  27.842 - 	lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO);
  27.843 --	tpm_nsc.base = (hi<<8) | lo;
  27.844 -+	base = (hi<<8) | lo;
  27.845 - 
  27.846 - 	/* enable the DPM module */
  27.847 - 	tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01);
  27.848 -@@ -320,13 +321,15 @@ static int __init init_nsc(void)
  27.849 - 	if ((rc = platform_device_register(pdev)) < 0)
  27.850 - 		goto err_free_dev;
  27.851 - 
  27.852 --	if (request_region(tpm_nsc.base, 2, "tpm_nsc0") == NULL ) {
  27.853 -+	if (request_region(base, 2, "tpm_nsc0") == NULL ) {
  27.854 - 		rc = -EBUSY;
  27.855 - 		goto err_unreg_dev;
  27.856 - 	}
  27.857 - 
  27.858 --	if ((rc = tpm_register_hardware(&pdev->dev, &tpm_nsc)) < 0)
  27.859 -+	if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_nsc))) {
  27.860 -+		rc = -ENODEV;
  27.861 - 		goto err_rel_reg;
  27.862 -+	}
  27.863 - 
  27.864 - 	dev_dbg(&pdev->dev, "NSC TPM detected\n");
  27.865 - 	dev_dbg(&pdev->dev,
  27.866 -@@ -361,10 +364,12 @@ static int __init init_nsc(void)
  27.867 - 		 "NSC TPM revision %d\n",
  27.868 - 		 tpm_read_index(nscAddrBase, 0x27) & 0x1F);
  27.869 - 
  27.870 -+	chip->vendor.base = base;
  27.871 -+
  27.872 - 	return 0;
  27.873 - 
  27.874 - err_rel_reg:
  27.875 --	release_region(tpm_nsc.base, 2);
  27.876 -+	release_region(base, 2);
  27.877 - err_unreg_dev:
  27.878 - 	platform_device_unregister(pdev);
  27.879 - err_free_dev:
  27.880 -diff -pruN ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_tis.c ./drivers/char/tpm/tpm_tis.c
  27.881 ---- ../orig-linux-2.6.16.29/drivers/char/tpm/tpm_tis.c	1970-01-01 01:00:00.000000000 +0100
  27.882 -+++ ./drivers/char/tpm/tpm_tis.c	2006-09-19 14:05:52.000000000 +0100
  27.883 -@@ -0,0 +1,665 @@
  27.884 -+/*
  27.885 -+ * Copyright (C) 2005, 2006 IBM Corporation
  27.886 -+ *
  27.887 -+ * Authors:
  27.888 -+ * Leendert van Doorn <leendert@watson.ibm.com>
  27.889 -+ * Kylene Hall <kjhall@us.ibm.com>
  27.890 -+ *
  27.891 -+ * Device driver for TCG/TCPA TPM (trusted platform module).
  27.892 -+ * Specifications at www.trustedcomputinggroup.org
  27.893 -+ *
  27.894 -+ * This device driver implements the TPM interface as defined in
  27.895 -+ * the TCG TPM Interface Spec version 1.2, revision 1.0.
  27.896 -+ *
  27.897 -+ * This program is free software; you can redistribute it and/or
  27.898 -+ * modify it under the terms of the GNU General Public License as
  27.899 -+ * published by the Free Software Foundation, version 2 of the
  27.900 -+ * License.
  27.901 -+ */
  27.902 -+#include <linux/init.h>
  27.903 -+#include <linux/module.h>
  27.904 -+#include <linux/moduleparam.h>
  27.905 -+#include <linux/pnp.h>
  27.906 -+#include <linux/interrupt.h>
  27.907 -+#include <linux/wait.h>
  27.908 -+#include "tpm.h"
  27.909 -+
  27.910 -+#define TPM_HEADER_SIZE 10
  27.911 -+
  27.912 -+enum tis_access {
  27.913 -+	TPM_ACCESS_VALID = 0x80,
  27.914 -+	TPM_ACCESS_ACTIVE_LOCALITY = 0x20,
  27.915 -+	TPM_ACCESS_REQUEST_PENDING = 0x04,
  27.916 -+	TPM_ACCESS_REQUEST_USE = 0x02,
  27.917 -+};
  27.918 -+
  27.919 -+enum tis_status {
  27.920 -+	TPM_STS_VALID = 0x80,
  27.921 -+	TPM_STS_COMMAND_READY = 0x40,
  27.922 -+	TPM_STS_GO = 0x20,
  27.923 -+	TPM_STS_DATA_AVAIL = 0x10,
  27.924 -+	TPM_STS_DATA_EXPECT = 0x08,
  27.925 -+};
  27.926 -+
  27.927 -+enum tis_int_flags {
  27.928 -+	TPM_GLOBAL_INT_ENABLE = 0x80000000,
  27.929 -+	TPM_INTF_BURST_COUNT_STATIC = 0x100,
  27.930 -+	TPM_INTF_CMD_READY_INT = 0x080,
  27.931 -+	TPM_INTF_INT_EDGE_FALLING = 0x040,
  27.932 -+	TPM_INTF_INT_EDGE_RISING = 0x020,
  27.933 -+	TPM_INTF_INT_LEVEL_LOW = 0x010,
  27.934 -+	TPM_INTF_INT_LEVEL_HIGH = 0x008,
  27.935 -+	TPM_INTF_LOCALITY_CHANGE_INT = 0x004,
  27.936 -+	TPM_INTF_STS_VALID_INT = 0x002,
  27.937 -+	TPM_INTF_DATA_AVAIL_INT = 0x001,
  27.938 -+};
  27.939 -+
  27.940 -+enum tis_defaults {
  27.941 -+	TIS_MEM_BASE = 0xFED40000,
  27.942 -+	TIS_MEM_LEN = 0x5000,
  27.943 -+	TIS_SHORT_TIMEOUT = 750,	/* ms */
  27.944 -+	TIS_LONG_TIMEOUT = 2000,	/* 2 sec */
  27.945 -+};
  27.946 -+
  27.947 -+#define	TPM_ACCESS(l)			(0x0000 | ((l) << 12))
  27.948 -+#define	TPM_INT_ENABLE(l)		(0x0008 | ((l) << 12))
  27.949 -+#define	TPM_INT_VECTOR(l)		(0x000C | ((l) << 12))
  27.950 -+#define	TPM_INT_STATUS(l)		(0x0010 | ((l) << 12))
  27.951 -+#define	TPM_INTF_CAPS(l)		(0x0014 | ((l) << 12))
  27.952 -+#define	TPM_STS(l)			(0x0018 | ((l) << 12))
  27.953 -+#define	TPM_DATA_FIFO(l)		(0x0024 | ((l) << 12))
  27.954 -+
  27.955 -+#define	TPM_DID_VID(l)			(0x0F00 | ((l) << 12))
  27.956 -+#define	TPM_RID(l)			(0x0F04 | ((l) << 12))
  27.957 -+
  27.958 -+static LIST_HEAD(tis_chips);
  27.959 -+static DEFINE_SPINLOCK(tis_lock);
  27.960 -+
  27.961 -+static int check_locality(struct tpm_chip *chip, int l)
  27.962 -+{
  27.963 -+	if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
  27.964 -+	     (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
  27.965 -+	    (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID))
  27.966 -+		return chip->vendor.locality = l;
  27.967 -+
  27.968 -+	return -1;
  27.969 -+}
  27.970 -+
  27.971 -+static void release_locality(struct tpm_chip *chip, int l, int force)
  27.972 -+{
  27.973 -+	if (force || (ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
  27.974 -+		      (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) ==
  27.975 -+	    (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID))
  27.976 -+		iowrite8(TPM_ACCESS_ACTIVE_LOCALITY,
  27.977 -+			 chip->vendor.iobase + TPM_ACCESS(l));
  27.978 -+}
  27.979 -+
  27.980 -+static int request_locality(struct tpm_chip *chip, int l)
  27.981 -+{
  27.982 -+	unsigned long stop;
  27.983 -+	long rc;
  27.984 -+
  27.985 -+	if (check_locality(chip, l) >= 0)
  27.986 -+		return l;
  27.987 -+
  27.988 -+	iowrite8(TPM_ACCESS_REQUEST_USE,
  27.989 -+		 chip->vendor.iobase + TPM_ACCESS(l));
  27.990 -+
  27.991 -+	if (chip->vendor.irq) {
  27.992 -+		rc = wait_event_interruptible_timeout(chip->vendor.int_queue,
  27.993 -+						      (check_locality
  27.994 -+						       (chip, l) >= 0),
  27.995 -+						      chip->vendor.timeout_a);
  27.996 -+		if (rc > 0)
  27.997 -+			return l;
  27.998 -+
  27.999 -+	} else {
 27.1000 -+		/* wait for burstcount */
 27.1001 -+		stop = jiffies + chip->vendor.timeout_a;
 27.1002 -+		do {
 27.1003 -+			if (check_locality(chip, l) >= 0)
 27.1004 -+				return l;
 27.1005 -+			msleep(TPM_TIMEOUT);
 27.1006 -+		}
 27.1007 -+		while (time_before(jiffies, stop));
 27.1008 -+	}
 27.1009 -+	return -1;
 27.1010 -+}
 27.1011 -+
 27.1012 -+static u8 tpm_tis_status(struct tpm_chip *chip)
 27.1013 -+{
 27.1014 -+	return ioread8(chip->vendor.iobase +
 27.1015 -+		       TPM_STS(chip->vendor.locality));
 27.1016 -+}
 27.1017 -+
 27.1018 -+static void tpm_tis_ready(struct tpm_chip *chip)
 27.1019 -+{
 27.1020 -+	/* this causes the current command to be aborted */
 27.1021 -+	iowrite8(TPM_STS_COMMAND_READY,
 27.1022 -+		 chip->vendor.iobase + TPM_STS(chip->vendor.locality));
 27.1023 -+}
 27.1024 -+
 27.1025 -+static int get_burstcount(struct tpm_chip *chip)
 27.1026 -+{
 27.1027 -+	unsigned long stop;
 27.1028 -+	int burstcnt;
 27.1029 -+
 27.1030 -+	/* wait for burstcount */
 27.1031 -+	/* which timeout value, spec has 2 answers (c & d) */
 27.1032 -+	stop = jiffies + chip->vendor.timeout_d;
 27.1033 -+	do {
 27.1034 -+		burstcnt = ioread8(chip->vendor.iobase +
 27.1035 -+				   TPM_STS(chip->vendor.locality) + 1);
 27.1036 -+		burstcnt += ioread8(chip->vendor.iobase +
 27.1037 -+				    TPM_STS(chip->vendor.locality) +
 27.1038 -+				    2) << 8;
 27.1039 -+		if (burstcnt)
 27.1040 -+			return burstcnt;
 27.1041 -+		msleep(TPM_TIMEOUT);
 27.1042 -+	} while (time_before(jiffies, stop));
 27.1043 -+	return -EBUSY;
 27.1044 -+}
 27.1045 -+
 27.1046 -+static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
 27.1047 -+			 wait_queue_head_t *queue)
 27.1048 -+{
 27.1049 -+	unsigned long stop;
 27.1050 -+	long rc;
 27.1051 -+	u8 status;
 27.1052 -+
 27.1053 -+	/* check current status */
 27.1054 -+	status = tpm_tis_status(chip);
 27.1055 -+	if ((status & mask) == mask)
 27.1056 -+		return 0;
 27.1057 -+
 27.1058 -+	if (chip->vendor.irq) {
 27.1059 -+		rc = wait_event_interruptible_timeout(*queue,
 27.1060 -+						      ((tpm_tis_status
 27.1061 -+							(chip) & mask) ==
 27.1062 -+						       mask), timeout);
 27.1063 -+		if (rc > 0)
 27.1064 -+			return 0;
 27.1065 -+	} else {
 27.1066 -+		stop = jiffies + timeout;
 27.1067 -+		do {
 27.1068 -+			msleep(TPM_TIMEOUT);
 27.1069 -+			status = tpm_tis_status(chip);
 27.1070 -+			if ((status & mask) == mask)
 27.1071 -+				return 0;
 27.1072 -+		} while (time_before(jiffies, stop));
 27.1073 -+	}
 27.1074 -+	return -ETIME;
 27.1075 -+}
 27.1076 -+
 27.1077 -+static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
 27.1078 -+{
 27.1079 -+	int size = 0, burstcnt;
 27.1080 -+	while (size < count &&
 27.1081 -+	       wait_for_stat(chip,
 27.1082 -+			     TPM_STS_DATA_AVAIL | TPM_STS_VALID,
 27.1083 -+			     chip->vendor.timeout_c,
 27.1084 -+			     &chip->vendor.read_queue)
 27.1085 -+	       == 0) {
 27.1086 -+		burstcnt = get_burstcount(chip);
 27.1087 -+		for (; burstcnt > 0 && size < count; burstcnt--)
 27.1088 -+			buf[size++] = ioread8(chip->vendor.iobase +
 27.1089 -+					      TPM_DATA_FIFO(chip->vendor.
 27.1090 -+							    locality));
 27.1091 -+	}
 27.1092 -+	return size;
 27.1093 -+}
 27.1094 -+
 27.1095 -+static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
 27.1096 -+{
 27.1097 -+	int size = 0;
 27.1098 -+	int expected, status;
 27.1099 -+
 27.1100 -+	if (count < TPM_HEADER_SIZE) {
 27.1101 -+		size = -EIO;
 27.1102 -+		goto out;
 27.1103 -+	}
 27.1104 -+
 27.1105 -+	/* read first 10 bytes, including tag, paramsize, and result */
 27.1106 -+	if ((size =
 27.1107 -+	     recv_data(chip, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) {
 27.1108 -+		dev_err(chip->dev, "Unable to read header\n");
 27.1109 -+		goto out;
 27.1110 -+	}
 27.1111 -+
 27.1112 -+	expected = be32_to_cpu(*(__be32 *) (buf + 2));
 27.1113 -+	if (expected > count) {
 27.1114 -+		size = -EIO;
 27.1115 -+		goto out;
 27.1116 -+	}
 27.1117 -+
 27.1118 -+	if ((size +=
 27.1119 -+	     recv_data(chip, &buf[TPM_HEADER_SIZE],
 27.1120 -+		       expected - TPM_HEADER_SIZE)) < expected) {
 27.1121 -+		dev_err(chip->dev, "Unable to read remainder of result\n");
 27.1122 -+		size = -ETIME;
 27.1123 -+		goto out;
 27.1124 -+	}
 27.1125 -+
 27.1126 -+	wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
 27.1127 -+		      &chip->vendor.int_queue);
 27.1128 -+	status = tpm_tis_status(chip);
 27.1129 -+	if (status & TPM_STS_DATA_AVAIL) {	/* retry? */
 27.1130 -+		dev_err(chip->dev, "Error left over data\n");
 27.1131 -+		size = -EIO;
 27.1132 -+		goto out;
 27.1133 -+	}
 27.1134 -+
 27.1135 -+out:
 27.1136 -+	tpm_tis_ready(chip);
 27.1137 -+	release_locality(chip, chip->vendor.locality, 0);
 27.1138 -+	return size;
 27.1139 -+}
 27.1140 -+
 27.1141 -+/*
 27.1142 -+ * If interrupts are used (signaled by an irq set in the vendor structure)
 27.1143 -+ * tpm.c can skip polling for the data to be available as the interrupt is
 27.1144 -+ * waited for here
 27.1145 -+ */
 27.1146 -+static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
 27.1147 -+{
 27.1148 -+	int rc, status, burstcnt;
 27.1149 -+	size_t count = 0;
 27.1150 -+	u32 ordinal;
 27.1151 -+
 27.1152 -+	if (request_locality(chip, 0) < 0)
 27.1153 -+		return -EBUSY;
 27.1154 -+
 27.1155 -+	status = tpm_tis_status(chip);
 27.1156 -+	if ((status & TPM_STS_COMMAND_READY) == 0) {
 27.1157 -+		tpm_tis_ready(chip);
 27.1158 -+		if (wait_for_stat
 27.1159 -+		    (chip, TPM_STS_COMMAND_READY, chip->vendor.timeout_b,
 27.1160 -+		     &chip->vendor.int_queue) < 0) {
 27.1161 -+			rc = -ETIME;
 27.1162 -+			goto out_err;
 27.1163 -+		}
 27.1164 -+	}
 27.1165 -+
 27.1166 -+	while (count < len - 1) {
 27.1167 -+		burstcnt = get_burstcount(chip);
 27.1168 -+		for (; burstcnt > 0 && count < len - 1; burstcnt--) {
 27.1169 -+			iowrite8(buf[count], chip->vendor.iobase +
 27.1170 -+				 TPM_DATA_FIFO(chip->vendor.locality));
 27.1171 -+			count++;
 27.1172 -+		}
 27.1173 -+
 27.1174 -+		wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
 27.1175 -+			      &chip->vendor.int_queue);
 27.1176 -+		status = tpm_tis_status(chip);
 27.1177 -+		if ((status & TPM_STS_DATA_EXPECT) == 0) {
 27.1178 -+			rc = -EIO;
 27.1179 -+			goto out_err;
 27.1180 -+		}
 27.1181 -+	}
 27.1182 -+
 27.1183 -+	/* write last byte */
 27.1184 -+	iowrite8(buf[count],
 27.1185 -+		 chip->vendor.iobase +
 27.1186 -+		 TPM_DATA_FIFO(chip->vendor.locality));
 27.1187 -+	wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
 27.1188 -+		      &chip->vendor.int_queue);
 27.1189 -+	status = tpm_tis_status(chip);
 27.1190 -+	if ((status & TPM_STS_DATA_EXPECT) != 0) {
 27.1191 -+		rc = -EIO;
 27.1192 -+		goto out_err;
 27.1193 -+	}
 27.1194 -+
 27.1195 -+	/* go and do it */
 27.1196 -+	iowrite8(TPM_STS_GO,
 27.1197 -+		 chip->vendor.iobase + TPM_STS(chip->vendor.locality));
 27.1198 -+
 27.1199 -+	if (chip->vendor.irq) {
 27.1200 -+		ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
 27.1201 -+		if (wait_for_stat
 27.1202 -+		    (chip, TPM_STS_DATA_AVAIL | TPM_STS_VALID,
 27.1203 -+		     tpm_calc_ordinal_duration(chip, ordinal),
 27.1204 -+		     &chip->vendor.read_queue) < 0) {
 27.1205 -+			rc = -ETIME;
 27.1206 -+			goto out_err;
 27.1207 -+		}
 27.1208 -+	}
 27.1209 -+	return len;
 27.1210 -+out_err:
 27.1211 -+	tpm_tis_ready(chip);
 27.1212 -+	release_locality(chip, chip->vendor.locality, 0);
 27.1213 -+	return rc;
 27.1214 -+}
 27.1215 -+
 27.1216 -+static struct file_operations tis_ops = {
 27.1217 -+	.owner = THIS_MODULE,
 27.1218 -+	.llseek = no_llseek,
 27.1219 -+	.open = tpm_open,
 27.1220 -+	.read = tpm_read,
 27.1221 -+	.write = tpm_write,
 27.1222 -+	.release = tpm_release,
 27.1223 -+};
 27.1224 -+
 27.1225 -+static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
 27.1226 -+static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
 27.1227 -+static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL);
 27.1228 -+static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL);
 27.1229 -+static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL);
 27.1230 -+static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated,
 27.1231 -+		   NULL);
 27.1232 -+static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL);
 27.1233 -+static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
 27.1234 -+
 27.1235 -+static struct attribute *tis_attrs[] = {
 27.1236 -+	&dev_attr_pubek.attr,
 27.1237 -+	&dev_attr_pcrs.attr,
 27.1238 -+	&dev_attr_enabled.attr,
 27.1239 -+	&dev_attr_active.attr,
 27.1240 -+	&dev_attr_owned.attr,
 27.1241 -+	&dev_attr_temp_deactivated.attr,
 27.1242 -+	&dev_attr_caps.attr,
 27.1243 -+	&dev_attr_cancel.attr, NULL,
 27.1244 -+};
 27.1245 -+
 27.1246 -+static struct attribute_group tis_attr_grp = {
 27.1247 -+	.attrs = tis_attrs
 27.1248 -+};
 27.1249 -+
 27.1250 -+static struct tpm_vendor_specific tpm_tis = {
 27.1251 -+	.status = tpm_tis_status,
 27.1252 -+	.recv = tpm_tis_recv,
 27.1253 -+	.send = tpm_tis_send,
 27.1254 -+	.cancel = tpm_tis_ready,
 27.1255 -+	.req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
 27.1256 -+	.req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
 27.1257 -+	.req_canceled = TPM_STS_COMMAND_READY,
 27.1258 -+	.attr_group = &tis_attr_grp,
 27.1259 -+	.miscdev = {
 27.1260 -+		    .fops = &tis_ops,},
 27.1261 -+};
 27.1262 -+
 27.1263 -+static irqreturn_t tis_int_probe(int irq, void *dev_id, struct pt_regs *regs)
 27.1264 -+{
 27.1265 -+	struct tpm_chip *chip = (struct tpm_chip *) dev_id;
 27.1266 -+	u32 interrupt;
 27.1267 -+
 27.1268 -+	interrupt = ioread32(chip->vendor.iobase +
 27.1269 -+			     TPM_INT_STATUS(chip->vendor.locality));
 27.1270 -+
 27.1271 -+	if (interrupt == 0)
 27.1272 -+		return IRQ_NONE;
 27.1273 -+
 27.1274 -+	chip->vendor.irq = irq;
 27.1275 -+
 27.1276 -+	/* Clear interrupts handled with TPM_EOI */
 27.1277 -+	iowrite32(interrupt,
 27.1278 -+		  chip->vendor.iobase +
 27.1279 -+		  TPM_INT_STATUS(chip->vendor.locality));
 27.1280 -+	return IRQ_HANDLED;
 27.1281 -+}
 27.1282 -+
 27.1283 -+static irqreturn_t tis_int_handler(int irq, void *dev_id, struct pt_regs *regs)
 27.1284 -+{
 27.1285 -+	struct tpm_chip *chip = (struct tpm_chip *) dev_id;
 27.1286 -+	u32 interrupt;
 27.1287 -+	int i;
 27.1288 -+
 27.1289 -+	interrupt = ioread32(chip->vendor.iobase +
 27.1290 -+			     TPM_INT_STATUS(chip->vendor.locality));
 27.1291 -+
 27.1292 -+	if (interrupt == 0)
 27.1293 -+		return IRQ_NONE;
 27.1294 -+
 27.1295 -+	if (interrupt & TPM_INTF_DATA_AVAIL_INT)
 27.1296 -+		wake_up_interruptible(&chip->vendor.read_queue);
 27.1297 -+	if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT)
 27.1298 -+		for (i = 0; i < 5; i++)
 27.1299 -+			if (check_locality(chip, i) >= 0)
 27.1300 -+				break;
 27.1301 -+	if (interrupt &
 27.1302 -+	    (TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT |
 27.1303 -+	     TPM_INTF_CMD_READY_INT))
 27.1304 -+		wake_up_interruptible(&chip->vendor.int_queue);
 27.1305 -+
 27.1306 -+	/* Clear interrupts handled with TPM_EOI */
 27.1307 -+	iowrite32(interrupt,
 27.1308 -+		  chip->vendor.iobase +
 27.1309 -+		  TPM_INT_STATUS(chip->vendor.locality));
 27.1310 -+	return IRQ_HANDLED;
 27.1311 -+}
 27.1312 -+
 27.1313 -+static int interrupts = 1;
 27.1314 -+module_param(interrupts, bool, 0444);
 27.1315 -+MODULE_PARM_DESC(interrupts, "Enable interrupts");
 27.1316 -+
 27.1317 -+static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
 27.1318 -+				      const struct pnp_device_id *pnp_id)
 27.1319 -+{
 27.1320 -+	u32 vendor, intfcaps, intmask;
 27.1321 -+	int rc, i;
 27.1322 -+	unsigned long start, len;
 27.1323 -+	struct tpm_chip *chip;
 27.1324 -+
 27.1325 -+	start = pnp_mem_start(pnp_dev, 0);
 27.1326 -+	len = pnp_mem_len(pnp_dev, 0);
 27.1327 -+
 27.1328 -+	if (!start)
 27.1329 -+		start = TIS_MEM_BASE;
 27.1330 -+	if (!len)
 27.1331 -+		len = TIS_MEM_LEN;
 27.1332 -+
 27.1333 -+	if (!(chip = tpm_register_hardware(&pnp_dev->dev, &tpm_tis)))
 27.1334 -+		return -ENODEV;
 27.1335 -+
 27.1336 -+	chip->vendor.iobase = ioremap(start, len);
 27.1337 -+	if (!chip->vendor.iobase) {
 27.1338 -+		rc = -EIO;
 27.1339 -+		goto out_err;
 27.1340 -+	}
 27.1341 -+
 27.1342 -+	vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0));
 27.1343 -+
 27.1344 -+	/* Default timeouts */
 27.1345 -+	chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
 27.1346 -+	chip->vendor.timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT);
 27.1347 -+	chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
 27.1348 -+	chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
 27.1349 -+
 27.1350 -+	dev_info(&pnp_dev->dev,
 27.1351 -+		 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
 27.1352 -+		 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
 27.1353 -+
 27.1354 -+	/* Figure out the capabilities */
 27.1355 -+	intfcaps =
 27.1356 -+	    ioread32(chip->vendor.iobase +
 27.1357 -+		     TPM_INTF_CAPS(chip->vendor.locality));
 27.1358 -+	dev_dbg(&pnp_dev->dev, "TPM interface capabilities (0x%x):\n",
 27.1359 -+		intfcaps);
 27.1360 -+	if (intfcaps & TPM_INTF_BURST_COUNT_STATIC)
 27.1361 -+		dev_dbg(&pnp_dev->dev, "\tBurst Count Static\n");
 27.1362 -+	if (intfcaps & TPM_INTF_CMD_READY_INT)
 27.1363 -+		dev_dbg(&pnp_dev->dev, "\tCommand Ready Int Support\n");
 27.1364 -+	if (intfcaps & TPM_INTF_INT_EDGE_FALLING)
 27.1365 -+		dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Falling\n");
 27.1366 -+	if (intfcaps & TPM_INTF_INT_EDGE_RISING)
 27.1367 -+		dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Rising\n");
 27.1368 -+	if (intfcaps & TPM_INTF_INT_LEVEL_LOW)
 27.1369 -+		dev_dbg(&pnp_dev->dev, "\tInterrupt Level Low\n");
 27.1370 -+	if (intfcaps & TPM_INTF_INT_LEVEL_HIGH)
 27.1371 -+		dev_dbg(&pnp_dev->dev, "\tInterrupt Level High\n");
 27.1372 -+	if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT)
 27.1373 -+		dev_dbg(&pnp_dev->dev, "\tLocality Change Int Support\n");
 27.1374 -+	if (intfcaps & TPM_INTF_STS_VALID_INT)
 27.1375 -+		dev_dbg(&pnp_dev->dev, "\tSts Valid Int Support\n");
 27.1376 -+	if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
 27.1377 -+		dev_dbg(&pnp_dev->dev, "\tData Avail Int Support\n");
 27.1378 -+
 27.1379 -+	if (request_locality(chip, 0) != 0) {
 27.1380 -+		rc = -ENODEV;
 27.1381 -+		goto out_err;
 27.1382 -+	}
 27.1383 -+
 27.1384 -+	/* INTERRUPT Setup */
 27.1385 -+	init_waitqueue_head(&chip->vendor.read_queue);
 27.1386 -+	init_waitqueue_head(&chip->vendor.int_queue);
 27.1387 -+
 27.1388 -+	intmask =
 27.1389 -+	    ioread32(chip->vendor.iobase +
 27.1390 -+		     TPM_INT_ENABLE(chip->vendor.locality));
 27.1391 -+
 27.1392 -+	intmask |= TPM_INTF_CMD_READY_INT
 27.1393 -+	    | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
 27.1394 -+	    | TPM_INTF_STS_VALID_INT;
 27.1395 -+
 27.1396 -+	iowrite32(intmask,
 27.1397 -+		  chip->vendor.iobase +
 27.1398 -+		  TPM_INT_ENABLE(chip->vendor.locality));
 27.1399 -+	if (interrupts) {
 27.1400 -+		chip->vendor.irq =
 27.1401 -+		    ioread8(chip->vendor.iobase +
 27.1402 -+			    TPM_INT_VECTOR(chip->vendor.locality));
 27.1403 -+
 27.1404 -+		for (i = 3; i < 16 && chip->vendor.irq == 0; i++) {
 27.1405 -+			iowrite8(i, chip->vendor.iobase +
 27.1406 -+				    TPM_INT_VECTOR(chip->vendor.locality));
 27.1407 -+			if (request_irq
 27.1408 -+			    (i, tis_int_probe, SA_SHIRQ,
 27.1409 -+			     chip->vendor.miscdev.name, chip) != 0) {
 27.1410 -+				dev_info(chip->dev,
 27.1411 -+					 "Unable to request irq: %d for probe\n",
 27.1412 -+					 i);
 27.1413 -+				continue;
 27.1414 -+			}
 27.1415 -+
 27.1416 -+			/* Clear all existing */
 27.1417 -+			iowrite32(ioread32
 27.1418 -+				  (chip->vendor.iobase +
 27.1419 -+				   TPM_INT_STATUS(chip->vendor.locality)),
 27.1420 -+				  chip->vendor.iobase +
 27.1421 -+				  TPM_INT_STATUS(chip->vendor.locality));
 27.1422 -+
 27.1423 -+			/* Turn on */
 27.1424 -+			iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
 27.1425 -+				  chip->vendor.iobase +
 27.1426 -+				  TPM_INT_ENABLE(chip->vendor.locality));
 27.1427 -+
 27.1428 -+			/* Generate Interrupts */
 27.1429 -+			tpm_gen_interrupt(chip);
 27.1430 -+
 27.1431 -+			/* Turn off */
 27.1432 -+			iowrite32(intmask,
 27.1433 -+				  chip->vendor.iobase +
 27.1434 -+				  TPM_INT_ENABLE(chip->vendor.locality));
 27.1435 -+			free_irq(i, chip);
 27.1436 -+		}
 27.1437 -+	}
 27.1438 -+	if (chip->vendor.irq) {
 27.1439 -+		iowrite8(chip->vendor.irq,
 27.1440 -+			 chip->vendor.iobase +
 27.1441 -+			 TPM_INT_VECTOR(chip->vendor.locality));
 27.1442 -+		if (request_irq
 27.1443 -+		    (chip->vendor.irq, tis_int_handler, SA_SHIRQ,
 27.1444 -+		     chip->vendor.miscdev.name, chip) != 0) {
 27.1445 -+			dev_info(chip->dev,
 27.1446 -+				 "Unable to request irq: %d for use\n",
 27.1447 -+				 chip->vendor.irq);
 27.1448 -+			chip->vendor.irq = 0;
 27.1449 -+		} else {
 27.1450 -+			/* Clear all existing */
 27.1451 -+			iowrite32(ioread32
 27.1452 -+				  (chip->vendor.iobase +
 27.1453 -+				   TPM_INT_STATUS(chip->vendor.locality)),
 27.1454 -+				  chip->vendor.iobase +
 27.1455 -+				  TPM_INT_STATUS(chip->vendor.locality));
 27.1456 -+
 27.1457 -+			/* Turn on */
 27.1458 -+			iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
 27.1459 -+				  chip->vendor.iobase +
 27.1460 -+				  TPM_INT_ENABLE(chip->vendor.locality));
 27.1461 -+		}
 27.1462 -+	}
 27.1463 -+
 27.1464 -+	INIT_LIST_HEAD(&chip->vendor.list);
 27.1465 -+	spin_lock(&tis_lock);
 27.1466 -+	list_add(&chip->vendor.list, &tis_chips);
 27.1467 -+	spin_unlock(&tis_lock);
 27.1468 -+
 27.1469 -+	tpm_get_timeouts(chip);
 27.1470 -+	tpm_continue_selftest(chip);
 27.1471 -+
 27.1472 -+	return 0;
 27.1473 -+out_err:
 27.1474 -+	if (chip->vendor.iobase)
 27.1475 -+		iounmap(chip->vendor.iobase);
 27.1476 -+	tpm_remove_hardware(chip->dev);
 27.1477 -+	return rc;
 27.1478 -+}
 27.1479 -+
 27.1480 -+static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
 27.1481 -+{
 27.1482 -+	return tpm_pm_suspend(&dev->dev, msg);
 27.1483 -+}
 27.1484 -+
 27.1485 -+static int tpm_tis_pnp_resume(struct pnp_dev *dev)
 27.1486 -+{
 27.1487 -+	return tpm_pm_resume(&dev->dev);
 27.1488 -+}
 27.1489 -+
 27.1490 -+static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = {
 27.1491 -+	{"PNP0C31", 0},		/* TPM */
 27.1492 -+	{"ATM1200", 0},		/* Atmel */
 27.1493 -+	{"IFX0102", 0},		/* Infineon */
 27.1494 -+	{"BCM0101", 0},		/* Broadcom */
 27.1495 -+	{"NSC1200", 0},		/* National */
 27.1496 -+	/* Add new here */
 27.1497 -+	{"", 0},		/* User Specified */
 27.1498 -+	{"", 0}			/* Terminator */
 27.1499 -+};
 27.1500 -+
 27.1501 -+static struct pnp_driver tis_pnp_driver = {
 27.1502 -+	.name = "tpm_tis",
 27.1503 -+	.id_table = tpm_pnp_tbl,
 27.1504 -+	.probe = tpm_tis_pnp_init,
 27.1505 -+	.suspend = tpm_tis_pnp_suspend,
 27.1506 -+	.resume = tpm_tis_pnp_resume,
 27.1507 -+};
 27.1508 -+
 27.1509 -+#define TIS_HID_USR_IDX sizeof(tpm_pnp_tbl)/sizeof(struct pnp_device_id) -2
 27.1510 -+module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
 27.1511 -+		    sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
 27.1512 -+MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
 27.1513 -+
 27.1514 -+static int __init init_tis(void)
 27.1515 -+{
 27.1516 -+	return pnp_register_driver(&tis_pnp_driver);
 27.1517 -+}
 27.1518 -+
 27.1519 -+static void __exit cleanup_tis(void)
 27.1520 -+{
 27.1521 -+	struct tpm_vendor_specific *i, *j;
 27.1522 -+	struct tpm_chip *chip;
 27.1523 -+	spin_lock(&tis_lock);
 27.1524 -+	list_for_each_entry_safe(i, j, &tis_chips, list) {
 27.1525 -+		chip = to_tpm_chip(i);
 27.1526 -+		iowrite32(~TPM_GLOBAL_INT_ENABLE &
 27.1527 -+			  ioread32(chip->vendor.iobase +
 27.1528 -+				   TPM_INT_ENABLE(chip->vendor.
 27.1529 -+						  locality)),
 27.1530 -+			  chip->vendor.iobase +
 27.1531 -+			  TPM_INT_ENABLE(chip->vendor.locality));
 27.1532 -+		release_locality(chip, chip->vendor.locality, 1);
 27.1533 -+		if (chip->vendor.irq)
 27.1534 -+			free_irq(chip->vendor.irq, chip);
 27.1535 -+		iounmap(i->iobase);
 27.1536 -+		list_del(&i->list);
 27.1537 -+		tpm_remove_hardware(chip->dev);
 27.1538 -+	}
 27.1539 -+	spin_unlock(&tis_lock);
 27.1540 -+	pnp_unregister_driver(&tis_pnp_driver);
 27.1541 -+}
 27.1542 -+
 27.1543 -+module_init(init_tis);
 27.1544 -+module_exit(cleanup_tis);
 27.1545 -+MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
 27.1546 -+MODULE_DESCRIPTION("TPM Driver");
 27.1547 -+MODULE_VERSION("2.0");
 27.1548 -+MODULE_LICENSE("GPL");
    28.1 --- a/patches/linux-2.6.16.32/vsnprintf.patch	Wed Nov 29 11:05:02 2006 -0700
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,211 +0,0 @@
    28.4 -commit f796937a062c7aeb44cd0e75e1586c8543634a7d
    28.5 -Author: Jeremy Fitzhardinge <jeremy@xensource.com>
    28.6 -Date:   Sun Jun 25 05:49:17 2006 -0700
    28.7 -
    28.8 -    [PATCH] Fix bounds check in vsnprintf, to allow for a 0 size and NULL buffer
    28.9 -    
   28.10 -    This change allows callers to use a 0-byte buffer and a NULL buffer pointer
   28.11 -    with vsnprintf, so it can be used to determine how large the resulting
   28.12 -    formatted string will be.
   28.13 -    
   28.14 -    Previously the code effectively treated a size of 0 as a size of 4G (on
   28.15 -    32-bit systems), with other checks preventing it from actually trying to
   28.16 -    emit the string - but the terminal \0 would still be written, which would
   28.17 -    crash if the buffer is NULL.
   28.18 -    
   28.19 -    This change changes the boundary check so that 'end' points to the putative
   28.20 -    location of the terminal '\0', which is only written if size > 0.
   28.21 -    
   28.22 -    vsnprintf still allows the buffer size to be set very large, to allow
   28.23 -    unbounded buffer sizes (to implement sprintf, etc).
   28.24 -    
   28.25 -    [akpm@osdl.org: fix long-vs-longlong confusion]
   28.26 -    Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
   28.27 -    Signed-off-by: Chris Wright <chrisw@sous-sol.org>
   28.28 -    Signed-off-by: Andrew Morton <akpm@osdl.org>
   28.29 -    Signed-off-by: Linus Torvalds <torvalds@osdl.org>
   28.30 -
   28.31 -diff --git a/lib/vsprintf.c b/lib/vsprintf.c
   28.32 -index b07db5c..f595947 100644
   28.33 ---- a/lib/vsprintf.c
   28.34 -+++ b/lib/vsprintf.c
   28.35 -@@ -187,49 +187,49 @@ static char * number(char * buf, char *
   28.36 - 	size -= precision;
   28.37 - 	if (!(type&(ZEROPAD+LEFT))) {
   28.38 - 		while(size-->0) {
   28.39 --			if (buf <= end)
   28.40 -+			if (buf < end)
   28.41 - 				*buf = ' ';
   28.42 - 			++buf;
   28.43 - 		}
   28.44 - 	}
   28.45 - 	if (sign) {
   28.46 --		if (buf <= end)
   28.47 -+		if (buf < end)
   28.48 - 			*buf = sign;
   28.49 - 		++buf;
   28.50 - 	}
   28.51 - 	if (type & SPECIAL) {
   28.52 - 		if (base==8) {
   28.53 --			if (buf <= end)
   28.54 -+			if (buf < end)
   28.55 - 				*buf = '0';
   28.56 - 			++buf;
   28.57 - 		} else if (base==16) {
   28.58 --			if (buf <= end)
   28.59 -+			if (buf < end)
   28.60 - 				*buf = '0';
   28.61 - 			++buf;
   28.62 --			if (buf <= end)
   28.63 -+			if (buf < end)
   28.64 - 				*buf = digits[33];
   28.65 - 			++buf;
   28.66 - 		}
   28.67 - 	}
   28.68 - 	if (!(type & LEFT)) {
   28.69 - 		while (size-- > 0) {
   28.70 --			if (buf <= end)
   28.71 -+			if (buf < end)
   28.72 - 				*buf = c;
   28.73 - 			++buf;
   28.74 - 		}
   28.75 - 	}
   28.76 - 	while (i < precision--) {
   28.77 --		if (buf <= end)
   28.78 -+		if (buf < end)
   28.79 - 			*buf = '0';
   28.80 - 		++buf;
   28.81 - 	}
   28.82 - 	while (i-- > 0) {
   28.83 --		if (buf <= end)
   28.84 -+		if (buf < end)
   28.85 - 			*buf = tmp[i];
   28.86 - 		++buf;
   28.87 - 	}
   28.88 - 	while (size-- > 0) {
   28.89 --		if (buf <= end)
   28.90 -+		if (buf < end)
   28.91 - 			*buf = ' ';
   28.92 - 		++buf;
   28.93 - 	}
   28.94 -@@ -272,7 +272,8 @@ int vsnprintf(char *buf, size_t size, co
   28.95 - 				/* 'z' changed to 'Z' --davidm 1/25/99 */
   28.96 - 				/* 't' added for ptrdiff_t */
   28.97 - 
   28.98 --	/* Reject out-of-range values early */
   28.99 -+	/* Reject out-of-range values early.  Large positive sizes are
  28.100 -+	   used for unknown buffer sizes. */
  28.101 - 	if (unlikely((int) size < 0)) {
  28.102 - 		/* There can be only one.. */
  28.103 - 		static int warn = 1;
  28.104 -@@ -282,16 +283,17 @@ int vsnprintf(char *buf, size_t size, co
  28.105 - 	}
  28.106 - 
  28.107 - 	str = buf;
  28.108 --	end = buf + size - 1;
  28.109 -+	end = buf + size;
  28.110 - 
  28.111 --	if (end < buf - 1) {
  28.112 --		end = ((void *) -1);
  28.113 --		size = end - buf + 1;
  28.114 -+	/* Make sure end is always >= buf */
  28.115 -+	if (end < buf) {
  28.116 -+		end = ((void *)-1);
  28.117 -+		size = end - buf;
  28.118 - 	}
  28.119 - 
  28.120 - 	for (; *fmt ; ++fmt) {
  28.121 - 		if (*fmt != '%') {
  28.122 --			if (str <= end)
  28.123 -+			if (str < end)
  28.124 - 				*str = *fmt;
  28.125 - 			++str;
  28.126 - 			continue;
  28.127 -@@ -357,17 +359,17 @@ int vsnprintf(char *buf, size_t size, co
  28.128 - 			case 'c':
  28.129 - 				if (!(flags & LEFT)) {
  28.130 - 					while (--field_width > 0) {
  28.131 --						if (str <= end)
  28.132 -+						if (str < end)
  28.133 - 							*str = ' ';
  28.134 - 						++str;
  28.135 - 					}
  28.136 - 				}
  28.137 - 				c = (unsigned char) va_arg(args, int);
  28.138 --				if (str <= end)
  28.139 -+				if (str < end)
  28.140 - 					*str = c;
  28.141 - 				++str;
  28.142 - 				while (--field_width > 0) {
  28.143 --					if (str <= end)
  28.144 -+					if (str < end)
  28.145 - 						*str = ' ';
  28.146 - 					++str;
  28.147 - 				}
  28.148 -@@ -382,18 +384,18 @@ int vsnprintf(char *buf, size_t size, co
  28.149 - 
  28.150 - 				if (!(flags & LEFT)) {
  28.151 - 					while (len < field_width--) {
  28.152 --						if (str <= end)
  28.153 -+						if (str < end)
  28.154 - 							*str = ' ';
  28.155 - 						++str;
  28.156 - 					}
  28.157 - 				}
  28.158 - 				for (i = 0; i < len; ++i) {
  28.159 --					if (str <= end)
  28.160 -+					if (str < end)
  28.161 - 						*str = *s;
  28.162 - 					++str; ++s;
  28.163 - 				}
  28.164 - 				while (len < field_width--) {
  28.165 --					if (str <= end)
  28.166 -+					if (str < end)
  28.167 - 						*str = ' ';
  28.168 - 					++str;
  28.169 - 				}
  28.170 -@@ -426,7 +428,7 @@ int vsnprintf(char *buf, size_t size, co
  28.171 - 				continue;
  28.172 - 
  28.173 - 			case '%':
  28.174 --				if (str <= end)
  28.175 -+				if (str < end)
  28.176 - 					*str = '%';
  28.177 - 				++str;
  28.178 - 				continue;
  28.179 -@@ -449,11 +451,11 @@ int vsnprintf(char *buf, size_t size, co
  28.180 - 				break;
  28.181 - 
  28.182 - 			default:
  28.183 --				if (str <= end)
  28.184 -+				if (str < end)
  28.185 - 					*str = '%';
  28.186 - 				++str;
  28.187 - 				if (*fmt) {
  28.188 --					if (str <= end)
  28.189 -+					if (str < end)
  28.190 - 						*str = *fmt;
  28.191 - 					++str;
  28.192 - 				} else {
  28.193 -@@ -483,14 +485,13 @@ int vsnprintf(char *buf, size_t size, co
  28.194 - 		str = number(str, end, num, base,
  28.195 - 				field_width, precision, flags);
  28.196 - 	}
  28.197 --	if (str <= end)
  28.198 --		*str = '\0';
  28.199 --	else if (size > 0)
  28.200 --		/* don't write out a null byte if the buf size is zero */
  28.201 --		*end = '\0';
  28.202 --	/* the trailing null byte doesn't count towards the total
  28.203 --	* ++str;
  28.204 --	*/
  28.205 -+	if (size > 0) {
  28.206 -+		if (str < end)
  28.207 -+			*str = '\0';
  28.208 -+		else
  28.209 -+			*end = '\0';
  28.210 -+	}
  28.211 -+	/* the trailing null byte doesn't count towards the total */
  28.212 - 	return str-buf;
  28.213 - }
  28.214 - 
    29.1 --- a/patches/linux-2.6.16.32/x86-elfnote-as-preprocessor-macro.patch	Wed Nov 29 11:05:02 2006 -0700
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,43 +0,0 @@
    29.4 -diff -pruN ../orig-linux-2.6.16.29/include/linux/elfnote.h ./include/linux/elfnote.h
    29.5 ---- ../orig-linux-2.6.16.29/include/linux/elfnote.h	2006-09-19 14:06:10.000000000 +0100
    29.6 -+++ ./include/linux/elfnote.h	2006-09-19 14:06:20.000000000 +0100
    29.7 -@@ -31,22 +31,24 @@
    29.8 - /*
    29.9 -  * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
   29.10 -  * turn out to be the same size and shape), followed by the name and
   29.11 -- * desc data with appropriate padding.  The 'desc' argument includes
   29.12 -- * the assembler pseudo op defining the type of the data: .asciz
   29.13 -- * "hello, world"
   29.14 -+ * desc data with appropriate padding.  The 'desctype' argument is the
   29.15 -+ * assembler pseudo op defining the type of the data e.g. .asciz while
   29.16 -+ * 'descdata' is the data itself e.g.  "hello, world".
   29.17 -+ *
   29.18 -+ * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
   29.19 -+ *      ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
   29.20 -  */
   29.21 --.macro ELFNOTE name type desc:vararg
   29.22 --.pushsection ".note.\name"
   29.23 --  .align 4
   29.24 --  .long 2f - 1f			/* namesz */
   29.25 --  .long 4f - 3f			/* descsz */
   29.26 --  .long \type
   29.27 --1:.asciz "\name"
   29.28 --2:.align 4
   29.29 --3:\desc
   29.30 --4:.align 4
   29.31 --.popsection
   29.32 --.endm
   29.33 -+#define ELFNOTE(name, type, desctype, descdata)	\
   29.34 -+.pushsection .note.name			;	\
   29.35 -+  .align 4				;	\
   29.36 -+  .long 2f - 1f		/* namesz */	;	\
   29.37 -+  .long 4f - 3f		/* descsz */	;	\
   29.38 -+  .long type				;	\
   29.39 -+1:.asciz "name"				;	\
   29.40 -+2:.align 4				;	\
   29.41 -+3:desctype descdata			;	\
   29.42 -+4:.align 4				;	\
   29.43 -+.popsection				;
   29.44 - #else	/* !__ASSEMBLER__ */
   29.45 - #include <linux/elf.h>
   29.46 - /*
    30.1 --- a/patches/linux-2.6.16.32/x86-increase-interrupt-vector-range.patch	Wed Nov 29 11:05:02 2006 -0700
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,89 +0,0 @@
    30.4 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/entry.S ./arch/i386/kernel/entry.S
    30.5 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/entry.S	2006-09-19 14:05:44.000000000 +0100
    30.6 -+++ ./arch/i386/kernel/entry.S	2006-09-19 14:05:56.000000000 +0100
    30.7 -@@ -406,7 +406,7 @@ vector=0
    30.8 - ENTRY(irq_entries_start)
    30.9 - .rept NR_IRQS
   30.10 - 	ALIGN
   30.11 --1:	pushl $vector-256
   30.12 -+1:	pushl $~(vector)
   30.13 - 	jmp common_interrupt
   30.14 - .data
   30.15 - 	.long 1b
   30.16 -@@ -423,7 +423,7 @@ common_interrupt:
   30.17 - 
   30.18 - #define BUILD_INTERRUPT(name, nr)	\
   30.19 - ENTRY(name)				\
   30.20 --	pushl $nr-256;			\
   30.21 -+	pushl $~(nr);			\
   30.22 - 	SAVE_ALL			\
   30.23 - 	movl %esp,%eax;			\
   30.24 - 	call smp_/**/name;		\
   30.25 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/irq.c ./arch/i386/kernel/irq.c
   30.26 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/irq.c	2006-09-12 19:02:10.000000000 +0100
   30.27 -+++ ./arch/i386/kernel/irq.c	2006-09-19 14:05:56.000000000 +0100
   30.28 -@@ -53,8 +53,8 @@ static union irq_ctx *softirq_ctx[NR_CPU
   30.29 -  */
   30.30 - fastcall unsigned int do_IRQ(struct pt_regs *regs)
   30.31 - {	
   30.32 --	/* high bits used in ret_from_ code */
   30.33 --	int irq = regs->orig_eax & 0xff;
   30.34 -+	/* high bit used in ret_from_ code */
   30.35 -+	int irq = ~regs->orig_eax;
   30.36 - #ifdef CONFIG_4KSTACKS
   30.37 - 	union irq_ctx *curctx, *irqctx;
   30.38 - 	u32 *isp;
   30.39 -diff -pruN ../orig-linux-2.6.16.29/arch/x86_64/kernel/entry.S ./arch/x86_64/kernel/entry.S
   30.40 ---- ../orig-linux-2.6.16.29/arch/x86_64/kernel/entry.S	2006-09-12 19:02:10.000000000 +0100
   30.41 -+++ ./arch/x86_64/kernel/entry.S	2006-09-19 14:05:56.000000000 +0100
   30.42 -@@ -596,7 +596,7 @@ retint_kernel:	
   30.43 -  */		
   30.44 - 	.macro apicinterrupt num,func
   30.45 - 	INTR_FRAME
   30.46 --	pushq $\num-256
   30.47 -+	pushq $~(\num)
   30.48 - 	CFI_ADJUST_CFA_OFFSET 8
   30.49 - 	interrupt \func
   30.50 - 	jmp ret_from_intr
   30.51 -diff -pruN ../orig-linux-2.6.16.29/arch/x86_64/kernel/irq.c ./arch/x86_64/kernel/irq.c
   30.52 ---- ../orig-linux-2.6.16.29/arch/x86_64/kernel/irq.c	2006-09-12 19:02:10.000000000 +0100
   30.53 -+++ ./arch/x86_64/kernel/irq.c	2006-09-19 14:05:56.000000000 +0100
   30.54 -@@ -96,8 +96,8 @@ skip:
   30.55 -  */
   30.56 - asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
   30.57 - {	
   30.58 --	/* high bits used in ret_from_ code  */
   30.59 --	unsigned irq = regs->orig_rax & 0xff;
   30.60 -+	/* high bit used in ret_from_ code  */
   30.61 -+	unsigned irq = ~regs->orig_rax;
   30.62 - 
   30.63 - 	exit_idle();
   30.64 - 	irq_enter();
   30.65 -diff -pruN ../orig-linux-2.6.16.29/arch/x86_64/kernel/smp.c ./arch/x86_64/kernel/smp.c
   30.66 ---- ../orig-linux-2.6.16.29/arch/x86_64/kernel/smp.c	2006-09-12 19:02:10.000000000 +0100
   30.67 -+++ ./arch/x86_64/kernel/smp.c	2006-09-19 14:05:56.000000000 +0100
   30.68 -@@ -135,10 +135,10 @@ asmlinkage void smp_invalidate_interrupt
   30.69 - 
   30.70 - 	cpu = smp_processor_id();
   30.71 - 	/*
   30.72 --	 * orig_rax contains the interrupt vector - 256.
   30.73 -+	 * orig_rax contains the negated interrupt vector.
   30.74 - 	 * Use that to determine where the sender put the data.
   30.75 - 	 */
   30.76 --	sender = regs->orig_rax + 256 - INVALIDATE_TLB_VECTOR_START;
   30.77 -+	sender = ~regs->orig_rax - INVALIDATE_TLB_VECTOR_START;
   30.78 - 	f = &per_cpu(flush_state, sender);
   30.79 - 
   30.80 - 	if (!cpu_isset(cpu, f->flush_cpumask))
   30.81 -diff -pruN ../orig-linux-2.6.16.29/include/asm-x86_64/hw_irq.h ./include/asm-x86_64/hw_irq.h
   30.82 ---- ../orig-linux-2.6.16.29/include/asm-x86_64/hw_irq.h	2006-09-12 19:02:10.000000000 +0100
   30.83 -+++ ./include/asm-x86_64/hw_irq.h	2006-09-19 14:05:56.000000000 +0100
   30.84 -@@ -127,7 +127,7 @@ asmlinkage void IRQ_NAME(nr); \
   30.85 - __asm__( \
   30.86 - "\n.p2align\n" \
   30.87 - "IRQ" #nr "_interrupt:\n\t" \
   30.88 --	"push $" #nr "-256 ; " \
   30.89 -+	"push $~(" #nr ") ; " \
   30.90 - 	"jmp common_interrupt");
   30.91 - 
   30.92 - #if defined(CONFIG_X86_IO_APIC)
    31.1 --- a/patches/linux-2.6.16.32/x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch	Wed Nov 29 11:05:02 2006 -0700
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,143 +0,0 @@
    31.4 -diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/vmlinux.lds.S ./arch/i386/kernel/vmlinux.lds.S
    31.5 ---- ../orig-linux-2.6.16.29/arch/i386/kernel/vmlinux.lds.S	2006-09-19 14:05:48.000000000 +0100
    31.6 -+++ ./arch/i386/kernel/vmlinux.lds.S	2006-09-19 14:06:10.000000000 +0100
    31.7 -@@ -12,6 +12,12 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386"
    31.8 - OUTPUT_ARCH(i386)
    31.9 - ENTRY(phys_startup_32)
   31.10 - jiffies = jiffies_64;
   31.11 -+
   31.12 -+PHDRS {
   31.13 -+	text PT_LOAD FLAGS(5);	/* R_E */
   31.14 -+	data PT_LOAD FLAGS(7);	/* RWE */
   31.15 -+	note PT_NOTE FLAGS(4);	/* R__ */
   31.16 -+}
   31.17 - SECTIONS
   31.18 - {
   31.19 -   . = __KERNEL_START;
   31.20 -@@ -25,7 +31,7 @@ SECTIONS
   31.21 - 	KPROBES_TEXT
   31.22 - 	*(.fixup)
   31.23 - 	*(.gnu.warning)
   31.24 --	} = 0x9090
   31.25 -+	} :text = 0x9090
   31.26 - 
   31.27 -   _etext = .;			/* End of text section */
   31.28 - 
   31.29 -@@ -47,7 +53,7 @@ SECTIONS
   31.30 -   .data : AT(ADDR(.data) - LOAD_OFFSET) {	/* Data */
   31.31 - 	*(.data)
   31.32 - 	CONSTRUCTORS
   31.33 --	}
   31.34 -+	} :data
   31.35 - 
   31.36 -   . = ALIGN(4096);
   31.37 -   __nosave_begin = .;
   31.38 -@@ -154,4 +160,6 @@ SECTIONS
   31.39 -   STABS_DEBUG
   31.40 - 
   31.41 -   DWARF_DEBUG
   31.42 -+
   31.43 -+  NOTES
   31.44 - }
   31.45 -diff -pruN ../orig-linux-2.6.16.29/include/asm-generic/vmlinux.lds.h ./include/asm-generic/vmlinux.lds.h
   31.46 ---- ../orig-linux-2.6.16.29/include/asm-generic/vmlinux.lds.h	2006-09-12 19:02:10.000000000 +0100
   31.47 -+++ ./include/asm-generic/vmlinux.lds.h	2006-09-19 14:06:10.000000000 +0100
   31.48 -@@ -152,3 +152,6 @@
   31.49 - 		.stab.index 0 : { *(.stab.index) }			\
   31.50 - 		.stab.indexstr 0 : { *(.stab.indexstr) }		\
   31.51 - 		.comment 0 : { *(.comment) }
   31.52 -+
   31.53 -+#define NOTES								\
   31.54 -+		.notes : { *(.note.*) } :note
   31.55 -diff -pruN ../orig-linux-2.6.16.29/include/linux/elfnote.h ./include/linux/elfnote.h
   31.56 ---- ../orig-linux-2.6.16.29/include/linux/elfnote.h	1970-01-01 01:00:00.000000000 +0100
   31.57 -+++ ./include/linux/elfnote.h	2006-09-19 14:06:10.000000000 +0100
   31.58 -@@ -0,0 +1,88 @@
   31.59 -+#ifndef _LINUX_ELFNOTE_H
   31.60 -+#define _LINUX_ELFNOTE_H
   31.61 -+/*
   31.62 -+ * Helper macros to generate ELF Note structures, which are put into a
   31.63 -+ * PT_NOTE segment of the final vmlinux image.  These are useful for
   31.64 -+ * including name-value pairs of metadata into the kernel binary (or
   31.65 -+ * modules?) for use by external programs.
   31.66 -+ *
   31.67 -+ * Each note has three parts: a name, a type and a desc.  The name is
   31.68 -+ * intended to distinguish the note's originator, so it would be a
   31.69 -+ * company, project, subsystem, etc; it must be in a suitable form for
   31.70 -+ * use in a section name.  The type is an integer which is used to tag
   31.71 -+ * the data, and is considered to be within the "name" namespace (so
   31.72 -+ * "FooCo"'s type 42 is distinct from "BarProj"'s type 42).  The
   31.73 -+ * "desc" field is the actual data.  There are no constraints on the
   31.74 -+ * desc field's contents, though typically they're fairly small.
   31.75 -+ *
   31.76 -+ * All notes from a given NAME are put into a section named
   31.77 -+ * .note.NAME.  When the kernel image is finally linked, all the notes
   31.78 -+ * are packed into a single .notes section, which is mapped into the
   31.79 -+ * PT_NOTE segment.  Because notes for a given name are grouped into
   31.80 -+ * the same section, they'll all be adjacent the output file.
   31.81 -+ *
   31.82 -+ * This file defines macros for both C and assembler use.  Their
   31.83 -+ * syntax is slightly different, but they're semantically similar.
   31.84 -+ *
   31.85 -+ * See the ELF specification for more detail about ELF notes.
   31.86 -+ */
   31.87 -+
   31.88 -+#ifdef __ASSEMBLER__
   31.89 -+/*
   31.90 -+ * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
   31.91 -+ * turn out to be the same size and shape), followed by the name and
   31.92 -+ * desc data with appropriate padding.  The 'desc' argument includes
   31.93 -+ * the assembler pseudo op defining the type of the data: .asciz
   31.94 -+ * "hello, world"
   31.95 -+ */
   31.96 -+.macro ELFNOTE name type desc:vararg
   31.97 -+.pushsection ".note.\name"
   31.98 -+  .align 4
   31.99 -+  .long 2f - 1f			/* namesz */
  31.100 -+  .long 4f - 3f			/* descsz */
  31.101 -+  .long \type
  31.102 -+1:.asciz "\name"
  31.103 -+2:.align 4
  31.104 -+3:\desc
  31.105 -+4:.align 4
  31.106 -+.popsection
  31.107 -+.endm
  31.108 -+#else	/* !__ASSEMBLER__ */
  31.109 -+#include <linux/elf.h>
  31.110 -+/*
  31.111 -+ * Use an anonymous structure which matches the shape of
  31.112 -+ * Elf{32,64}_Nhdr, but includes the name and desc data.  The size and
  31.113 -+ * type of name and desc depend on the macro arguments.  "name" must
  31.114 -+ * be a literal string, and "desc" must be passed by value.  You may
  31.115 -+ * only define one note per line, since __LINE__ is used to generate
  31.116 -+ * unique symbols.
  31.117 -+ */
  31.118 -+#define _ELFNOTE_PASTE(a,b)	a##b
  31.119 -+#define _ELFNOTE(size, name, unique, type, desc)			\
  31.120 -+	static const struct {						\
  31.121 -+		struct elf##size##_note _nhdr;				\
  31.122 -+		unsigned char _name[sizeof(name)]			\
  31.123 -+		__attribute__((aligned(sizeof(Elf##size##_Word))));	\
  31.124 -+		typeof(desc) _desc					\
  31.125 -+			     __attribute__((aligned(sizeof(Elf##size##_Word)))); \
  31.126 -+	} _ELFNOTE_PASTE(_note_, unique)				\
  31.127 -+		__attribute_used__					\
  31.128 -+		__attribute__((section(".note." name),			\
  31.129 -+			       aligned(sizeof(Elf##size##_Word)),	\
  31.130 -+			       unused)) = {				\
  31.131 -+		{							\
  31.132 -+			sizeof(name),					\
  31.133 -+			sizeof(desc),					\
  31.134 -+			type,						\
  31.135 -+		},							\
  31.136 -+		name,							\
  31.137 -+		desc							\
  31.138 -+	}
  31.139 -+#define ELFNOTE(size, name, type, desc)		\
  31.140 -+	_ELFNOTE(size, name, __LINE__, type, desc)
  31.141 -+
  31.142 -+#define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc)
  31.143 -+#define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc)
  31.144 -+#endif	/* __ASSEMBLER__ */
  31.145 -+
  31.146 -+#endif /* _LINUX_ELFNOTE_H */
    32.1 --- a/patches/linux-2.6.16.32/x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch	Wed Nov 29 11:05:02 2006 -0700
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,84 +0,0 @@
    32.4 -diff -pruN ../orig-linux-2.6.16.29/arch/x86_64/kernel/vmlinux.lds.S ./arch/x86_64/kernel/vmlinux.lds.S
    32.5 ---- ../orig-linux-2.6.16.29/arch/x86_64/kernel/vmlinux.lds.S	2006-09-12 19:02:10.000000000 +0100
    32.6 -+++ ./arch/x86_64/kernel/vmlinux.lds.S	2006-09-19 14:06:15.000000000 +0100
    32.7 -@@ -14,6 +14,12 @@ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86
    32.8 - OUTPUT_ARCH(i386:x86-64)
    32.9 - ENTRY(phys_startup_64)
   32.10 - jiffies_64 = jiffies;
   32.11 -+PHDRS {
   32.12 -+	text PT_LOAD FLAGS(5);	/* R_E */
   32.13 -+	data PT_LOAD FLAGS(7);	/* RWE */
   32.14 -+	user PT_LOAD FLAGS(7);	/* RWE */
   32.15 -+	note PT_NOTE FLAGS(4);	/* R__ */
   32.16 -+}
   32.17 - SECTIONS
   32.18 - {
   32.19 -   . = __START_KERNEL;
   32.20 -@@ -26,7 +32,7 @@ SECTIONS
   32.21 - 	KPROBES_TEXT
   32.22 - 	*(.fixup)
   32.23 - 	*(.gnu.warning)
   32.24 --	} = 0x9090
   32.25 -+	} :text = 0x9090
   32.26 -   				/* out-of-line lock text */
   32.27 -   .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
   32.28 - 
   32.29 -@@ -43,17 +49,10 @@ SECTIONS
   32.30 -   .data : AT(ADDR(.data) - LOAD_OFFSET) {
   32.31 - 	*(.data)
   32.32 - 	CONSTRUCTORS
   32.33 --	}
   32.34 -+	} :data
   32.35 - 
   32.36 -   _edata = .;			/* End of data section */
   32.37 - 
   32.38 --  __bss_start = .;		/* BSS */
   32.39 --  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
   32.40 --	*(.bss.page_aligned)	
   32.41 --	*(.bss)
   32.42 --	}
   32.43 --  __bss_stop = .;
   32.44 --
   32.45 -   . = ALIGN(PAGE_SIZE);
   32.46 -   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
   32.47 -   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
   32.48 -@@ -75,7 +74,7 @@ SECTIONS
   32.49 - #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
   32.50 - 
   32.51 -   . = VSYSCALL_ADDR;
   32.52 --  .vsyscall_0 :	 AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
   32.53 -+  .vsyscall_0 :	 AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) } :user
   32.54 -   __vsyscall_0 = VSYSCALL_VIRT_ADDR;
   32.55 - 
   32.56 -   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
   32.57 -@@ -118,7 +117,7 @@ SECTIONS
   32.58 -   . = ALIGN(8192);		/* init_task */
   32.59 -   .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
   32.60 - 	*(.data.init_task)
   32.61 --  }
   32.62 -+  } :data
   32.63 - 
   32.64 -   . = ALIGN(4096);
   32.65 -   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
   32.66 -@@ -188,6 +187,14 @@ SECTIONS
   32.67 -   . = ALIGN(4096);
   32.68 -   __nosave_end = .;
   32.69 - 
   32.70 -+  __bss_start = .;		/* BSS */
   32.71 -+  . = ALIGN(4096);
   32.72 -+  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
   32.73 -+	*(.bss.page_aligned)
   32.74 -+	*(.bss)
   32.75 -+	}
   32.76 -+  __bss_stop = .;
   32.77 -+
   32.78 -   _end = . ;
   32.79 - 
   32.80 -   /* Sections to be discarded */
   32.81 -@@ -201,4 +208,6 @@ SECTIONS
   32.82 -   STABS_DEBUG
   32.83 - 
   32.84 -   DWARF_DEBUG
   32.85 -+
   32.86 -+  NOTES
   32.87 - }
    33.1 --- a/patches/linux-2.6.16.32/xen-hotplug.patch	Wed Nov 29 11:05:02 2006 -0700
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,12 +0,0 @@
    33.4 -diff -pruN ../orig-linux-2.6.16.29/fs/proc/proc_misc.c ./fs/proc/proc_misc.c
    33.5 ---- ../orig-linux-2.6.16.29/fs/proc/proc_misc.c	2006-09-12 19:02:10.000000000 +0100
    33.6 -+++ ./fs/proc/proc_misc.c	2006-09-19 14:06:00.000000000 +0100
    33.7 -@@ -433,7 +433,7 @@ static int show_stat(struct seq_file *p,
    33.8 - 		(unsigned long long)cputime64_to_clock_t(irq),
    33.9 - 		(unsigned long long)cputime64_to_clock_t(softirq),
   33.10 - 		(unsigned long long)cputime64_to_clock_t(steal));
   33.11 --	for_each_online_cpu(i) {
   33.12 -+	for_each_cpu(i) {
   33.13 - 
   33.14 - 		/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
   33.15 - 		user = kstat_cpu(i).cpustat.user;
    34.1 --- a/patches/linux-2.6.16.32/xenoprof-generic.patch	Wed Nov 29 11:05:02 2006 -0700
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,662 +0,0 @@
    34.4 -diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/buffer_sync.c ./drivers/oprofile/buffer_sync.c
    34.5 ---- ../orig-linux-2.6.16.29/drivers/oprofile/buffer_sync.c	2006-11-06 14:46:52.000000000 -0800
    34.6 -+++ ./drivers/oprofile/buffer_sync.c	2006-11-06 15:16:52.000000000 -0800
    34.7 -@@ -6,6 +6,10 @@
    34.8 -  *
    34.9 -  * @author John Levon <levon@movementarian.org>
   34.10 -  *
   34.11 -+ * Modified by Aravind Menon for Xen
   34.12 -+ * These modifications are:
   34.13 -+ * Copyright (C) 2005 Hewlett-Packard Co.
   34.14 -+ *
   34.15 -  * This is the core of the buffer management. Each
   34.16 -  * CPU buffer is processed and entered into the
   34.17 -  * global event buffer. Such processing is necessary
   34.18 -@@ -38,6 +42,7 @@ static cpumask_t marked_cpus = CPU_MASK_
   34.19 - static DEFINE_SPINLOCK(task_mortuary);
   34.20 - static void process_task_mortuary(void);
   34.21 - 
   34.22 -+static int cpu_current_domain[NR_CPUS];
   34.23 - 
   34.24 - /* Take ownership of the task struct and place it on the
   34.25 -  * list for processing. Only after two full buffer syncs
   34.26 -@@ -146,6 +151,11 @@ static void end_sync(void)
   34.27 - int sync_start(void)
   34.28 - {
   34.29 - 	int err;
   34.30 -+	int i;
   34.31 -+
   34.32 -+	for (i = 0; i < NR_CPUS; i++) {
   34.33 -+		cpu_current_domain[i] = COORDINATOR_DOMAIN;
   34.34 -+	}
   34.35 - 
   34.36 - 	start_cpu_work();
   34.37 - 
   34.38 -@@ -275,15 +285,31 @@ static void add_cpu_switch(int i)
   34.39 - 	last_cookie = INVALID_COOKIE;
   34.40 - }
   34.41 - 
   34.42 --static void add_kernel_ctx_switch(unsigned int in_kernel)
   34.43 -+static void add_cpu_mode_switch(unsigned int cpu_mode)
   34.44 - {
   34.45 - 	add_event_entry(ESCAPE_CODE);
   34.46 --	if (in_kernel)
   34.47 --		add_event_entry(KERNEL_ENTER_SWITCH_CODE); 
   34.48 --	else
   34.49 --		add_event_entry(KERNEL_EXIT_SWITCH_CODE); 
   34.50 -+	switch (cpu_mode) {
   34.51 -+	case CPU_MODE_USER:
   34.52 -+		add_event_entry(USER_ENTER_SWITCH_CODE);
   34.53 -+		break;
   34.54 -+	case CPU_MODE_KERNEL:
   34.55 -+		add_event_entry(KERNEL_ENTER_SWITCH_CODE);
   34.56 -+		break;
   34.57 -+	case CPU_MODE_XEN:
   34.58 -+		add_event_entry(XEN_ENTER_SWITCH_CODE);
   34.59 -+	  	break;
   34.60 -+	default:
   34.61 -+		break;
   34.62 -+	}
   34.63 - }
   34.64 -- 
   34.65 -+
   34.66 -+static void add_domain_switch(unsigned long domain_id)
   34.67 -+{
   34.68 -+	add_event_entry(ESCAPE_CODE);
   34.69 -+	add_event_entry(DOMAIN_SWITCH_CODE);
   34.70 -+	add_event_entry(domain_id);
   34.71 -+}
   34.72 -+
   34.73 - static void
   34.74 - add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
   34.75 - {
   34.76 -@@ -348,9 +374,9 @@ static int add_us_sample(struct mm_struc
   34.77 -  * for later lookup from userspace.
   34.78 -  */
   34.79 - static int
   34.80 --add_sample(struct mm_struct * mm, struct op_sample * s, int in_kernel)
   34.81 -+add_sample(struct mm_struct * mm, struct op_sample * s, int cpu_mode)
   34.82 - {
   34.83 --	if (in_kernel) {
   34.84 -+	if (cpu_mode >= CPU_MODE_KERNEL) {
   34.85 - 		add_sample_entry(s->eip, s->event);
   34.86 - 		return 1;
   34.87 - 	} else if (mm) {
   34.88 -@@ -496,15 +522,21 @@ void sync_buffer(int cpu)
   34.89 - 	struct mm_struct *mm = NULL;
   34.90 - 	struct task_struct * new;
   34.91 - 	unsigned long cookie = 0;
   34.92 --	int in_kernel = 1;
   34.93 -+	int cpu_mode = 1;
   34.94 - 	unsigned int i;
   34.95 - 	sync_buffer_state state = sb_buffer_start;
   34.96 - 	unsigned long available;
   34.97 -+	int domain_switch = 0;
   34.98 - 
   34.99 - 	down(&buffer_sem);
  34.100 -  
  34.101 - 	add_cpu_switch(cpu);
  34.102 - 
  34.103 -+	/* We need to assign the first samples in this CPU buffer to the
  34.104 -+	   same domain that we were processing at the last sync_buffer */
  34.105 -+	if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
  34.106 -+		add_domain_switch(cpu_current_domain[cpu]);
  34.107 -+	}
  34.108 - 	/* Remember, only we can modify tail_pos */
  34.109 - 
  34.110 - 	available = get_slots(cpu_buf);
  34.111 -@@ -512,16 +544,18 @@ void sync_buffer(int cpu)
  34.112 - 	for (i = 0; i < available; ++i) {
  34.113 - 		struct op_sample * s = &cpu_buf->buffer[cpu_buf->tail_pos];
  34.114 -  
  34.115 --		if (is_code(s->eip)) {
  34.116 --			if (s->event <= CPU_IS_KERNEL) {
  34.117 --				/* kernel/userspace switch */
  34.118 --				in_kernel = s->event;
  34.119 -+		if (is_code(s->eip) && !domain_switch) {
  34.120 -+			if (s->event <= CPU_MODE_XEN) {
  34.121 -+				/* xen/kernel/userspace switch */
  34.122 -+				cpu_mode = s->event;
  34.123 - 				if (state == sb_buffer_start)
  34.124 - 					state = sb_sample_start;
  34.125 --				add_kernel_ctx_switch(s->event);
  34.126 -+				add_cpu_mode_switch(s->event);
  34.127 - 			} else if (s->event == CPU_TRACE_BEGIN) {
  34.128 - 				state = sb_bt_start;
  34.129 - 				add_trace_begin();
  34.130 -+			} else if (s->event == CPU_DOMAIN_SWITCH) {
  34.131 -+					domain_switch = 1;				
  34.132 - 			} else {
  34.133 - 				struct mm_struct * oldmm = mm;
  34.134 - 
  34.135 -@@ -535,11 +569,21 @@ void sync_buffer(int cpu)
  34.136 - 				add_user_ctx_switch(new, cookie);
  34.137 - 			}
  34.138 - 		} else {
  34.139 --			if (state >= sb_bt_start &&
  34.140 --			    !add_sample(mm, s, in_kernel)) {
  34.141 --				if (state == sb_bt_start) {
  34.142 --					state = sb_bt_ignore;
  34.143 --					atomic_inc(&oprofile_stats.bt_lost_no_mapping);
  34.144 -+			if (domain_switch) {
  34.145 -+				cpu_current_domain[cpu] = s->eip;
  34.146 -+				add_domain_switch(s->eip);
  34.147 -+				domain_switch = 0;
  34.148 -+			} else {
  34.149 -+				if (cpu_current_domain[cpu] !=
  34.150 -+				    COORDINATOR_DOMAIN) {
  34.151 -+					add_sample_entry(s->eip, s->event);
  34.152 -+				}
  34.153 -+				else  if (state >= sb_bt_start &&
  34.154 -+				    !add_sample(mm, s, cpu_mode)) {
  34.155 -+					if (state == sb_bt_start) {
  34.156 -+						state = sb_bt_ignore;
  34.157 -+						atomic_inc(&oprofile_stats.bt_lost_no_mapping);
  34.158 -+					}
  34.159 - 				}
  34.160 - 			}
  34.161 - 		}
  34.162 -@@ -548,6 +592,11 @@ void sync_buffer(int cpu)
  34.163 - 	}
  34.164 - 	release_mm(mm);
  34.165 - 
  34.166 -+	/* We reset domain to COORDINATOR at each CPU switch */
  34.167 -+	if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
  34.168 -+		add_domain_switch(COORDINATOR_DOMAIN);
  34.169 -+	}
  34.170 -+
  34.171 - 	mark_done(cpu);
  34.172 - 
  34.173 - 	up(&buffer_sem);
  34.174 -diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.c ./drivers/oprofile/cpu_buffer.c
  34.175 ---- ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.c	2006-11-06 14:46:52.000000000 -0800
  34.176 -+++ ./drivers/oprofile/cpu_buffer.c	2006-11-06 14:47:55.000000000 -0800
  34.177 -@@ -6,6 +6,10 @@
  34.178 -  *
  34.179 -  * @author John Levon <levon@movementarian.org>
  34.180 -  *
  34.181 -+ * Modified by Aravind Menon for Xen
  34.182 -+ * These modifications are:
  34.183 -+ * Copyright (C) 2005 Hewlett-Packard Co.
  34.184 -+ *
  34.185 -  * Each CPU has a local buffer that stores PC value/event
  34.186 -  * pairs. We also log context switches when we notice them.
  34.187 -  * Eventually each CPU's buffer is processed into the global
  34.188 -@@ -34,6 +38,8 @@ static void wq_sync_buffer(void *);
  34.189 - #define DEFAULT_TIMER_EXPIRE (HZ / 10)
  34.190 - static int work_enabled;
  34.191 - 
  34.192 -+static int32_t current_domain = COORDINATOR_DOMAIN;
  34.193 -+
  34.194 - void free_cpu_buffers(void)
  34.195 - {
  34.196 - 	int i;
  34.197 -@@ -58,7 +64,7 @@ int alloc_cpu_buffers(void)
  34.198 - 			goto fail;
  34.199 -  
  34.200 - 		b->last_task = NULL;
  34.201 --		b->last_is_kernel = -1;
  34.202 -+		b->last_cpu_mode = -1;
  34.203 - 		b->tracing = 0;
  34.204 - 		b->buffer_size = buffer_size;
  34.205 - 		b->tail_pos = 0;
  34.206 -@@ -114,7 +120,7 @@ void cpu_buffer_reset(struct oprofile_cp
  34.207 - 	 * collected will populate the buffer with proper
  34.208 - 	 * values to initialize the buffer
  34.209 - 	 */
  34.210 --	cpu_buf->last_is_kernel = -1;
  34.211 -+	cpu_buf->last_cpu_mode = -1;
  34.212 - 	cpu_buf->last_task = NULL;
  34.213 - }
  34.214 - 
  34.215 -@@ -164,13 +170,13 @@ add_code(struct oprofile_cpu_buffer * bu
  34.216 -  * because of the head/tail separation of the writer and reader
  34.217 -  * of the CPU buffer.
  34.218 -  *
  34.219 -- * is_kernel is needed because on some architectures you cannot
  34.220 -+ * cpu_mode is needed because on some architectures you cannot
  34.221 -  * tell if you are in kernel or user space simply by looking at
  34.222 -- * pc. We tag this in the buffer by generating kernel enter/exit
  34.223 -- * events whenever is_kernel changes
  34.224 -+ * pc. We tag this in the buffer by generating kernel/user (and xen)
  34.225 -+ *  enter events whenever cpu_mode changes
  34.226 -  */
  34.227 - static int log_sample(struct oprofile_cpu_buffer * cpu_buf, unsigned long pc,
  34.228 --		      int is_kernel, unsigned long event)
  34.229 -+		      int cpu_mode, unsigned long event)
  34.230 - {
  34.231 - 	struct task_struct * task;
  34.232 - 
  34.233 -@@ -181,18 +187,18 @@ static int log_sample(struct oprofile_cp
  34.234 - 		return 0;
  34.235 - 	}
  34.236 - 
  34.237 --	is_kernel = !!is_kernel;
  34.238 --
  34.239 - 	task = current;
  34.240 - 
  34.241 - 	/* notice a switch from user->kernel or vice versa */
  34.242 --	if (cpu_buf->last_is_kernel != is_kernel) {
  34.243 --		cpu_buf->last_is_kernel = is_kernel;
  34.244 --		add_code(cpu_buf, is_kernel);
  34.245 -+	if (cpu_buf->last_cpu_mode != cpu_mode) {
  34.246 -+		cpu_buf->last_cpu_mode = cpu_mode;
  34.247 -+		add_code(cpu_buf, cpu_mode);
  34.248 - 	}
  34.249 --
  34.250 -+	
  34.251 - 	/* notice a task switch */
  34.252 --	if (cpu_buf->last_task != task) {
  34.253 -+	/* if not processing other domain samples */
  34.254 -+	if ((cpu_buf->last_task != task) &&
  34.255 -+	    (current_domain == COORDINATOR_DOMAIN)) {
  34.256 - 		cpu_buf->last_task = task;
  34.257 - 		add_code(cpu_buf, (unsigned long)task);
  34.258 - 	}
  34.259 -@@ -269,6 +275,25 @@ void oprofile_add_trace(unsigned long pc
  34.260 - 	add_sample(cpu_buf, pc, 0);
  34.261 - }
  34.262 - 
  34.263 -+int oprofile_add_domain_switch(int32_t domain_id)
  34.264 -+{
  34.265 -+	struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
  34.266 -+
  34.267 -+	/* should have space for switching into and out of domain 
  34.268 -+	   (2 slots each) plus one sample and one cpu mode switch */
  34.269 -+	if (((nr_available_slots(cpu_buf) < 6) && 
  34.270 -+	     (domain_id != COORDINATOR_DOMAIN)) ||
  34.271 -+	    (nr_available_slots(cpu_buf) < 2))
  34.272 -+		return 0;
  34.273 -+
  34.274 -+	add_code(cpu_buf, CPU_DOMAIN_SWITCH);
  34.275 -+	add_sample(cpu_buf, domain_id, 0);
  34.276 -+
  34.277 -+	current_domain = domain_id;
  34.278 -+
  34.279 -+	return 1;
  34.280 -+}
  34.281 -+
  34.282 - /*
  34.283 -  * This serves to avoid cpu buffer overflow, and makes sure
  34.284 -  * the task mortuary progresses
  34.285 -diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.h ./drivers/oprofile/cpu_buffer.h
  34.286 ---- ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.h	2006-11-06 14:46:52.000000000 -0800
  34.287 -+++ ./drivers/oprofile/cpu_buffer.h	2006-11-06 14:47:55.000000000 -0800
  34.288 -@@ -36,7 +36,7 @@ struct oprofile_cpu_buffer {
  34.289 - 	volatile unsigned long tail_pos;
  34.290 - 	unsigned long buffer_size;
  34.291 - 	struct task_struct * last_task;
  34.292 --	int last_is_kernel;
  34.293 -+	int last_cpu_mode;
  34.294 - 	int tracing;
  34.295 - 	struct op_sample * buffer;
  34.296 - 	unsigned long sample_received;
  34.297 -@@ -51,7 +51,10 @@ extern struct oprofile_cpu_buffer cpu_bu
  34.298 - void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf);
  34.299 - 
  34.300 - /* transient events for the CPU buffer -> event buffer */
  34.301 --#define CPU_IS_KERNEL 1
  34.302 --#define CPU_TRACE_BEGIN 2
  34.303 -+#define CPU_MODE_USER           0
  34.304 -+#define CPU_MODE_KERNEL         1
  34.305 -+#define CPU_MODE_XEN            2
  34.306 -+#define CPU_TRACE_BEGIN         3
  34.307 -+#define CPU_DOMAIN_SWITCH       4
  34.308 - 
  34.309 - #endif /* OPROFILE_CPU_BUFFER_H */
  34.310 -diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/event_buffer.h ./drivers/oprofile/event_buffer.h
  34.311 ---- ../orig-linux-2.6.16.29/drivers/oprofile/event_buffer.h	2006-11-06 14:46:52.000000000 -0800
  34.312 -+++ ./drivers/oprofile/event_buffer.h	2006-11-06 14:47:55.000000000 -0800
  34.313 -@@ -29,15 +29,20 @@ void wake_up_buffer_waiter(void);
  34.314 - #define CPU_SWITCH_CODE 		2
  34.315 - #define COOKIE_SWITCH_CODE 		3
  34.316 - #define KERNEL_ENTER_SWITCH_CODE	4
  34.317 --#define KERNEL_EXIT_SWITCH_CODE		5
  34.318 -+#define USER_ENTER_SWITCH_CODE		5
  34.319 - #define MODULE_LOADED_CODE		6
  34.320 - #define CTX_TGID_CODE			7
  34.321 - #define TRACE_BEGIN_CODE		8
  34.322 - #define TRACE_END_CODE			9
  34.323 -+#define XEN_ENTER_SWITCH_CODE		10
  34.324 -+#define DOMAIN_SWITCH_CODE		11
  34.325 -  
  34.326 - #define INVALID_COOKIE ~0UL
  34.327 - #define NO_COOKIE 0UL
  34.328 - 
  34.329 -+/* Constant used to refer to coordinator domain (Xen) */
  34.330 -+#define COORDINATOR_DOMAIN -1
  34.331 -+
  34.332 - /* add data to the event buffer */
  34.333 - void add_event_entry(unsigned long data);
  34.334 -  
  34.335 -diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/oprof.c ./drivers/oprofile/oprof.c
  34.336 ---- ../orig-linux-2.6.16.29/drivers/oprofile/oprof.c	2006-11-06 14:46:52.000000000 -0800
  34.337 -+++ ./drivers/oprofile/oprof.c	2006-11-06 14:47:55.000000000 -0800
  34.338 -@@ -5,6 +5,10 @@
  34.339 -  * @remark Read the file COPYING
  34.340 -  *
  34.341 -  * @author John Levon <levon@movementarian.org>
  34.342 -+ *
  34.343 -+ * Modified by Aravind Menon for Xen
  34.344 -+ * These modifications are:
  34.345 -+ * Copyright (C) 2005 Hewlett-Packard Co.
  34.346 -  */
  34.347 - 
  34.348 - #include <linux/kernel.h>
  34.349 -@@ -19,7 +23,7 @@
  34.350 - #include "cpu_buffer.h"
  34.351 - #include "buffer_sync.h"
  34.352 - #include "oprofile_stats.h"
  34.353 -- 
  34.354 -+
  34.355 - struct oprofile_operations oprofile_ops;
  34.356 - 
  34.357 - unsigned long oprofile_started;
  34.358 -@@ -33,6 +37,32 @@ static DECLARE_MUTEX(start_sem);
  34.359 -  */
  34.360 - static int timer = 0;
  34.361 - 
  34.362 -+int oprofile_set_active(int active_domains[], unsigned int adomains)
  34.363 -+{
  34.364 -+	int err;
  34.365 -+
  34.366 -+	if (!oprofile_ops.set_active)
  34.367 -+		return -EINVAL;
  34.368 -+
  34.369 -+	down(&start_sem);
  34.370 -+	err = oprofile_ops.set_active(active_domains, adomains);
  34.371 -+	up(&start_sem);
  34.372 -+	return err;
  34.373 -+}
  34.374 -+
  34.375 -+int oprofile_set_passive(int passive_domains[], unsigned int pdomains)
  34.376 -+{
  34.377 -+	int err;
  34.378 -+
  34.379 -+	if (!oprofile_ops.set_passive)
  34.380 -+		return -EINVAL;
  34.381 -+
  34.382 -+	down(&start_sem);
  34.383 -+	err = oprofile_ops.set_passive(passive_domains, pdomains);
  34.384 -+	up(&start_sem);
  34.385 -+	return err;
  34.386 -+}
  34.387 -+
  34.388 - int oprofile_setup(void)
  34.389 - {
  34.390 - 	int err;
  34.391 -diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/oprof.h ./drivers/oprofile/oprof.h
  34.392 ---- ../orig-linux-2.6.16.29/drivers/oprofile/oprof.h	2006-11-06 14:46:52.000000000 -0800
  34.393 -+++ ./drivers/oprofile/oprof.h	2006-11-06 14:47:55.000000000 -0800
  34.394 -@@ -35,5 +35,8 @@ void oprofile_create_files(struct super_
  34.395 - void oprofile_timer_init(struct oprofile_operations * ops);
  34.396 - 
  34.397 - int oprofile_set_backtrace(unsigned long depth);
  34.398 -+
  34.399 -+int oprofile_set_active(int active_domains[], unsigned int adomains);
  34.400 -+int oprofile_set_passive(int passive_domains[], unsigned int pdomains);
  34.401 -  
  34.402 - #endif /* OPROF_H */
  34.403 -diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/oprofile_files.c ./drivers/oprofile/oprofile_files.c
  34.404 ---- ../orig-linux-2.6.16.29/drivers/oprofile/oprofile_files.c	2006-11-06 14:46:52.000000000 -0800
  34.405 -+++ ./drivers/oprofile/oprofile_files.c	2006-11-06 14:47:55.000000000 -0800
  34.406 -@@ -5,15 +5,21 @@
  34.407 -  * @remark Read the file COPYING
  34.408 -  *
  34.409 -  * @author John Levon <levon@movementarian.org>
  34.410 -+ *
  34.411 -+ * Modified by Aravind Menon for Xen
  34.412 -+ * These modifications are:
  34.413 -+ * Copyright (C) 2005 Hewlett-Packard Co.	
  34.414 -  */
  34.415 - 
  34.416 - #include <linux/fs.h>
  34.417 - #include <linux/oprofile.h>
  34.418 -+#include <asm/uaccess.h>
  34.419 -+#include <linux/ctype.h>
  34.420 - 
  34.421 - #include "event_buffer.h"
  34.422 - #include "oprofile_stats.h"
  34.423 - #include "oprof.h"
  34.424 -- 
  34.425 -+
  34.426 - unsigned long fs_buffer_size = 131072;
  34.427 - unsigned long fs_cpu_buffer_size = 8192;
  34.428 - unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
  34.429 -@@ -117,11 +123,202 @@ static ssize_t dump_write(struct file * 
  34.430 - static struct file_operations dump_fops = {
  34.431 - 	.write		= dump_write,
  34.432 - };
  34.433 -- 
  34.434 -+
  34.435 -+#define TMPBUFSIZE 512
  34.436 -+
  34.437 -+static unsigned int adomains = 0;
  34.438 -+static int active_domains[MAX_OPROF_DOMAINS + 1];
  34.439 -+static DEFINE_MUTEX(adom_mutex);
  34.440 -+
  34.441 -+static ssize_t adomain_write(struct file * file, char const __user * buf, 
  34.442 -+			     size_t count, loff_t * offset)
  34.443 -+{
  34.444 -+	char *tmpbuf;
  34.445 -+	char *startp, *endp;
  34.446 -+	int i;
  34.447 -+	unsigned long val;
  34.448 -+	ssize_t retval = count;
  34.449 -+	
  34.450 -+	if (*offset)
  34.451 -+		return -EINVAL;	
  34.452 -+	if (count > TMPBUFSIZE - 1)
  34.453 -+		return -EINVAL;
  34.454 -+
  34.455 -+	if (!(tmpbuf = kmalloc(TMPBUFSIZE, GFP_KERNEL)))
  34.456 -+		return -ENOMEM;
  34.457 -+
  34.458 -+	if (copy_from_user(tmpbuf, buf, count)) {
  34.459 -+		kfree(tmpbuf);
  34.460 -+		return -EFAULT;
  34.461 -+	}
  34.462 -+	tmpbuf[count] = 0;
  34.463 -+
  34.464 -+	mutex_lock(&adom_mutex);
  34.465 -+
  34.466 -+	startp = tmpbuf;
  34.467 -+	/* Parse one more than MAX_OPROF_DOMAINS, for easy error checking */
  34.468 -+	for (i = 0; i <= MAX_OPROF_DOMAINS; i++) {
  34.469 -+		val = simple_strtoul(startp, &endp, 0);
  34.470 -+		if (endp == startp)
  34.471 -+			break;
  34.472 -+		while (ispunct(*endp) || isspace(*endp))
  34.473 -+			endp++;
  34.474 -+		active_domains[i] = val;
  34.475 -+		if (active_domains[i] != val)
  34.476 -+			/* Overflow, force error below */
  34.477 -+			i = MAX_OPROF_DOMAINS + 1;
  34.478 -+		startp = endp;
  34.479 -+	}
  34.480 -+	/* Force error on trailing junk */
  34.481 -+	adomains = *startp ? MAX_OPROF_DOMAINS + 1 : i;
  34.482 -+
  34.483 -+	kfree(tmpbuf);
  34.484 -+
  34.485 -+	if (adomains > MAX_OPROF_DOMAINS
  34.486 -+	    || oprofile_set_active(active_domains, adomains)) {
  34.487 -+		adomains = 0;
  34.488 -+		retval = -EINVAL;
  34.489 -+	}
  34.490 -+
  34.491 -+	mutex_unlock(&adom_mutex);
  34.492 -+	return retval;
  34.493 -+}
  34.494 -+
  34.495 -+static ssize_t adomain_read(struct file * file, char __user * buf, 
  34.496 -+			    size_t count, loff_t * offset)
  34.497 -+{
  34.498 -+	char * tmpbuf;
  34.499 -+	size_t len;
  34.500 -+	int i;
  34.501 -+	ssize_t retval;
  34.502 -+
  34.503 -+	if (!(tmpbuf = kmalloc(TMPBUFSIZE, GFP_KERNEL)))
  34.504 -+		return -ENOMEM;
  34.505 -+
  34.506 -+	mutex_lock(&adom_mutex);
  34.507 -+
  34.508 -+	len = 0;
  34.509 -+	for (i = 0; i < adomains; i++)
  34.510 -+		len += snprintf(tmpbuf + len,
  34.511 -+				len < TMPBUFSIZE ? TMPBUFSIZE - len : 0,
  34.512 -+				"%u ", active_domains[i]);
  34.513 -+	WARN_ON(len > TMPBUFSIZE);
  34.514 -+	if (len != 0 && len <= TMPBUFSIZE)
  34.515 -+		tmpbuf[len-1] = '\n';
  34.516 -+
  34.517 -+	mutex_unlock(&adom_mutex);
  34.518 -+
  34.519 -+	retval = simple_read_from_buffer(buf, count, offset, tmpbuf, len);
  34.520 -+
  34.521 -+	kfree(tmpbuf);
  34.522 -+	return retval;
  34.523 -+}
  34.524 -+
  34.525 -+
  34.526 -+static struct file_operations active_domain_ops = {
  34.527 -+	.read		= adomain_read,
  34.528 -+	.write		= adomain_write,
  34.529 -+};
  34.530 -+
  34.531 -+static unsigned int pdomains = 0;
  34.532 -+static int passive_domains[MAX_OPROF_DOMAINS];
  34.533 -+static DEFINE_MUTEX(pdom_mutex);
  34.534 -+
  34.535 -+static ssize_t pdomain_write(struct file * file, char const __user * buf, 
  34.536 -+			     size_t count, loff_t * offset)
  34.537 -+{
  34.538 -+	char *tmpbuf;
  34.539 -+	char *startp, *endp;
  34.540 -+	int i;
  34.541 -+	unsigned long val;
  34.542 -+	ssize_t retval = count;
  34.543 -+	
  34.544 -+	if (*offset)
  34.545 -+		return -EINVAL;	
  34.546 -+	if (count > TMPBUFSIZE - 1)
  34.547 -+		return -EINVAL;
  34.548 -+
  34.549 -+	if (!(tmpbuf = kmalloc(TMPBUFSIZE, GFP_KERNEL)))
  34.550 -+		return -ENOMEM;
  34.551 -+
  34.552 -+	if (copy_from_user(tmpbuf, buf, count)) {
  34.553 -+		kfree(tmpbuf);
  34.554 -+		return -EFAULT;
  34.555 -+	}
  34.556 -+	tmpbuf[count] = 0;
  34.557 -+
  34.558 -+	mutex_lock(&pdom_mutex);
  34.559 -+
  34.560 -+	startp = tmpbuf;
  34.561 -+	/* Parse one more than MAX_OPROF_DOMAINS, for easy error checking */
  34.562 -+	for (i = 0; i <= MAX_OPROF_DOMAINS; i++) {
  34.563 -+		val = simple_strtoul(startp, &endp, 0);
  34.564 -+		if (endp == startp)
  34.565 -+			break;
  34.566 -+		while (ispunct(*endp) || isspace(*endp))
  34.567 -+			endp++;
  34.568 -+		passive_domains[i] = val;
  34.569 -+		if (passive_domains[i] != val)
  34.570 -+			/* Overflow, force error below */
  34.571 -+			i = MAX_OPROF_DOMAINS + 1;
  34.572 -+		startp = endp;
  34.573 -+	}
  34.574 -+	/* Force error on trailing junk */
  34.575 -+	pdomains = *startp ? MAX_OPROF_DOMAINS + 1 : i;
  34.576 -+
  34.577 -+	kfree(tmpbuf);
  34.578 -+
  34.579 -+	if (pdomains > MAX_OPROF_DOMAINS
  34.580 -+	    || oprofile_set_passive(passive_domains, pdomains)) {
  34.581 -+		pdomains = 0;
  34.582 -+		retval = -EINVAL;
  34.583 -+	}
  34.584 -+
  34.585 -+	mutex_unlock(&pdom_mutex);
  34.586 -+	return retval;
  34.587 -+}
  34.588 -+
  34.589 -+static ssize_t pdomain_read(struct file * file, char __user * buf, 
  34.590 -+			    size_t count, loff_t * offset)
  34.591 -+{
  34.592 -+	char * tmpbuf;
  34.593 -+	size_t len;
  34.594 -+	int i;
  34.595 -+	ssize_t retval;
  34.596 -+
  34.597 -+	if (!(tmpbuf = kmalloc(TMPBUFSIZE, GFP_KERNEL)))
  34.598 -+		return -ENOMEM;
  34.599 -+
  34.600 -+	mutex_lock(&pdom_mutex);
  34.601 -+
  34.602 -+	len = 0;
  34.603 -+	for (i = 0; i < pdomains; i++)
  34.604 -+		len += snprintf(tmpbuf + len,
  34.605 -+				len < TMPBUFSIZE ? TMPBUFSIZE - len : 0,
  34.606 -+				"%u ", passive_domains[i]);
  34.607 -+	WARN_ON(len > TMPBUFSIZE);
  34.608 -+	if (len != 0 && len <= TMPBUFSIZE)
  34.609 -+		tmpbuf[len-1] = '\n';
  34.610 -+
  34.611 -+	mutex_unlock(&pdom_mutex);
  34.612 -+
  34.613 -+	retval = simple_read_from_buffer(buf, count, offset, tmpbuf, len);
  34.614 -+
  34.615 -+	kfree(tmpbuf);
  34.616 -+	return retval;
  34.617 -+}
  34.618 -+
  34.619 -+static struct file_operations passive_domain_ops = {
  34.620 -+	.read		= pdomain_read,
  34.621 -+	.write		= pdomain_write,
  34.622 -+};
  34.623 -+
  34.624 - void oprofile_create_files(struct super_block * sb, struct dentry * root)
  34.625 - {
  34.626 - 	oprofilefs_create_file(sb, root, "enable", &enable_fops);
  34.627 - 	oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
  34.628 -+	oprofilefs_create_file(sb, root, "active_domains", &active_domain_ops);
  34.629 -+	oprofilefs_create_file(sb, root, "passive_domains", &passive_domain_ops);
  34.630 - 	oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
  34.631 - 	oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
  34.632 - 	oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
  34.633 -diff -pruN ../orig-linux-2.6.16.29/include/linux/oprofile.h ./include/linux/oprofile.h
  34.634 ---- ../orig-linux-2.6.16.29/include/linux/oprofile.h	2006-11-06 14:46:42.000000000 -0800
  34.635 -+++ ./include/linux/oprofile.h	2006-11-06 14:47:55.000000000 -0800
  34.636 -@@ -16,6 +16,8 @@
  34.637 - #include <linux/types.h>
  34.638 - #include <linux/spinlock.h>
  34.639 - #include <asm/atomic.h>
  34.640 -+
  34.641 -+#include <xen/interface/xenoprof.h>
  34.642 -  
  34.643 - struct super_block;
  34.644 - struct dentry;
  34.645 -@@ -27,6 +29,11 @@ struct oprofile_operations {
  34.646 - 	/* create any necessary configuration files in the oprofile fs.
  34.647 - 	 * Optional. */
  34.648 - 	int (*create_files)(struct super_block * sb, struct dentry * root);
  34.649 -+	/* setup active domains with Xen */
  34.650 -+	int (*set_active)(int *active_domains, unsigned int adomains);
  34.651 -+        /* setup passive domains with Xen */
  34.652 -+        int (*set_passive)(int *passive_domains, unsigned int pdomains);
  34.653 -+	
  34.654 - 	/* Do any necessary interrupt setup. Optional. */
  34.655 - 	int (*setup)(void);
  34.656 - 	/* Do any necessary interrupt shutdown. Optional. */
  34.657 -@@ -68,6 +75,8 @@ void oprofile_add_pc(unsigned long pc, i
  34.658 - /* add a backtrace entry, to be called from the ->backtrace callback */
  34.659 - void oprofile_add_trace(unsigned long eip);
  34.660 - 
  34.661 -+/* add a domain switch entry */
  34.662 -+int oprofile_add_domain_switch(int32_t domain_id);
  34.663 - 
  34.664 - /**
  34.665 -  * Create a file of the given name as a child of the given root, with
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/patches/linux-2.6.16.33/blktap-aio-16_03_06.patch	Wed Nov 29 11:07:28 2006 -0700
    35.3 @@ -0,0 +1,294 @@
    35.4 +diff -pruN ../orig-linux-2.6.16.29/fs/aio.c ./fs/aio.c
    35.5 +--- ../orig-linux-2.6.16.29/fs/aio.c	2006-09-12 19:02:10.000000000 +0100
    35.6 ++++ ./fs/aio.c	2006-09-19 13:58:49.000000000 +0100
    35.7 +@@ -34,6 +34,11 @@
    35.8 + #include <asm/uaccess.h>
    35.9 + #include <asm/mmu_context.h>
   35.10 + 
   35.11 ++#ifdef CONFIG_EPOLL
   35.12 ++#include <linux/poll.h>
   35.13 ++#include <linux/eventpoll.h>
   35.14 ++#endif
   35.15 ++
   35.16 + #if DEBUG > 1
   35.17 + #define dprintk		printk
   35.18 + #else
   35.19 +@@ -1016,6 +1021,10 @@ put_rq:
   35.20 + 	if (waitqueue_active(&ctx->wait))
   35.21 + 		wake_up(&ctx->wait);
   35.22 + 
   35.23 ++#ifdef CONFIG_EPOLL
   35.24 ++	if (ctx->file && waitqueue_active(&ctx->poll_wait))
   35.25 ++		wake_up(&ctx->poll_wait);
   35.26 ++#endif
   35.27 + 	if (ret)
   35.28 + 		put_ioctx(ctx);
   35.29 + 
   35.30 +@@ -1025,6 +1034,8 @@ put_rq:
   35.31 + /* aio_read_evt
   35.32 +  *	Pull an event off of the ioctx's event ring.  Returns the number of 
   35.33 +  *	events fetched (0 or 1 ;-)
   35.34 ++ *	If ent parameter is 0, just returns the number of events that would
   35.35 ++ *	be fetched.
   35.36 +  *	FIXME: make this use cmpxchg.
   35.37 +  *	TODO: make the ringbuffer user mmap()able (requires FIXME).
   35.38 +  */
   35.39 +@@ -1047,13 +1058,18 @@ static int aio_read_evt(struct kioctx *i
   35.40 + 
   35.41 + 	head = ring->head % info->nr;
   35.42 + 	if (head != ring->tail) {
   35.43 +-		struct io_event *evp = aio_ring_event(info, head, KM_USER1);
   35.44 +-		*ent = *evp;
   35.45 +-		head = (head + 1) % info->nr;
   35.46 +-		smp_mb(); /* finish reading the event before updatng the head */
   35.47 +-		ring->head = head;
   35.48 +-		ret = 1;
   35.49 +-		put_aio_ring_event(evp, KM_USER1);
   35.50 ++		if (ent) { /* event requested */
   35.51 ++			struct io_event *evp =
   35.52 ++				aio_ring_event(info, head, KM_USER1);
   35.53 ++			*ent = *evp;
   35.54 ++			head = (head + 1) % info->nr;
   35.55 ++			/* finish reading the event before updatng the head */
   35.56 ++			smp_mb();
   35.57 ++			ring->head = head;
   35.58 ++			ret = 1;
   35.59 ++			put_aio_ring_event(evp, KM_USER1);
   35.60 ++		} else /* only need to know availability */
   35.61 ++			ret = 1;
   35.62 + 	}
   35.63 + 	spin_unlock(&info->ring_lock);
   35.64 + 
   35.65 +@@ -1236,9 +1252,78 @@ static void io_destroy(struct kioctx *io
   35.66 + 
   35.67 + 	aio_cancel_all(ioctx);
   35.68 + 	wait_for_all_aios(ioctx);
   35.69 ++#ifdef CONFIG_EPOLL
   35.70 ++	/* forget the poll file, but it's up to the user to close it */
   35.71 ++	if (ioctx->file) {
   35.72 ++		ioctx->file->private_data = 0;
   35.73 ++		ioctx->file = 0;
   35.74 ++	}
   35.75 ++#endif
   35.76 + 	put_ioctx(ioctx);	/* once for the lookup */
   35.77 + }
   35.78 + 
   35.79 ++#ifdef CONFIG_EPOLL
   35.80 ++
   35.81 ++static int aio_queue_fd_close(struct inode *inode, struct file *file)
   35.82 ++{
   35.83 ++	struct kioctx *ioctx = file->private_data;
   35.84 ++	if (ioctx) {
   35.85 ++		file->private_data = 0;
   35.86 ++		spin_lock_irq(&ioctx->ctx_lock);
   35.87 ++		ioctx->file = 0;
   35.88 ++		spin_unlock_irq(&ioctx->ctx_lock);
   35.89 ++	}
   35.90 ++	return 0;
   35.91 ++}
   35.92 ++
   35.93 ++static unsigned int aio_queue_fd_poll(struct file *file, poll_table *wait)
   35.94 ++{	unsigned int pollflags = 0;
   35.95 ++	struct kioctx *ioctx = file->private_data;
   35.96 ++
   35.97 ++	if (ioctx) {
   35.98 ++
   35.99 ++		spin_lock_irq(&ioctx->ctx_lock);
  35.100 ++		/* Insert inside our poll wait queue */
  35.101 ++		poll_wait(file, &ioctx->poll_wait, wait);
  35.102 ++
  35.103 ++		/* Check our condition */
  35.104 ++		if (aio_read_evt(ioctx, 0))
  35.105 ++			pollflags = POLLIN | POLLRDNORM;
  35.106 ++		spin_unlock_irq(&ioctx->ctx_lock);
  35.107 ++	}
  35.108 ++
  35.109 ++	return pollflags;
  35.110 ++}
  35.111 ++
  35.112 ++static struct file_operations aioq_fops = {
  35.113 ++	.release	= aio_queue_fd_close,
  35.114 ++	.poll		= aio_queue_fd_poll
  35.115 ++};
  35.116 ++
  35.117 ++/* make_aio_fd:
  35.118 ++ *  Create a file descriptor that can be used to poll the event queue.
  35.119 ++ *  Based and piggybacked on the excellent epoll code.
  35.120 ++ */
  35.121 ++
  35.122 ++static int make_aio_fd(struct kioctx *ioctx)
  35.123 ++{
  35.124 ++	int error, fd;
  35.125 ++	struct inode *inode;
  35.126 ++	struct file *file;
  35.127 ++
  35.128 ++	error = ep_getfd(&fd, &inode, &file, NULL, &aioq_fops);
  35.129 ++	if (error)
  35.130 ++		return error;
  35.131 ++
  35.132 ++	/* associate the file with the IO context */
  35.133 ++	file->private_data = ioctx;
  35.134 ++	ioctx->file = file;
  35.135 ++	init_waitqueue_head(&ioctx->poll_wait);
  35.136 ++	return fd;
  35.137 ++}
  35.138 ++#endif
  35.139 ++
  35.140 ++
  35.141 + /* sys_io_setup:
  35.142 +  *	Create an aio_context capable of receiving at least nr_events.
  35.143 +  *	ctxp must not point to an aio_context that already exists, and
  35.144 +@@ -1251,18 +1336,30 @@ static void io_destroy(struct kioctx *io
  35.145 +  *	resources are available.  May fail with -EFAULT if an invalid
  35.146 +  *	pointer is passed for ctxp.  Will fail with -ENOSYS if not
  35.147 +  *	implemented.
  35.148 ++ *
  35.149 ++ *	To request a selectable fd, the user context has to be initialized
  35.150 ++ *	to 1, instead of 0, and the return value is the fd.
  35.151 ++ *	This keeps the system call compatible, since a non-zero value
  35.152 ++ *	was not allowed so far.
  35.153 +  */
  35.154 + asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp)
  35.155 + {
  35.156 + 	struct kioctx *ioctx = NULL;
  35.157 + 	unsigned long ctx;
  35.158 + 	long ret;
  35.159 ++	int make_fd = 0;
  35.160 + 
  35.161 + 	ret = get_user(ctx, ctxp);
  35.162 + 	if (unlikely(ret))
  35.163 + 		goto out;
  35.164 + 
  35.165 + 	ret = -EINVAL;
  35.166 ++#ifdef CONFIG_EPOLL
  35.167 ++	if (ctx == 1) {
  35.168 ++		make_fd = 1;
  35.169 ++		ctx = 0;
  35.170 ++	}
  35.171 ++#endif
  35.172 + 	if (unlikely(ctx || nr_events == 0)) {
  35.173 + 		pr_debug("EINVAL: io_setup: ctx %lu nr_events %u\n",
  35.174 + 		         ctx, nr_events);
  35.175 +@@ -1273,8 +1370,12 @@ asmlinkage long sys_io_setup(unsigned nr
  35.176 + 	ret = PTR_ERR(ioctx);
  35.177 + 	if (!IS_ERR(ioctx)) {
  35.178 + 		ret = put_user(ioctx->user_id, ctxp);
  35.179 +-		if (!ret)
  35.180 +-			return 0;
  35.181 ++#ifdef CONFIG_EPOLL
  35.182 ++		if (make_fd && ret >= 0)
  35.183 ++			ret = make_aio_fd(ioctx);
  35.184 ++#endif
  35.185 ++		if (ret >= 0)
  35.186 ++			return ret;
  35.187 + 
  35.188 + 		get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */
  35.189 + 		io_destroy(ioctx);
  35.190 +diff -pruN ../orig-linux-2.6.16.29/fs/eventpoll.c ./fs/eventpoll.c
  35.191 +--- ../orig-linux-2.6.16.29/fs/eventpoll.c	2006-09-12 19:02:10.000000000 +0100
  35.192 ++++ ./fs/eventpoll.c	2006-09-19 13:58:49.000000000 +0100
  35.193 +@@ -235,8 +235,6 @@ struct ep_pqueue {
  35.194 + 
  35.195 + static void ep_poll_safewake_init(struct poll_safewake *psw);
  35.196 + static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq);
  35.197 +-static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
  35.198 +-		    struct eventpoll *ep);
  35.199 + static int ep_alloc(struct eventpoll **pep);
  35.200 + static void ep_free(struct eventpoll *ep);
  35.201 + static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
  35.202 +@@ -266,7 +264,7 @@ static int ep_events_transfer(struct eve
  35.203 + static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
  35.204 + 		   int maxevents, long timeout);
  35.205 + static int eventpollfs_delete_dentry(struct dentry *dentry);
  35.206 +-static struct inode *ep_eventpoll_inode(void);
  35.207 ++static struct inode *ep_eventpoll_inode(struct file_operations *fops);
  35.208 + static struct super_block *eventpollfs_get_sb(struct file_system_type *fs_type,
  35.209 + 					      int flags, const char *dev_name,
  35.210 + 					      void *data);
  35.211 +@@ -525,7 +523,7 @@ asmlinkage long sys_epoll_create(int siz
  35.212 + 	 * Creates all the items needed to setup an eventpoll file. That is,
  35.213 + 	 * a file structure, and inode and a free file descriptor.
  35.214 + 	 */
  35.215 +-	error = ep_getfd(&fd, &inode, &file, ep);
  35.216 ++	error = ep_getfd(&fd, &inode, &file, ep, &eventpoll_fops);
  35.217 + 	if (error)
  35.218 + 		goto eexit_2;
  35.219 + 
  35.220 +@@ -710,8 +708,8 @@ eexit_1:
  35.221 + /*
  35.222 +  * Creates the file descriptor to be used by the epoll interface.
  35.223 +  */
  35.224 +-static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
  35.225 +-		    struct eventpoll *ep)
  35.226 ++int ep_getfd(int *efd, struct inode **einode, struct file **efile,
  35.227 ++		    struct eventpoll *ep, struct file_operations *fops)
  35.228 + {
  35.229 + 	struct qstr this;
  35.230 + 	char name[32];
  35.231 +@@ -727,7 +725,7 @@ static int ep_getfd(int *efd, struct ino
  35.232 + 		goto eexit_1;
  35.233 + 
  35.234 + 	/* Allocates an inode from the eventpoll file system */
  35.235 +-	inode = ep_eventpoll_inode();
  35.236 ++	inode = ep_eventpoll_inode(fops);
  35.237 + 	error = PTR_ERR(inode);
  35.238 + 	if (IS_ERR(inode))
  35.239 + 		goto eexit_2;
  35.240 +@@ -758,7 +756,7 @@ static int ep_getfd(int *efd, struct ino
  35.241 + 
  35.242 + 	file->f_pos = 0;
  35.243 + 	file->f_flags = O_RDONLY;
  35.244 +-	file->f_op = &eventpoll_fops;
  35.245 ++	file->f_op = fops;
  35.246 + 	file->f_mode = FMODE_READ;
  35.247 + 	file->f_version = 0;
  35.248 + 	file->private_data = ep;
  35.249 +@@ -1574,7 +1572,7 @@ static int eventpollfs_delete_dentry(str
  35.250 + }
  35.251 + 
  35.252 + 
  35.253 +-static struct inode *ep_eventpoll_inode(void)
  35.254 ++static struct inode *ep_eventpoll_inode(struct file_operations *fops)
  35.255 + {
  35.256 + 	int error = -ENOMEM;
  35.257 + 	struct inode *inode = new_inode(eventpoll_mnt->mnt_sb);
  35.258 +@@ -1582,7 +1580,7 @@ static struct inode *ep_eventpoll_inode(
  35.259 + 	if (!inode)
  35.260 + 		goto eexit_1;
  35.261 + 
  35.262 +-	inode->i_fop = &eventpoll_fops;
  35.263 ++	inode->i_fop = fops;
  35.264 + 
  35.265 + 	/*
  35.266 + 	 * Mark the inode dirty from the very beginning,
  35.267 +diff -pruN ../orig-linux-2.6.16.29/include/linux/aio.h ./include/linux/aio.h
  35.268 +--- ../orig-linux-2.6.16.29/include/linux/aio.h	2006-09-12 19:02:10.000000000 +0100
  35.269 ++++ ./include/linux/aio.h	2006-09-19 13:58:49.000000000 +0100
  35.270 +@@ -191,6 +191,11 @@ struct kioctx {
  35.271 + 	struct aio_ring_info	ring_info;
  35.272 + 
  35.273 + 	struct work_struct	wq;
  35.274 ++#ifdef CONFIG_EPOLL
  35.275 ++	// poll integration
  35.276 ++	wait_queue_head_t       poll_wait;
  35.277 ++	struct file		*file;
  35.278 ++#endif
  35.279 + };
  35.280 + 
  35.281 + /* prototypes */
  35.282 +diff -pruN ../orig-linux-2.6.16.29/include/linux/eventpoll.h ./include/linux/eventpoll.h
  35.283 +--- ../orig-linux-2.6.16.29/include/linux/eventpoll.h	2006-09-12 19:02:10.000000000 +0100
  35.284 ++++ ./include/linux/eventpoll.h	2006-09-19 13:58:49.000000000 +0100
  35.285 +@@ -86,6 +86,12 @@ static inline void eventpoll_release(str
  35.286 + }
  35.287 + 
  35.288 + 
  35.289 ++/*
  35.290 ++ * called by aio code to create fd that can poll the  aio event queueQ
  35.291 ++ */
  35.292 ++struct eventpoll;
  35.293 ++int ep_getfd(int *efd, struct inode **einode, struct file **efile,
  35.294 ++             struct eventpoll *ep, struct file_operations *fops);
  35.295 + #else
  35.296 + 
  35.297 + static inline void eventpoll_init_file(struct file *file) {}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/patches/linux-2.6.16.33/device_bind.patch	Wed Nov 29 11:07:28 2006 -0700
    36.3 @@ -0,0 +1,15 @@
    36.4 +diff -pruN ../orig-linux-2.6.16.29/drivers/base/bus.c ./drivers/base/bus.c
    36.5 +--- ../orig-linux-2.6.16.29/drivers/base/bus.c	2006-09-12 19:02:10.000000000 +0100
    36.6 ++++ ./drivers/base/bus.c	2006-09-19 13:58:54.000000000 +0100
    36.7 +@@ -188,6 +188,11 @@ static ssize_t driver_bind(struct device
    36.8 + 		up(&dev->sem);
    36.9 + 		if (dev->parent)
   36.10 + 			up(&dev->parent->sem);
   36.11 ++
   36.12 ++		if (err > 0) 		/* success */
   36.13 ++			err = count;
   36.14 ++		else if (err == 0)	/* driver didn't accept device */
   36.15 ++			err = -ENODEV;
   36.16 + 	}
   36.17 + 	put_device(dev);
   36.18 + 	put_bus(bus);
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/patches/linux-2.6.16.33/fix-hz-suspend.patch	Wed Nov 29 11:07:28 2006 -0700
    37.3 @@ -0,0 +1,26 @@
    37.4 +diff -pruN ../orig-linux-2.6.16.29/kernel/timer.c ./kernel/timer.c
    37.5 +--- ../orig-linux-2.6.16.29/kernel/timer.c	2006-09-12 19:02:10.000000000 +0100
    37.6 ++++ ./kernel/timer.c	2006-09-19 13:58:58.000000000 +0100
    37.7 +@@ -555,6 +555,22 @@ found:
    37.8 + 	}
    37.9 + 	spin_unlock(&base->t_base.lock);
   37.10 + 
   37.11 ++	/*
   37.12 ++	 * It can happen that other CPUs service timer IRQs and increment
   37.13 ++	 * jiffies, but we have not yet got a local timer tick to process
   37.14 ++	 * the timer wheels.  In that case, the expiry time can be before
   37.15 ++	 * jiffies, but since the high-resolution timer here is relative to
   37.16 ++	 * jiffies, the default expression when high-resolution timers are
   37.17 ++	 * not active,
   37.18 ++	 *
   37.19 ++	 *   time_before(MAX_JIFFY_OFFSET + jiffies, expires)
   37.20 ++	 *
   37.21 ++	 * would falsely evaluate to true.  If that is the case, just
   37.22 ++	 * return jiffies so that we can immediately fire the local timer
   37.23 ++	 */
   37.24 ++	if (time_before(expires, jiffies))
   37.25 ++		return jiffies;
   37.26 ++
   37.27 + 	if (time_before(hr_expires, expires))
   37.28 + 		return hr_expires;
   37.29 + 
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/patches/linux-2.6.16.33/fix-ide-cd-pio-mode.patch	Wed Nov 29 11:07:28 2006 -0700
    38.3 @@ -0,0 +1,18 @@
    38.4 +diff -pruN ../orig-linux-2.6.16.29/drivers/ide/ide-lib.c ./drivers/ide/ide-lib.c
    38.5 +--- ../orig-linux-2.6.16.29/drivers/ide/ide-lib.c	2006-09-12 19:02:10.000000000 +0100
    38.6 ++++ ./drivers/ide/ide-lib.c	2006-09-19 13:59:03.000000000 +0100
    38.7 +@@ -410,10 +410,10 @@ void ide_toggle_bounce(ide_drive_t *driv
    38.8 + {
    38.9 + 	u64 addr = BLK_BOUNCE_HIGH;	/* dma64_addr_t */
   38.10 + 
   38.11 +-	if (!PCI_DMA_BUS_IS_PHYS) {
   38.12 +-		addr = BLK_BOUNCE_ANY;
   38.13 +-	} else if (on && drive->media == ide_disk) {
   38.14 +-		if (HWIF(drive)->pci_dev)
   38.15 ++	if (on && drive->media == ide_disk) {
   38.16 ++		if (!PCI_DMA_BUS_IS_PHYS)
   38.17 ++			addr = BLK_BOUNCE_ANY;
   38.18 ++		else if (HWIF(drive)->pci_dev)
   38.19 + 			addr = HWIF(drive)->pci_dev->dma_mask;
   38.20 + 	}
   38.21 + 
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/patches/linux-2.6.16.33/i386-mach-io-check-nmi.patch	Wed Nov 29 11:07:28 2006 -0700
    39.3 @@ -0,0 +1,45 @@
    39.4 +diff -pruN ../orig-linux-2.6.16.29/arch/i386/kernel/traps.c ./arch/i386/kernel/traps.c
    39.5 +--- ../orig-linux-2.6.16.29/arch/i386/kernel/traps.c	2006-09-12 19:02:10.000000000 +0100
    39.6 ++++ ./arch/i386/kernel/traps.c	2006-09-19 13:59:06.000000000 +0100
    39.7 +@@ -567,18 +567,11 @@ static void mem_parity_error(unsigned ch
    39.8 + 
    39.9 + static void io_check_error(unsigned char reason, struct pt_regs * regs)
   39.10 + {
   39.11 +-	unsigned long i;
   39.12 +-
   39.13 + 	printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
   39.14 + 	show_registers(regs);
   39.15 + 
   39.16 + 	/* Re-enable the IOCK line, wait for a few seconds */
   39.17 +-	reason = (reason & 0xf) | 8;
   39.18 +-	outb(reason, 0x61);
   39.19 +-	i = 2000;
   39.20 +-	while (--i) udelay(1000);
   39.21 +-	reason &= ~8;
   39.22 +-	outb(reason, 0x61);
   39.23 ++	clear_io_check_error(reason);
   39.24 + }
   39.25 + 
   39.26 + static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
   39.27 +diff -pruN ../orig-linux-2.6.16.29/include/asm-i386/mach-default/mach_traps.h ./include/asm-i386/mach-default/mach_traps.h
   39.28 +--- ../orig-linux-2.6.16.29/include/asm-i386/mach-default/mach_traps.h	2006-09-12 19:02:10.000000000 +0100
   39.29 ++++ ./include/asm-i386/mach-default/mach_traps.h	2006-09-19 13:59:06.000000000 +0100
   39.30 +@@ -15,6 +15,18 @@ static inline void clear_mem_error(unsig
   39.31 + 	outb(reason, 0x61);
   39.32 + }
   39.33 + 
   39.34 ++static inline void clear_io_check_error(unsigned char reason)
   39.35 ++{
   39.36 ++	unsigned long i;
   39.37 ++
   39.38 ++	reason = (reason & 0xf) | 8;
   39.39 ++	outb(reason, 0x61);
   39.40 ++	i = 2000;
   39.41 ++	while (--i) udelay(1000);
   39.42 ++	reason &= ~8;
   39.43 ++	outb(reason, 0x61);
   39.44 ++}
   39.45 ++
   39.46 + static inline unsigned char get_nmi_reason(void)
   39.47 + {
   39.48 + 	return inb(0x61);
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/patches/linux-2.6.16.33/ipv6-no-autoconf.patch	Wed Nov 29 11:07:28 2006 -0700
    40.3 @@ -0,0 +1,19 @@
    40.4 +diff -pruN ../orig-linux-2.6.16.29/net/ipv6/addrconf.c ./net/ipv6/addrconf.c
    40.5 +--- ../orig-linux-2.6.16.29/net/ipv6/addrconf.c	2006-09-12 19:02:10.000000000 +0100
    40.6 ++++ ./net/ipv6/addrconf.c	2006-09-19 13:59:11.000000000 +0100
    40.7 +@@ -2471,6 +2471,7 @@ static void addrconf_dad_start(struct in
    40.8 + 	spin_lock_bh(&ifp->lock);
    40.9 + 
   40.10 + 	if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) ||
   40.11 ++	    !(dev->flags&IFF_MULTICAST) ||
   40.12 + 	    !(ifp->flags&IFA_F_TENTATIVE)) {
   40.13 + 		ifp->flags &= ~IFA_F_TENTATIVE;
   40.14 + 		spin_unlock_bh(&ifp->lock);
   40.15 +@@ -2555,6 +2556,7 @@ static void addrconf_dad_completed(struc
   40.16 + 	if (ifp->idev->cnf.forwarding == 0 &&
   40.17 + 	    ifp->idev->cnf.rtr_solicits > 0 &&
   40.18 + 	    (dev->flags&IFF_LOOPBACK) == 0 &&
   40.19 ++	    (dev->flags & IFF_MULTICAST) &&
   40.20 + 	    (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) {
   40.21 + 		struct in6_addr all_routers;
   40.22 + 
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/patches/linux-2.6.16.33/kasprintf.patch	Wed Nov 29 11:07:28 2006 -0700
    41.3 @@ -0,0 +1,59 @@
    41.4 +commit e905914f96e11862b130dd229f73045dad9a34e8
    41.5 +Author: Jeremy Fitzhardinge <jeremy@xensource.com>
    41.6 +Date:   Sun Jun 25 05:49:17 2006 -0700
    41.7 +
    41.8 +    [PATCH] Implement kasprintf
    41.9 +    
   41.10 +    Implement kasprintf, a kernel version of asprintf.  This allocates the
   41.11 +    memory required for the formatted string, including the trailing '\0'.
   41.12 +    Returns NULL on allocation failure.
   41.13 +    
   41.14 +    Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
   41.15 +    Signed-off-by: Chris Wright <chrisw@sous-sol.org>
   41.16 +    Signed-off-by: Andrew Morton <akpm@osdl.org>
   41.17 +    Signed-off-by: Linus Torvalds <torvalds@osdl.org>
   41.18 +
   41.19 +diff --git a/include/linux/kernel.h b/include/linux/kernel.h
   41.20 +index 8c21aaa..3c5e4c2 100644
   41.21 +--- a/include/linux/kernel.h
   41.22 ++++ b/include/linux/kernel.h
   41.23 +@@ -117,6 +117,8 @@ extern int scnprintf(char * buf, size_t
   41.24 + 	__attribute__ ((format (printf, 3, 4)));
   41.25 + extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
   41.26 + 	__attribute__ ((format (printf, 3, 0)));
   41.27 ++extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
   41.28 ++	__attribute__ ((format (printf, 2, 3)));
   41.29 + 
   41.30 + extern int sscanf(const char *, const char *, ...)
   41.31 + 	__attribute__ ((format (scanf, 2, 3)));
   41.32 +diff --git a/lib/vsprintf.c b/lib/vsprintf.c
   41.33 +index f595947..797428a 100644
   41.34 +--- a/lib/vsprintf.c
   41.35 ++++ b/lib/vsprintf.c
   41.36 +@@ -849,3 +849,26 @@ int sscanf(const char * buf, const char
   41.37 + }
   41.38 + 
   41.39 + EXPORT_SYMBOL(sscanf);
   41.40 ++
   41.41 ++
   41.42 ++/* Simplified asprintf. */
   41.43 ++char *kasprintf(gfp_t gfp, const char *fmt, ...)
   41.44 ++{
   41.45 ++	va_list ap;
   41.46 ++	unsigned int len;
   41.47 ++	char *p;
   41.48 ++
   41.49 ++	va_start(ap, fmt);
   41.50 ++	len = vsnprintf(NULL, 0, fmt, ap);
   41.51 ++	va_end(ap);
   41.52 ++
   41.53 ++	p = kmalloc(len+1, gfp);
   41.54 ++	if (!p)
   41.55 ++		return NULL;
   41.56 ++	va_start(ap, fmt);
   41.57 ++	vsnprintf(p, len+1, fmt, ap);
   41.58 ++	va_end(ap);
   41.59 ++	return p;
   41.60 ++}
   41.61 ++
   41.62 ++EXPORT_SYMBOL(kasprintf);
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/patches/linux-2.6.16.33/net-csum.patch	Wed Nov 29 11:07:28 2006 -0700
    42.3 @@ -0,0 +1,63 @@
    42.4 +diff -pruN ../orig-linux-2.6.16.29/net/ipv4/netfilter/ip_nat_proto_tcp.c ./net/ipv4/netfilter/ip_nat_proto_tcp.c
    42.5 +--- ../orig-linux-2.6.16.29/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-09-12 19:02:10.000000000 +0100
    42.6 ++++ ./net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-09-19 13:59:15.000000000 +0100
    42.7 +@@ -129,7 +129,12 @@ tcp_manip_pkt(struct sk_buff **pskb,
    42.8 + 	if (hdrsize < sizeof(*hdr))
    42.9 + 		return 1;
   42.10 + 
   42.11 +-	hdr->check = ip_nat_cheat_check(~oldip, newip,
   42.12 ++#ifdef CONFIG_XEN
   42.13 ++	if ((*pskb)->proto_csum_blank)
   42.14 ++		hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
   42.15 ++	else
   42.16 ++#endif
   42.17 ++		hdr->check = ip_nat_cheat_check(~oldip, newip,
   42.18 + 					ip_nat_cheat_check(oldport ^ 0xFFFF,
   42.19 + 							   newport,
   42.20 + 							   hdr->check));
   42.21 +diff -pruN ../orig-linux-2.6.16.29/net/ipv4/netfilter/ip_nat_proto_udp.c ./net/ipv4/netfilter/ip_nat_proto_udp.c
   42.22 +--- ../orig-linux-2.6.16.29/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-09-12 19:02:10.000000000 +0100
   42.23 ++++ ./net/ipv4/netfilter/ip_nat_proto_udp.c	2006-09-19 13:59:15.000000000 +0100
   42.24 +@@ -113,11 +113,17 @@ udp_manip_pkt(struct sk_buff **pskb,
   42.25 + 		newport = tuple->dst.u.udp.port;
   42.26 + 		portptr = &hdr->dest;
   42.27 + 	}
   42.28 +-	if (hdr->check) /* 0 is a special case meaning no checksum */
   42.29 +-		hdr->check = ip_nat_cheat_check(~oldip, newip,
   42.30 ++	if (hdr->check) { /* 0 is a special case meaning no checksum */
   42.31 ++#ifdef CONFIG_XEN
   42.32 ++		if ((*pskb)->proto_csum_blank)
   42.33 ++			hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
   42.34 ++		else
   42.35 ++#endif
   42.36 ++			hdr->check = ip_nat_cheat_check(~oldip, newip,
   42.37 + 					ip_nat_cheat_check(*portptr ^ 0xFFFF,
   42.38 + 							   newport,
   42.39 + 							   hdr->check));
   42.40 ++	}
   42.41 + 	*portptr = newport;
   42.42 + 	return 1;
   42.43 + }
   42.44 +diff -pruN ../orig-linux-2.6.16.29/net/ipv4/xfrm4_output.c ./net/ipv4/xfrm4_output.c
   42.45 +--- ../orig-linux-2.6.16.29/net/ipv4/xfrm4_output.c	2006-09-12 19:02:10.000000000 +0100
   42.46 ++++ ./net/ipv4/xfrm4_output.c	2006-09-19 13:59:15.000000000 +0100
   42.47 +@@ -17,6 +17,8 @@
   42.48 + #include <net/xfrm.h>
   42.49 + #include <net/icmp.h>
   42.50 + 
   42.51 ++extern int skb_checksum_setup(struct sk_buff *skb);
   42.52 ++
   42.53 + /* Add encapsulation header.
   42.54 +  *
   42.55 +  * In transport mode, the IP header will be moved forward to make space
   42.56 +@@ -103,6 +105,10 @@ static int xfrm4_output_one(struct sk_bu
   42.57 + 	struct xfrm_state *x = dst->xfrm;
   42.58 + 	int err;
   42.59 + 	
   42.60 ++	err = skb_checksum_setup(skb);
   42.61 ++	if (err)
   42.62 ++		goto error_nolock;
   42.63 ++
   42.64 + 	if (skb->ip_summed == CHECKSUM_HW) {
   42.65 + 		err = skb_checksum_help(skb, 0);
   42.66 + 		if (err)
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/patches/linux-2.6.16.33/net-gso-0-base.patch	Wed Nov 29 11:07:28 2006 -0700
    43.3 @@ -0,0 +1,2898 @@
    43.4 +Index: tmp-xxx/Documentation/networking/netdevices.txt
    43.5 +===================================================================
    43.6 +--- tmp-xxx.orig/Documentation/networking/netdevices.txt	2006-11-15 10:38:39.000000000 +0000
    43.7 ++++ tmp-xxx/Documentation/networking/netdevices.txt	2006-11-27 10:52:42.000000000 +0000
    43.8 +@@ -42,9 +42,9 @@
    43.9 + 	Context: nominally process, but don't sleep inside an rwlock
   43.10 + 
   43.11 + dev->hard_start_xmit:
   43.12 +-	Synchronization: dev->xmit_lock spinlock.
   43.13 ++	Synchronization: netif_tx_lock spinlock.
   43.14 + 	When the driver sets NETIF_F_LLTX in dev->features this will be
   43.15 +-	called without holding xmit_lock. In this case the driver 
   43.16 ++	called without holding netif_tx_lock. In this case the driver
   43.17 + 	has to lock by itself when needed. It is recommended to use a try lock
   43.18 + 	for this and return -1 when the spin lock fails. 
   43.19 + 	The locking there should also properly protect against 
   43.20 +@@ -62,12 +62,12 @@
   43.21 + 	  Only valid when NETIF_F_LLTX is set.
   43.22 + 
   43.23 + dev->tx_timeout:
   43.24 +-	Synchronization: dev->xmit_lock spinlock.
   43.25 ++	Synchronization: netif_tx_lock spinlock.
   43.26 + 	Context: BHs disabled
   43.27 + 	Notes: netif_queue_stopped() is guaranteed true
   43.28 + 
   43.29 + dev->set_multicast_list:
   43.30 +-	Synchronization: dev->xmit_lock spinlock.
   43.31 ++	Synchronization: netif_tx_lock spinlock.
   43.32 + 	Context: BHs disabled
   43.33 + 
   43.34 + dev->poll:
   43.35 +Index: tmp-xxx/drivers/block/aoe/aoenet.c
   43.36 +===================================================================
   43.37 +--- tmp-xxx.orig/drivers/block/aoe/aoenet.c	2006-11-15 10:38:39.000000000 +0000
   43.38 ++++ tmp-xxx/drivers/block/aoe/aoenet.c	2006-11-27 10:52:42.000000000 +0000
   43.39 +@@ -95,9 +95,8 @@
   43.40 + static struct sk_buff *
   43.41 + skb_check(struct sk_buff *skb)
   43.42 + {
   43.43 +-	if (skb_is_nonlinear(skb))
   43.44 + 	if ((skb = skb_share_check(skb, GFP_ATOMIC)))
   43.45 +-	if (skb_linearize(skb, GFP_ATOMIC) < 0) {
   43.46 ++	if (skb_linearize(skb)) {
   43.47 + 		dev_kfree_skb(skb);
   43.48 + 		return NULL;
   43.49 + 	}
   43.50 +Index: tmp-xxx/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
   43.51 +===================================================================
   43.52 +--- tmp-xxx.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2006-11-15 10:38:39.000000000 +0000
   43.53 ++++ tmp-xxx/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2006-11-27 10:52:42.000000000 +0000
   43.54 +@@ -821,7 +821,8 @@
   43.55 + 
   43.56 + 	ipoib_mcast_stop_thread(dev, 0);
   43.57 + 
   43.58 +-	spin_lock_irqsave(&dev->xmit_lock, flags);
   43.59 ++	local_irq_save(flags);
   43.60 ++	netif_tx_lock(dev);
   43.61 + 	spin_lock(&priv->lock);
   43.62 + 
   43.63 + 	/*
   43.64 +@@ -896,7 +897,8 @@
   43.65 + 	}
   43.66 + 
   43.67 + 	spin_unlock(&priv->lock);
   43.68 +-	spin_unlock_irqrestore(&dev->xmit_lock, flags);
   43.69 ++	netif_tx_unlock(dev);
   43.70 ++	local_irq_restore(flags);
   43.71 + 
   43.72 + 	/* We have to cancel outside of the spinlock */
   43.73 + 	list_for_each_entry_safe(mcast, tmcast, &remove_list, list) {
   43.74 +Index: tmp-xxx/drivers/media/dvb/dvb-core/dvb_net.c
   43.75 +===================================================================
   43.76 +--- tmp-xxx.orig/drivers/media/dvb/dvb-core/dvb_net.c	2006-11-15 10:38:39.000000000 +0000
   43.77 ++++ tmp-xxx/drivers/media/dvb/dvb-core/dvb_net.c	2006-11-27 10:52:42.000000000 +0000
   43.78 +@@ -1053,7 +1053,7 @@
   43.79 + 
   43.80 + 	dvb_net_feed_stop(dev);
   43.81 + 	priv->rx_mode = RX_MODE_UNI;
   43.82 +-	spin_lock_bh(&dev->xmit_lock);
   43.83 ++	netif_tx_lock_bh(dev);
   43.84 + 
   43.85 + 	if (dev->flags & IFF_PROMISC) {
   43.86 + 		dprintk("%s: promiscuous mode\n", dev->name);
   43.87 +@@ -1078,7 +1078,7 @@
   43.88 + 		}
   43.89 + 	}
   43.90 + 
   43.91 +-	spin_unlock_bh(&dev->xmit_lock);
   43.92 ++	netif_tx_unlock_bh(dev);
   43.93 + 	dvb_net_feed_start(dev);
   43.94 + }
   43.95 + 
   43.96 +Index: tmp-xxx/drivers/net/8139cp.c
   43.97 +===================================================================
   43.98 +--- tmp-xxx.orig/drivers/net/8139cp.c	2006-11-15 10:38:39.000000000 +0000
   43.99 ++++ tmp-xxx/drivers/net/8139cp.c	2006-11-27 10:52:42.000000000 +0000
  43.100 +@@ -794,7 +794,7 @@
  43.101 + 	entry = cp->tx_head;
  43.102 + 	eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
  43.103 + 	if (dev->features & NETIF_F_TSO)
  43.104 +-		mss = skb_shinfo(skb)->tso_size;
  43.105 ++		mss = skb_shinfo(skb)->gso_size;
  43.106 + 
  43.107 + 	if (skb_shinfo(skb)->nr_frags == 0) {
  43.108 + 		struct cp_desc *txd = &cp->tx_ring[entry];
  43.109 +Index: tmp-xxx/drivers/net/bnx2.c
  43.110 +===================================================================
  43.111 +--- tmp-xxx.orig/drivers/net/bnx2.c	2006-11-15 10:38:39.000000000 +0000
  43.112 ++++ tmp-xxx/drivers/net/bnx2.c	2006-11-27 10:52:42.000000000 +0000
  43.113 +@@ -1593,7 +1593,7 @@
  43.114 + 		skb = tx_buf->skb;
  43.115 + #ifdef BCM_TSO 
  43.116 + 		/* partial BD completions possible with TSO packets */
  43.117 +-		if (skb_shinfo(skb)->tso_size) {
  43.118 ++		if (skb_shinfo(skb)->gso_size) {
  43.119 + 			u16 last_idx, last_ring_idx;
  43.120 + 
  43.121 + 			last_idx = sw_cons +
  43.122 +@@ -1948,7 +1948,7 @@
  43.123 + 	return 1;
  43.124 + }
  43.125 + 
  43.126 +-/* Called with rtnl_lock from vlan functions and also dev->xmit_lock
  43.127 ++/* Called with rtnl_lock from vlan functions and also netif_tx_lock
  43.128 +  * from set_multicast.
  43.129 +  */
  43.130 + static void
  43.131 +@@ -4403,7 +4403,7 @@
  43.132 + }
  43.133 + #endif
  43.134 + 
  43.135 +-/* Called with dev->xmit_lock.
  43.136 ++/* Called with netif_tx_lock.
  43.137 +  * hard_start_xmit is pseudo-lockless - a lock is only required when
  43.138 +  * the tx queue is full. This way, we get the benefit of lockless
  43.139 +  * operations most of the time without the complexities to handle
  43.140 +@@ -4441,7 +4441,7 @@
  43.141 + 			(TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
  43.142 + 	}
  43.143 + #ifdef BCM_TSO 
  43.144 +-	if ((mss = skb_shinfo(skb)->tso_size) &&
  43.145 ++	if ((mss = skb_shinfo(skb)->gso_size) &&
  43.146 + 		(skb->len > (bp->dev->mtu + ETH_HLEN))) {
  43.147 + 		u32 tcp_opt_len, ip_tcp_len;
  43.148 + 
  43.149 +Index: tmp-xxx/drivers/net/bonding/bond_main.c
  43.150 +===================================================================
  43.151 +--- tmp-xxx.orig/drivers/net/bonding/bond_main.c	2006-11-15 10:38:39.000000000 +0000
  43.152 ++++ tmp-xxx/drivers/net/bonding/bond_main.c	2006-11-27 10:52:42.000000000 +0000
  43.153 +@@ -1145,8 +1145,7 @@
  43.154 + }
  43.155 + 
  43.156 + #define BOND_INTERSECT_FEATURES \
  43.157 +-	(NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM|\
  43.158 +-	NETIF_F_TSO|NETIF_F_UFO)
  43.159 ++	(NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO)
  43.160 + 
  43.161 + /* 
  43.162 +  * Compute the common dev->feature set available to all slaves.  Some
  43.163 +@@ -1164,9 +1163,7 @@
  43.164 + 		features &= (slave->dev->features & BOND_INTERSECT_FEATURES);
  43.165 + 
  43.166 + 	if ((features & NETIF_F_SG) && 
  43.167 +-	    !(features & (NETIF_F_IP_CSUM |
  43.168 +-			  NETIF_F_NO_CSUM |
  43.169 +-			  NETIF_F_HW_CSUM)))
  43.170 ++	    !(features & NETIF_F_ALL_CSUM))
  43.171 + 		features &= ~NETIF_F_SG;
  43.172 + 
  43.173 + 	/* 
  43.174 +@@ -4147,7 +4144,7 @@
  43.175 + 	 */
  43.176 + 	bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
  43.177 + 
  43.178 +-	/* don't acquire bond device's xmit_lock when 
  43.179 ++	/* don't acquire bond device's netif_tx_lock when
  43.180 + 	 * transmitting */
  43.181 + 	bond_dev->features |= NETIF_F_LLTX;
  43.182 + 
  43.183 +Index: tmp-xxx/drivers/net/chelsio/sge.c
  43.184 +===================================================================
  43.185 +--- tmp-xxx.orig/drivers/net/chelsio/sge.c	2006-11-15 10:38:39.000000000 +0000
  43.186 ++++ tmp-xxx/drivers/net/chelsio/sge.c	2006-11-27 10:52:42.000000000 +0000
  43.187 +@@ -1419,7 +1419,7 @@
  43.188 + 	struct cpl_tx_pkt *cpl;
  43.189 + 
  43.190 + #ifdef NETIF_F_TSO
  43.191 +-	if (skb_shinfo(skb)->tso_size) {
  43.192 ++	if (skb_shinfo(skb)->gso_size) {
  43.193 + 		int eth_type;
  43.194 + 		struct cpl_tx_pkt_lso *hdr;
  43.195 + 
  43.196 +@@ -1434,7 +1434,7 @@
  43.197 + 		hdr->ip_hdr_words = skb->nh.iph->ihl;
  43.198 + 		hdr->tcp_hdr_words = skb->h.th->doff;
  43.199 + 		hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type,
  43.200 +-						skb_shinfo(skb)->tso_size));
  43.201 ++						skb_shinfo(skb)->gso_size));
  43.202 + 		hdr->len = htonl(skb->len - sizeof(*hdr));
  43.203 + 		cpl = (struct cpl_tx_pkt *)hdr;
  43.204 + 		sge->stats.tx_lso_pkts++;
  43.205 +Index: tmp-xxx/drivers/net/e1000/e1000_main.c
  43.206 +===================================================================
  43.207 +--- tmp-xxx.orig/drivers/net/e1000/e1000_main.c	2006-11-15 10:38:39.000000000 +0000
  43.208 ++++ tmp-xxx/drivers/net/e1000/e1000_main.c	2006-11-27 10:52:42.000000000 +0000
  43.209 +@@ -2526,7 +2526,7 @@
  43.210 + 	uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
  43.211 + 	int err;
  43.212 + 
  43.213 +-	if (skb_shinfo(skb)->tso_size) {
  43.214 ++	if (skb_shinfo(skb)->gso_size) {
  43.215 + 		if (skb_header_cloned(skb)) {
  43.216 + 			err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
  43.217 + 			if (err)
  43.218 +@@ -2534,7 +2534,7 @@
  43.219 + 		}
  43.220 + 
  43.221 + 		hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
  43.222 +-		mss = skb_shinfo(skb)->tso_size;
  43.223 ++		mss = skb_shinfo(skb)->gso_size;
  43.224 + 		if (skb->protocol == ntohs(ETH_P_IP)) {
  43.225 + 			skb->nh.iph->tot_len = 0;
  43.226 + 			skb->nh.iph->check = 0;
  43.227 +@@ -2651,7 +2651,7 @@
  43.228 + 		 * tso gets written back prematurely before the data is fully
  43.229 + 		 * DMAd to the controller */
  43.230 + 		if (!skb->data_len && tx_ring->last_tx_tso &&
  43.231 +-				!skb_shinfo(skb)->tso_size) {
  43.232 ++				!skb_shinfo(skb)->gso_size) {
  43.233 + 			tx_ring->last_tx_tso = 0;
  43.234 + 			size -= 4;
  43.235 + 		}
  43.236 +@@ -2893,7 +2893,7 @@
  43.237 + 	}
  43.238 + 
  43.239 + #ifdef NETIF_F_TSO
  43.240 +-	mss = skb_shinfo(skb)->tso_size;
  43.241 ++	mss = skb_shinfo(skb)->gso_size;
  43.242 + 	/* The controller does a simple calculation to 
  43.243 + 	 * make sure there is enough room in the FIFO before
  43.244 + 	 * initiating the DMA for each buffer.  The calc is:
  43.245 +@@ -2935,7 +2935,7 @@
  43.246 + #ifdef NETIF_F_TSO
  43.247 + 	/* Controller Erratum workaround */
  43.248 + 	if (!skb->data_len && tx_ring->last_tx_tso &&
  43.249 +-		!skb_shinfo(skb)->tso_size)
  43.250 ++		!skb_shinfo(skb)->gso_size)
  43.251 + 		count++;
  43.252 + #endif
  43.253 + 
  43.254 +Index: tmp-xxx/drivers/net/forcedeth.c
  43.255 +===================================================================
  43.256 +--- tmp-xxx.orig/drivers/net/forcedeth.c	2006-11-15 10:38:39.000000000 +0000
  43.257 ++++ tmp-xxx/drivers/net/forcedeth.c	2006-11-27 10:52:42.000000000 +0000
  43.258 +@@ -482,9 +482,9 @@
  43.259 +  * critical parts:
  43.260 +  * - rx is (pseudo-) lockless: it relies on the single-threading provided
  43.261 +  *	by the arch code for interrupts.
  43.262 +- * - tx setup is lockless: it relies on dev->xmit_lock. Actual submission
  43.263 ++ * - tx setup is lockless: it relies on netif_tx_lock. Actual submission
  43.264 +  *	needs dev->priv->lock :-(
  43.265 +- * - set_multicast_list: preparation lockless, relies on dev->xmit_lock.
  43.266 ++ * - set_multicast_list: preparation lockless, relies on netif_tx_lock.
  43.267 +  */
  43.268 + 
  43.269 + /* in dev: base, irq */
  43.270 +@@ -1016,7 +1016,7 @@
  43.271 + 
  43.272 + /*
  43.273 +  * nv_start_xmit: dev->hard_start_xmit function
  43.274 +- * Called with dev->xmit_lock held.
  43.275 ++ * Called with netif_tx_lock held.
  43.276 +  */
  43.277 + static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
  43.278 + {
  43.279 +@@ -1105,8 +1105,8 @@
  43.280 + 	np->tx_skbuff[nr] = skb;
  43.281 + 
  43.282 + #ifdef NETIF_F_TSO
  43.283 +-	if (skb_shinfo(skb)->tso_size)
  43.284 +-		tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT);
  43.285 ++	if (skb_shinfo(skb)->gso_size)
  43.286 ++		tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->gso_size << NV_TX2_TSO_SHIFT);
  43.287 + 	else
  43.288 + #endif
  43.289 + 	tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0);
  43.290 +@@ -1203,7 +1203,7 @@
  43.291 + 
  43.292 + /*
  43.293 +  * nv_tx_timeout: dev->tx_timeout function
  43.294 +- * Called with dev->xmit_lock held.
  43.295 ++ * Called with netif_tx_lock held.
  43.296 +  */
  43.297 + static void nv_tx_timeout(struct net_device *dev)
  43.298 + {
  43.299 +@@ -1524,7 +1524,7 @@
  43.300 + 		 * Changing the MTU is a rare event, it shouldn't matter.
  43.301 + 		 */
  43.302 + 		disable_irq(dev->irq);
  43.303 +-		spin_lock_bh(&dev->xmit_lock);
  43.304 ++		netif_tx_lock_bh(dev);
  43.305 + 		spin_lock(&np->lock);
  43.306 + 		/* stop engines */
  43.307 + 		nv_stop_rx(dev);
  43.308 +@@ -1559,7 +1559,7 @@
  43.309 + 		nv_start_rx(dev);
  43.310 + 		nv_start_tx(dev);
  43.311 + 		spin_unlock(&np->lock);
  43.312 +-		spin_unlock_bh(&dev->xmit_lock);
  43.313 ++		netif_tx_unlock_bh(dev);
  43.314 + 		enable_irq(dev->irq);
  43.315 + 	}
  43.316 + 	return 0;
  43.317 +@@ -1594,7 +1594,7 @@
  43.318 + 	memcpy(dev->dev_addr, macaddr->sa_data, ETH_ALEN);
  43.319 + 
  43.320 + 	if (netif_running(dev)) {
  43.321 +-		spin_lock_bh(&dev->xmit_lock);
  43.322 ++		netif_tx_lock_bh(dev);
  43.323 + 		spin_lock_irq(&np->lock);
  43.324 + 
  43.325 + 		/* stop rx engine */
  43.326 +@@ -1606,7 +1606,7 @@
  43.327 + 		/* restart rx engine */
  43.328 + 		nv_start_rx(dev);
  43.329 + 		spin_unlock_irq(&np->lock);
  43.330 +-		spin_unlock_bh(&dev->xmit_lock);
  43.331 ++		netif_tx_unlock_bh(dev);
  43.332 + 	} else {
  43.333 + 		nv_copy_mac_to_hw(dev);
  43.334 + 	}
  43.335 +@@ -1615,7 +1615,7 @@
  43.336 + 
  43.337 + /*
  43.338 +  * nv_set_multicast: dev->set_multicast function
  43.339 +- * Called with dev->xmit_lock held.
  43.340 ++ * Called with netif_tx_lock held.
  43.341 +  */
  43.342 + static void nv_set_multicast(struct net_device *dev)
  43.343 + {
  43.344 +Index: tmp-xxx/drivers/net/hamradio/6pack.c
  43.345 +===================================================================
  43.346 +--- tmp-xxx.orig/drivers/net/hamradio/6pack.c	2006-11-15 10:38:39.000000000 +0000
  43.347 ++++ tmp-xxx/drivers/net/hamradio/6pack.c	2006-11-27 10:52:42.000000000 +0000
  43.348 +@@ -308,9 +308,9 @@
  43.349 + {
  43.350 + 	struct sockaddr_ax25 *sa = addr;
  43.351 + 
  43.352 +-	spin_lock_irq(&dev->xmit_lock);
  43.353 ++	netif_tx_lock_bh(dev);
  43.354 + 	memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
  43.355 +-	spin_unlock_irq(&dev->xmit_lock);
  43.356 ++	netif_tx_unlock_bh(dev);
  43.357 + 
  43.358 + 	return 0;
  43.359 + }
  43.360 +@@ -767,9 +767,9 @@
  43.361 + 			break;
  43.362 + 		}
  43.363 + 
  43.364 +-		spin_lock_irq(&dev->xmit_lock);
  43.365 ++		netif_tx_lock_bh(dev);
  43.366 + 		memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN);
  43.367 +-		spin_unlock_irq(&dev->xmit_lock);
  43.368 ++		netif_tx_unlock_bh(dev);
  43.369 + 
  43.370 + 		err = 0;
  43.371 + 		break;
  43.372 +Index: tmp-xxx/drivers/net/hamradio/mkiss.c
  43.373 +===================================================================
  43.374 +--- tmp-xxx.orig/drivers/net/hamradio/mkiss.c	2006-11-15 10:38:39.000000000 +0000
  43.375 ++++ tmp-xxx/drivers/net/hamradio/mkiss.c	2006-11-27 10:52:42.000000000 +0000
  43.376 +@@ -357,9 +357,9 @@
  43.377 + {
  43.378 + 	struct sockaddr_ax25 *sa = addr;
  43.379 + 
  43.380 +-	spin_lock_irq(&dev->xmit_lock);
  43.381 ++	netif_tx_lock_bh(dev);
  43.382 + 	memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
  43.383 +-	spin_unlock_irq(&dev->xmit_lock);
  43.384 ++	netif_tx_unlock_bh(dev);
  43.385 + 
  43.386 + 	return 0;
  43.387 + }
  43.388 +@@ -886,9 +886,9 @@
  43.389 + 			break;
  43.390 + 		}
  43.391 + 
  43.392 +-		spin_lock_irq(&dev->xmit_lock);
  43.393 ++		netif_tx_lock_bh(dev);
  43.394 + 		memcpy(dev->dev_addr, addr, AX25_ADDR_LEN);
  43.395 +-		spin_unlock_irq(&dev->xmit_lock);
  43.396 ++		netif_tx_unlock_bh(dev);
  43.397 + 
  43.398 + 		err = 0;
  43.399 + 		break;
  43.400 +Index: tmp-xxx/drivers/net/ifb.c
  43.401 +===================================================================
  43.402 +--- tmp-xxx.orig/drivers/net/ifb.c	2006-11-15 10:38:39.000000000 +0000
  43.403 ++++ tmp-xxx/drivers/net/ifb.c	2006-11-27 10:52:42.000000000 +0000
  43.404 +@@ -76,13 +76,13 @@
  43.405 + 	dp->st_task_enter++;
  43.406 + 	if ((skb = skb_peek(&dp->tq)) == NULL) {
  43.407 + 		dp->st_txq_refl_try++;
  43.408 +-		if (spin_trylock(&_dev->xmit_lock)) {
  43.409 ++		if (netif_tx_trylock(_dev)) {
  43.410 + 			dp->st_rxq_enter++;
  43.411 + 			while ((skb = skb_dequeue(&dp->rq)) != NULL) {
  43.412 + 				skb_queue_tail(&dp->tq, skb);
  43.413 + 				dp->st_rx2tx_tran++;
  43.414 + 			}
  43.415 +-			spin_unlock(&_dev->xmit_lock);
  43.416 ++			netif_tx_unlock(_dev);
  43.417 + 		} else {
  43.418 + 			/* reschedule */
  43.419 + 			dp->st_rxq_notenter++;
  43.420 +@@ -110,7 +110,7 @@
  43.421 + 		}
  43.422 + 	}
  43.423 + 
  43.424 +-	if (spin_trylock(&_dev->xmit_lock)) {
  43.425 ++	if (netif_tx_trylock(_dev)) {
  43.426 + 		dp->st_rxq_check++;
  43.427 + 		if ((skb = skb_peek(&dp->rq)) == NULL) {
  43.428 + 			dp->tasklet_pending = 0;
  43.429 +@@ -118,10 +118,10 @@
  43.430 + 				netif_wake_queue(_dev);
  43.431 + 		} else {
  43.432 + 			dp->st_rxq_rsch++;
  43.433 +-			spin_unlock(&_dev->xmit_lock);
  43.434 ++			netif_tx_unlock(_dev);
  43.435 + 			goto resched;
  43.436 + 		}
  43.437 +-		spin_unlock(&_dev->xmit_lock);
  43.438 ++		netif_tx_unlock(_dev);
  43.439 + 	} else {
  43.440 + resched:
  43.441 + 		dp->tasklet_pending = 1;
  43.442 +Index: tmp-xxx/drivers/net/irda/vlsi_ir.c
  43.443 +===================================================================
  43.444 +--- tmp-xxx.orig/drivers/net/irda/vlsi_ir.c	2006-11-15 10:38:39.000000000 +0000
  43.445 ++++ tmp-xxx/drivers/net/irda/vlsi_ir.c	2006-11-27 10:52:42.000000000 +0000
  43.446 +@@ -959,7 +959,7 @@
  43.447 + 			    ||  (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec))
  43.448 + 			    	break;
  43.449 + 			udelay(100);
  43.450 +-			/* must not sleep here - we are called under xmit_lock! */
  43.451 ++			/* must not sleep here - called under netif_tx_lock! */
  43.452 + 		}
  43.453 + 	}
  43.454 + 
  43.455 +Index: tmp-xxx/drivers/net/ixgb/ixgb_main.c
  43.456 +===================================================================
  43.457 +--- tmp-xxx.orig/drivers/net/ixgb/ixgb_main.c	2006-11-15 10:38:39.000000000 +0000
  43.458 ++++ tmp-xxx/drivers/net/ixgb/ixgb_main.c	2006-11-27 10:52:42.000000000 +0000
  43.459 +@@ -1163,7 +1163,7 @@
  43.460 + 	uint16_t ipcse, tucse, mss;
  43.461 + 	int err;
  43.462 + 
  43.463 +-	if(likely(skb_shinfo(skb)->tso_size)) {
  43.464 ++	if(likely(skb_shinfo(skb)->gso_size)) {
  43.465 + 		if (skb_header_cloned(skb)) {
  43.466 + 			err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
  43.467 + 			if (err)
  43.468 +@@ -1171,7 +1171,7 @@
  43.469 + 		}
  43.470 + 
  43.471 + 		hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
  43.472 +-		mss = skb_shinfo(skb)->tso_size;
  43.473 ++		mss = skb_shinfo(skb)->gso_size;
  43.474 + 		skb->nh.iph->tot_len = 0;
  43.475 + 		skb->nh.iph->check = 0;
  43.476 + 		skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr,
  43.477 +Index: tmp-xxx/drivers/net/loopback.c
  43.478 +===================================================================
  43.479 +--- tmp-xxx.orig/drivers/net/loopback.c	2006-11-15 10:38:39.000000000 +0000
  43.480 ++++ tmp-xxx/drivers/net/loopback.c	2006-11-27 10:52:42.000000000 +0000
  43.481 +@@ -74,7 +74,7 @@
  43.482 + 	struct iphdr *iph = skb->nh.iph;
  43.483 + 	struct tcphdr *th = (struct tcphdr*)(skb->nh.raw + (iph->ihl * 4));
  43.484 + 	unsigned int doffset = (iph->ihl + th->doff) * 4;
  43.485 +-	unsigned int mtu = skb_shinfo(skb)->tso_size + doffset;
  43.486 ++	unsigned int mtu = skb_shinfo(skb)->gso_size + doffset;
  43.487 + 	unsigned int offset = 0;
  43.488 + 	u32 seq = ntohl(th->seq);
  43.489 + 	u16 id  = ntohs(iph->id);
  43.490 +@@ -139,7 +139,7 @@
  43.491 + #endif
  43.492 + 
  43.493 + #ifdef LOOPBACK_TSO
  43.494 +-	if (skb_shinfo(skb)->tso_size) {
  43.495 ++	if (skb_shinfo(skb)->gso_size) {
  43.496 + 		BUG_ON(skb->protocol != htons(ETH_P_IP));
  43.497 + 		BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP);
  43.498 + 
  43.499 +Index: tmp-xxx/drivers/net/mv643xx_eth.c
  43.500 +===================================================================
  43.501 +--- tmp-xxx.orig/drivers/net/mv643xx_eth.c	2006-11-15 10:38:39.000000000 +0000
  43.502 ++++ tmp-xxx/drivers/net/mv643xx_eth.c	2006-11-27 10:52:42.000000000 +0000
  43.503 +@@ -1107,7 +1107,7 @@
  43.504 + 
  43.505 + #ifdef MV643XX_CHECKSUM_OFFLOAD_TX
  43.506 + 	if (has_tiny_unaligned_frags(skb)) {
  43.507 +-		if ((skb_linearize(skb, GFP_ATOMIC) != 0)) {
  43.508 ++		if (__skb_linearize(skb)) {
  43.509 + 			stats->tx_dropped++;
  43.510 + 			printk(KERN_DEBUG "%s: failed to linearize tiny "
  43.511 + 					"unaligned fragment\n", dev->name);
  43.512 +Index: tmp-xxx/drivers/net/natsemi.c
  43.513 +===================================================================
  43.514 +--- tmp-xxx.orig/drivers/net/natsemi.c	2006-11-15 10:38:39.000000000 +0000
  43.515 ++++ tmp-xxx/drivers/net/natsemi.c	2006-11-27 10:52:42.000000000 +0000
  43.516 +@@ -323,12 +323,12 @@
  43.517 + The rx process only runs in the interrupt handler. Access from outside
  43.518 + the interrupt handler is only permitted after disable_irq().
  43.519 + 
  43.520 +-The rx process usually runs under the dev->xmit_lock. If np->intr_tx_reap
  43.521 ++The rx process usually runs under the netif_tx_lock. If np->intr_tx_reap
  43.522 + is set, then access is permitted under spin_lock_irq(&np->lock).
  43.523 + 
  43.524 + Thus configuration functions that want to access everything must call
  43.525 + 	disable_irq(dev->irq);
  43.526 +-	spin_lock_bh(dev->xmit_lock);
  43.527 ++	netif_tx_lock_bh(dev);
  43.528 + 	spin_lock_irq(&np->lock);
  43.529 + 
  43.530 + IV. Notes
  43.531 +Index: tmp-xxx/drivers/net/r8169.c
  43.532 +===================================================================
  43.533 +--- tmp-xxx.orig/drivers/net/r8169.c	2006-11-15 10:38:39.000000000 +0000
  43.534 ++++ tmp-xxx/drivers/net/r8169.c	2006-11-27 10:52:42.000000000 +0000
  43.535 +@@ -2171,7 +2171,7 @@
  43.536 + static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev)
  43.537 + {
  43.538 + 	if (dev->features & NETIF_F_TSO) {
  43.539 +-		u32 mss = skb_shinfo(skb)->tso_size;
  43.540 ++		u32 mss = skb_shinfo(skb)->gso_size;
  43.541 + 
  43.542 + 		if (mss)
  43.543 + 			return LargeSend | ((mss & MSSMask) << MSSShift);
  43.544 +Index: tmp-xxx/drivers/net/s2io.c
  43.545 +===================================================================
  43.546 +--- tmp-xxx.orig/drivers/net/s2io.c	2006-11-15 10:38:39.000000000 +0000
  43.547 ++++ tmp-xxx/drivers/net/s2io.c	2006-11-27 10:52:42.000000000 +0000
  43.548 +@@ -3522,8 +3522,8 @@
  43.549 + 	txdp->Control_1 = 0;
  43.550 + 	txdp->Control_2 = 0;
  43.551 + #ifdef NETIF_F_TSO
  43.552 +-	mss = skb_shinfo(skb)->tso_size;
  43.553 +-	if (mss) {
  43.554 ++	mss = skb_shinfo(skb)->gso_size;
  43.555 ++	if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV4) {
  43.556 + 		txdp->Control_1 |= TXD_TCP_LSO_EN;
  43.557 + 		txdp->Control_1 |= TXD_TCP_LSO_MSS(mss);
  43.558 + 	}
  43.559 +@@ -3543,10 +3543,10 @@
  43.560 + 	}
  43.561 + 
  43.562 + 	frg_len = skb->len - skb->data_len;
  43.563 +-	if (skb_shinfo(skb)->ufo_size) {
  43.564 ++	if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) {
  43.565 + 		int ufo_size;
  43.566 + 
  43.567 +-		ufo_size = skb_shinfo(skb)->ufo_size;
  43.568 ++		ufo_size = skb_shinfo(skb)->gso_size;
  43.569 + 		ufo_size &= ~7;
  43.570 + 		txdp->Control_1 |= TXD_UFO_EN;
  43.571 + 		txdp->Control_1 |= TXD_UFO_MSS(ufo_size);
  43.572 +@@ -3572,7 +3572,7 @@
  43.573 + 	txdp->Host_Control = (unsigned long) skb;
  43.574 + 	txdp->Control_1 |= TXD_BUFFER0_SIZE(frg_len);
  43.575 + 
  43.576 +-	if (skb_shinfo(skb)->ufo_size)
  43.577 ++	if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
  43.578 + 		txdp->Control_1 |= TXD_UFO_EN;
  43.579 + 
  43.580 + 	frg_cnt = skb_shinfo(skb)->nr_frags;
  43.581 +@@ -3587,12 +3587,12 @@
  43.582 + 		    (sp->pdev, frag->page, frag->page_offset,
  43.583 + 		     frag->size, PCI_DMA_TODEVICE);
  43.584 + 		txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size);
  43.585 +-		if (skb_shinfo(skb)->ufo_size)
  43.586 ++		if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
  43.587 + 			txdp->Control_1 |= TXD_UFO_EN;
  43.588 + 	}
  43.589 + 	txdp->Control_1 |= TXD_GATHER_CODE_LAST;
  43.590 + 
  43.591 +-	if (skb_shinfo(skb)->ufo_size)
  43.592 ++	if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
  43.593 + 		frg_cnt++; /* as Txd0 was used for inband header */
  43.594 + 
  43.595 + 	tx_fifo = mac_control->tx_FIFO_start[queue];
  43.596 +@@ -3606,7 +3606,7 @@
  43.597 + 	if (mss)
  43.598 + 		val64 |= TX_FIFO_SPECIAL_FUNC;
  43.599 + #endif
  43.600 +-	if (skb_shinfo(skb)->ufo_size)
  43.601 ++	if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
  43.602 + 		val64 |= TX_FIFO_SPECIAL_FUNC;
  43.603 + 	writeq(val64, &tx_fifo->List_Control);
  43.604 + 
  43.605 +Index: tmp-xxx/drivers/net/sky2.c
  43.606 +===================================================================
  43.607 +--- tmp-xxx.orig/drivers/net/sky2.c	2006-11-15 10:38:39.000000000 +0000
  43.608 ++++ tmp-xxx/drivers/net/sky2.c	2006-11-27 10:52:42.000000000 +0000
  43.609 +@@ -1141,7 +1141,7 @@
  43.610 + 	count = sizeof(dma_addr_t) / sizeof(u32);
  43.611 + 	count += skb_shinfo(skb)->nr_frags * count;
  43.612 + 
  43.613 +-	if (skb_shinfo(skb)->tso_size)
  43.614 ++	if (skb_shinfo(skb)->gso_size)
  43.615 + 		++count;
  43.616 + 
  43.617 + 	if (skb->ip_summed == CHECKSUM_HW)
  43.618 +@@ -1213,7 +1213,7 @@
  43.619 + 	}
  43.620 + 
  43.621 + 	/* Check for TCP Segmentation Offload */
  43.622 +-	mss = skb_shinfo(skb)->tso_size;
  43.623 ++	mss = skb_shinfo(skb)->gso_size;
  43.624 + 	if (mss != 0) {
  43.625 + 		/* just drop the packet if non-linear expansion fails */
  43.626 + 		if (skb_header_cloned(skb) &&
  43.627 +Index: tmp-xxx/drivers/net/tg3.c
  43.628 +===================================================================
  43.629 +--- tmp-xxx.orig/drivers/net/tg3.c	2006-11-15 10:38:39.000000000 +0000
  43.630 ++++ tmp-xxx/drivers/net/tg3.c	2006-11-27 10:52:42.000000000 +0000
  43.631 +@@ -3664,7 +3664,7 @@
  43.632 + #if TG3_TSO_SUPPORT != 0
  43.633 + 	mss = 0;
  43.634 + 	if (skb->len > (tp->dev->mtu + ETH_HLEN) &&
  43.635 +-	    (mss = skb_shinfo(skb)->tso_size) != 0) {
  43.636 ++	    (mss = skb_shinfo(skb)->gso_size) != 0) {
  43.637 + 		int tcp_opt_len, ip_tcp_len;
  43.638 + 
  43.639 + 		if (skb_header_cloned(skb) &&
  43.640 +Index: tmp-xxx/drivers/net/tulip/winbond-840.c
  43.641 +===================================================================
  43.642 +--- tmp-xxx.orig/drivers/net/tulip/winbond-840.c	2006-11-15 10:38:39.000000000 +0000
  43.643 ++++ tmp-xxx/drivers/net/tulip/winbond-840.c	2006-11-27 10:52:42.000000000 +0000
  43.644 +@@ -1605,11 +1605,11 @@
  43.645 +  * - get_stats:
  43.646 +  * 	spin_lock_irq(np->lock), doesn't touch hw if not present
  43.647 +  * - hard_start_xmit:
  43.648 +- * 	netif_stop_queue + spin_unlock_wait(&dev->xmit_lock);
  43.649 ++ * 	synchronize_irq + netif_tx_disable;
  43.650 +  * - tx_timeout:
  43.651 +- * 	netif_device_detach + spin_unlock_wait(&dev->xmit_lock);
  43.652 ++ * 	netif_device_detach + netif_tx_disable;
  43.653 +  * - set_multicast_list
  43.654 +- * 	netif_device_detach + spin_unlock_wait(&dev->xmit_lock);
  43.655 ++ * 	netif_device_detach + netif_tx_disable;
  43.656 +  * - interrupt handler
  43.657 +  * 	doesn't touch hw if not present, synchronize_irq waits for
  43.658 +  * 	running instances of the interrupt handler.
  43.659 +@@ -1635,11 +1635,10 @@
  43.660 + 		netif_device_detach(dev);
  43.661 + 		update_csr6(dev, 0);
  43.662 + 		iowrite32(0, ioaddr + IntrEnable);
  43.663 +-		netif_stop_queue(dev);
  43.664 + 		spin_unlock_irq(&np->lock);
  43.665 + 
  43.666 +-		spin_unlock_wait(&dev->xmit_lock);
  43.667 + 		synchronize_irq(dev->irq);
  43.668 ++		netif_tx_disable(dev);
  43.669 + 	
  43.670 + 		np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff;
  43.671 + 
  43.672 +Index: tmp-xxx/drivers/net/typhoon.c
  43.673 +===================================================================
  43.674 +--- tmp-xxx.orig/drivers/net/typhoon.c	2006-11-15 10:38:39.000000000 +0000
  43.675 ++++ tmp-xxx/drivers/net/typhoon.c	2006-11-27 10:52:42.000000000 +0000
  43.676 +@@ -340,7 +340,7 @@
  43.677 + #endif
  43.678 + 
  43.679 + #if defined(NETIF_F_TSO)
  43.680 +-#define skb_tso_size(x)		(skb_shinfo(x)->tso_size)
  43.681 ++#define skb_tso_size(x)		(skb_shinfo(x)->gso_size)
  43.682 + #define TSO_NUM_DESCRIPTORS	2
  43.683 + #define TSO_OFFLOAD_ON		TYPHOON_OFFLOAD_TCP_SEGMENT
  43.684 + #else
  43.685 +Index: tmp-xxx/drivers/net/via-velocity.c
  43.686 +===================================================================
  43.687 +--- tmp-xxx.orig/drivers/net/via-velocity.c	2006-11-15 10:38:39.000000000 +0000
  43.688 ++++ tmp-xxx/drivers/net/via-velocity.c	2006-11-27 10:52:42.000000000 +0000
  43.689 +@@ -1905,6 +1905,13 @@
  43.690 + 
  43.691 + 	int pktlen = skb->len;
  43.692 + 
  43.693 ++#ifdef VELOCITY_ZERO_COPY_SUPPORT
  43.694 ++	if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) {
  43.695 ++		kfree_skb(skb);
  43.696 ++		return 0;
  43.697 ++	}
  43.698 ++#endif
  43.699 ++
  43.700 + 	spin_lock_irqsave(&vptr->lock, flags);
  43.701 + 
  43.702 + 	index = vptr->td_curr[qnum];
  43.703 +@@ -1920,8 +1927,6 @@
  43.704 + 	 */
  43.705 + 	if (pktlen < ETH_ZLEN) {
  43.706 + 		/* Cannot occur until ZC support */
  43.707 +-		if(skb_linearize(skb, GFP_ATOMIC))
  43.708 +-			return 0; 
  43.709 + 		pktlen = ETH_ZLEN;
  43.710 + 		memcpy(tdinfo->buf, skb->data, skb->len);
  43.711 + 		memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len);
  43.712 +@@ -1939,7 +1944,6 @@
  43.713 + 		int nfrags = skb_shinfo(skb)->nr_frags;
  43.714 + 		tdinfo->skb = skb;
  43.715 + 		if (nfrags > 6) {
  43.716 +-			skb_linearize(skb, GFP_ATOMIC);
  43.717 + 			memcpy(tdinfo->buf, skb->data, skb->len);
  43.718 + 			tdinfo->skb_dma[0] = tdinfo->buf_dma;
  43.719 + 			td_ptr->tdesc0.pktsize = 
  43.720 +Index: tmp-xxx/drivers/net/wireless/orinoco.c
  43.721 +===================================================================
  43.722 +--- tmp-xxx.orig/drivers/net/wireless/orinoco.c	2006-11-15 10:38:39.000000000 +0000
  43.723 ++++ tmp-xxx/drivers/net/wireless/orinoco.c	2006-11-27 10:52:42.000000000 +0000
  43.724 +@@ -1835,7 +1835,9 @@
  43.725 + 	/* Set promiscuity / multicast*/
  43.726 + 	priv->promiscuous = 0;
  43.727 + 	priv->mc_count = 0;
  43.728 +-	__orinoco_set_multicast_list(dev); /* FIXME: what about the xmit_lock */
  43.729 ++
  43.730 ++	/* FIXME: what about netif_tx_lock */
  43.731 ++	__orinoco_set_multicast_list(dev);
  43.732 + 
  43.733 + 	return 0;
  43.734 + }
  43.735 +Index: tmp-xxx/drivers/s390/net/qeth_eddp.c
  43.736 +===================================================================
  43.737 +--- tmp-xxx.orig/drivers/s390/net/qeth_eddp.c	2006-11-15 10:38:39.000000000 +0000
  43.738 ++++ tmp-xxx/drivers/s390/net/qeth_eddp.c	2006-11-27 10:52:42.000000000 +0000
  43.739 +@@ -421,7 +421,7 @@
  43.740 +        }
  43.741 + 	tcph = eddp->skb->h.th;
  43.742 + 	while (eddp->skb_offset < eddp->skb->len) {
  43.743 +-		data_len = min((int)skb_shinfo(eddp->skb)->tso_size,
  43.744 ++		data_len = min((int)skb_shinfo(eddp->skb)->gso_size,
  43.745 + 			       (int)(eddp->skb->len - eddp->skb_offset));
  43.746 + 		/* prepare qdio hdr */
  43.747 + 		if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2){
  43.748 +@@ -516,20 +516,20 @@
  43.749 + 	
  43.750 + 	QETH_DBF_TEXT(trace, 5, "eddpcanp");
  43.751 + 	/* can we put multiple skbs in one page? */
  43.752 +-	skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->tso_size + hdr_len);
  43.753 ++	skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->gso_size + hdr_len);
  43.754 + 	if (skbs_per_page > 1){
  43.755 +-		ctx->num_pages = (skb_shinfo(skb)->tso_segs + 1) /
  43.756 ++		ctx->num_pages = (skb_shinfo(skb)->gso_segs + 1) /
  43.757 + 				 skbs_per_page + 1;
  43.758 + 		ctx->elements_per_skb = 1;
  43.759 + 	} else {
  43.760 + 		/* no -> how many elements per skb? */
  43.761 +-		ctx->elements_per_skb = (skb_shinfo(skb)->tso_size + hdr_len +
  43.762 ++		ctx->elements_per_skb = (skb_shinfo(skb)->gso_size + hdr_len +
  43.763 + 				     PAGE_SIZE) >> PAGE_SHIFT;
  43.764 + 		ctx->num_pages = ctx->elements_per_skb *
  43.765 +-				 (skb_shinfo(skb)->tso_segs + 1);
  43.766 ++				 (skb_shinfo(skb)->gso_segs + 1);
  43.767 + 	}
  43.768 + 	ctx->num_elements = ctx->elements_per_skb *
  43.769 +-			    (skb_shinfo(skb)->tso_segs + 1);
  43.770 ++			    (skb_shinfo(skb)->gso_segs + 1);
  43.771 + }
  43.772 + 
  43.773 + static inline struct qeth_eddp_context *
  43.774 +Index: tmp-xxx/drivers/s390/net/qeth_main.c
  43.775 +===================================================================
  43.776 +--- tmp-xxx.orig/drivers/s390/net/qeth_main.c	2006-11-15 10:38:39.000000000 +0000
  43.777 ++++ tmp-xxx/drivers/s390/net/qeth_main.c	2006-11-27 10:52:42.000000000 +0000
  43.778 +@@ -4454,7 +4454,7 @@
  43.779 + 	queue = card->qdio.out_qs
  43.780 + 		[qeth_get_priority_queue(card, skb, ipv, cast_type)];
  43.781 + 
  43.782 +-	if (skb_shinfo(skb)->tso_size)
  43.783 ++	if (skb_shinfo(skb)->gso_size)
  43.784 + 		large_send = card->options.large_send;
  43.785 + 
  43.786 + 	/*are we able to do TSO ? If so ,prepare and send it from here */
  43.787 +@@ -4501,7 +4501,7 @@
  43.788 + 		card->stats.tx_packets++;
  43.789 + 		card->stats.tx_bytes += skb->len;
  43.790 + #ifdef CONFIG_QETH_PERF_STATS
  43.791 +-		if (skb_shinfo(skb)->tso_size &&
  43.792 ++		if (skb_shinfo(skb)->gso_size &&
  43.793 + 		   !(large_send == QETH_LARGE_SEND_NO)) {
  43.794 + 			card->perf_stats.large_send_bytes += skb->len;
  43.795 + 			card->perf_stats.large_send_cnt++;
  43.796 +Index: tmp-xxx/drivers/s390/net/qeth_tso.h
  43.797 +===================================================================
  43.798 +--- tmp-xxx.orig/drivers/s390/net/qeth_tso.h	2006-11-15 10:38:39.000000000 +0000
  43.799 ++++ tmp-xxx/drivers/s390/net/qeth_tso.h	2006-11-27 10:52:42.000000000 +0000
  43.800 +@@ -51,7 +51,7 @@
  43.801 + 	hdr->ext.hdr_version = 1;
  43.802 + 	hdr->ext.hdr_len     = 28;
  43.803 + 	/*insert non-fix values */
  43.804 +-	hdr->ext.mss = skb_shinfo(skb)->tso_size;
  43.805 ++	hdr->ext.mss = skb_shinfo(skb)->gso_size;
  43.806 + 	hdr->ext.dg_hdr_len = (__u16)(iph->ihl*4 + tcph->doff*4);
  43.807 + 	hdr->ext.payload_len = (__u16)(skb->len - hdr->ext.dg_hdr_len -
  43.808 + 				       sizeof(struct qeth_hdr_tso));
  43.809 +Index: tmp-xxx/include/linux/ethtool.h
  43.810 +===================================================================
  43.811 +--- tmp-xxx.orig/include/linux/ethtool.h	2006-11-15 10:38:39.000000000 +0000
  43.812 ++++ tmp-xxx/include/linux/ethtool.h	2006-11-27 10:52:42.000000000 +0000
  43.813 +@@ -408,6 +408,8 @@
  43.814 + #define ETHTOOL_GPERMADDR	0x00000020 /* Get permanent hardware address */
  43.815 + #define ETHTOOL_GUFO		0x00000021 /* Get UFO enable (ethtool_value) */
  43.816 + #define ETHTOOL_SUFO		0x00000022 /* Set UFO enable (ethtool_value) */
  43.817 ++#define ETHTOOL_GGSO		0x00000023 /* Get GSO enable (ethtool_value) */
  43.818 ++#define ETHTOOL_SGSO		0x00000024 /* Set GSO enable (ethtool_value) */
  43.819 +