## Automatically generated incremental diff
## From:   linux-2.4.8-pre5
## To:     linux-2.4.8-pre6
## Robot:  $Id: make-incremental-diff,v 1.8 2001/12/04 06:05:04 hpa Exp $

diff -urN linux-2.4.8-pre5/MAINTAINERS linux/MAINTAINERS
--- linux-2.4.8-pre5/MAINTAINERS	Mon Dec  3 22:59:10 2001
+++ linux/MAINTAINERS	Mon Dec  3 22:59:19 2001
@@ -486,7 +486,7 @@
 P:	Lennert Buytenhek
 M:	buytenh@gnu.org
 L:	bridge@math.leidenuniv.nl
-W:	http://www.math.leidenuniv.nl/~buytenh/bridge
+W:	http://bridge.sourceforge.net/
 S:	Maintained
 
 ETHERTEAM 16I DRIVER
diff -urN linux-2.4.8-pre5/arch/sparc/kernel/ebus.c linux/arch/sparc/kernel/ebus.c
--- linux-2.4.8-pre5/arch/sparc/kernel/ebus.c	Sun Feb 18 19:49:44 2001
+++ linux/arch/sparc/kernel/ebus.c	Mon Dec  3 22:59:19 2001
@@ -1,4 +1,4 @@
-/* $Id: ebus.c,v 1.16 2001/02/13 01:16:43 davem Exp $
+/* $Id: ebus.c,v 1.17 2001/08/06 13:12:57 davem Exp $
  * ebus.c: PCI to EBus bridge device.
  *
  * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
@@ -27,6 +27,7 @@
 #ifdef CONFIG_SUN_AUXIO
 extern void auxio_probe(void);
 #endif
+extern void rs_init(void);
 
 /* We are together with pcic.c under CONFIG_PCI. */
 extern unsigned int pcic_pin_to_irq(unsigned int, char *name);
@@ -358,6 +359,7 @@
 		++num_ebus;
 	}
 
+	rs_init();
 #ifdef CONFIG_SUN_AUXIO
 	auxio_probe();
 #endif
diff -urN linux-2.4.8-pre5/arch/sparc/mm/extable.c linux/arch/sparc/mm/extable.c
--- linux-2.4.8-pre5/arch/sparc/mm/extable.c	Wed Nov 10 08:31:37 1999
+++ linux/arch/sparc/mm/extable.c	Mon Dec  3 22:59:19 2001
@@ -46,24 +46,27 @@
 unsigned long
 search_exception_table(unsigned long addr, unsigned long *g2)
 {
-	unsigned long ret;
+	unsigned long ret = 0, flags;
 
 #ifndef CONFIG_MODULES
 	/* There is only the kernel to search.  */
 	ret = search_one_table(__start___ex_table,
 			       __stop___ex_table-1, addr, g2);
-	if (ret) return ret;
+	return ret;
 #else
 	/* The kernel is the last "module" -- no need to treat it special.  */
 	struct module *mp;
+
+	spin_lock_irqsave(&modlist_lock, flags);
 	for (mp = module_list; mp != NULL; mp = mp->next) {
-		if (mp->ex_table_start == NULL)
+		if (mp->ex_table_start == NULL || !(mp->flags & (MOD_RUNNING | MOD_INITIALIZING)))
 			continue;
 		ret = search_one_table(mp->ex_table_start,
 				       mp->ex_table_end-1, addr, g2);
-		if (ret) return ret;
+		if (ret)
+			break;
 	}
+	spin_unlock_irqrestore(&modlist_lock, flags);
+	return ret;
 #endif
-
-	return 0;
 }
diff -urN linux-2.4.8-pre5/arch/sparc64/defconfig linux/arch/sparc64/defconfig
--- linux-2.4.8-pre5/arch/sparc64/defconfig	Fri Jul 20 12:50:24 2001
+++ linux/arch/sparc64/defconfig	Mon Dec  3 22:59:19 2001
@@ -101,6 +101,8 @@
 # CONFIG_FB_E1355 is not set
 # CONFIG_FB_MATROX is not set
 CONFIG_FB_ATY=y
+# CONFIG_FB_ATY_GX is not set
+CONFIG_FB_ATY_CT=y
 # CONFIG_FB_ATY128 is not set
 # CONFIG_FB_3DFX is not set
 # CONFIG_FB_SIS is not set
@@ -112,6 +114,7 @@
 # CONFIG_FB_LEO is not set
 CONFIG_FB_PCI=y
 CONFIG_FB_ATY=y
+CONFIG_FB_ATY_CT=y
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_FBCON_ADVANCED is not set
 CONFIG_FBCON_CFB8=y
@@ -407,6 +410,7 @@
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
+# CONFIG_ARM_AM79C961A is not set
 CONFIG_SUNLANCE=y
 CONFIG_HAPPYMEAL=y
 CONFIG_SUNBMAC=m
diff -urN linux-2.4.8-pre5/arch/sparc64/kernel/ioctl32.c linux/arch/sparc64/kernel/ioctl32.c
--- linux-2.4.8-pre5/arch/sparc64/kernel/ioctl32.c	Mon Dec  3 22:59:10 2001
+++ linux/arch/sparc64/kernel/ioctl32.c	Mon Dec  3 22:59:19 2001
@@ -1,4 +1,4 @@
-/* $Id: ioctl32.c,v 1.119 2001/07/21 00:28:25 davem Exp $
+/* $Id: ioctl32.c,v 1.121 2001/08/03 14:27:21 davem Exp $
  * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
  *
  * Copyright (C) 1997-2000  Jakub Jelinek  (jakub@redhat.com)
@@ -51,9 +51,6 @@
 #include <linux/rtc.h>
 #include <linux/pci.h>
 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
-/* Ugh. This header really is not clean */
-#define min min
-#define max max
 #include <linux/lvm.h>
 #endif /* LVM */
 
@@ -73,6 +70,7 @@
 #include <asm/envctrl.h>
 #include <asm/audioio.h>
 #include <linux/ethtool.h>
+#include <linux/mii.h>
 #include <asm/display7seg.h>
 #include <asm/watchdog.h>
 #include <asm/module.h>
@@ -544,7 +542,7 @@
 	return err;
 }
 
-static inline int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+static int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	struct ifreq ifr;
 	mm_segment_t old_fs;
@@ -593,6 +591,44 @@
 	return err;
 }
 
+static int mii_ioctl(unsigned long fd, unsigned int cmd, unsigned long arg)
+{
+	struct ifreq ifr;
+	mm_segment_t old_fs;
+	int err;
+	u32 data;
+
+	if (copy_from_user(&ifr, (struct ifreq32 *)arg, sizeof(struct ifreq32)))
+		return -EFAULT;
+	ifr.ifr_data = (__kernel_caddr_t) kmalloc(sizeof(struct mii_ioctl_data),
+						  GFP_KERNEL);
+	if (!ifr.ifr_data)
+		return -EAGAIN;
+
+	__get_user(data, &(((struct ifreq32 *)arg)->ifr_ifru.ifru_data));
+	if (copy_from_user(ifr.ifr_data, (char *)A(data),
+			   sizeof(struct mii_ioctl_data))) {
+		err = -EFAULT;
+		goto out;
+	}
+
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	err = sys_ioctl(fd, cmd, (unsigned long)&ifr);
+	set_fs(old_fs);
+
+	if (!err) {
+		if (copy_to_user((char *)A(data),
+				 ifr.ifr_data,
+				 sizeof(struct mii_ioctl_data)))
+			err = -EFAULT;
+	}
+
+out:
+	kfree(ifr.ifr_data);
+	return err;
+}
+
 static inline int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	struct ifreq ifr;
@@ -4250,6 +4286,9 @@
 HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc)
 HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc)
 HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl)
+HANDLE_IOCTL(SIOCGMIIPHY, mii_ioctl)
+HANDLE_IOCTL(SIOCGMIIREG, mii_ioctl)
+HANDLE_IOCTL(SIOCSMIIREG, mii_ioctl)
 HANDLE_IOCTL(SIOCADDRT, routing_ioctl)
 HANDLE_IOCTL(SIOCDELRT, routing_ioctl)
 /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
diff -urN linux-2.4.8-pre5/arch/sparc64/kernel/smp.c linux/arch/sparc64/kernel/smp.c
--- linux-2.4.8-pre5/arch/sparc64/kernel/smp.c	Thu Apr 26 22:17:25 2001
+++ linux/arch/sparc64/kernel/smp.c	Mon Dec  3 22:59:19 2001
@@ -604,9 +604,6 @@
  * are flush_tlb_*() routines, and these run after flush_cache_*()
  * which performs the flushw.
  *
- * XXX I diked out the fancy flush avoidance code for the
- * XXX swapping cases for now until the new MM code stabilizes. -DaveM
- *
  * The SMP TLB coherency scheme we use works as follows:
  *
  * 1) mm->cpu_vm_mask is a bit mask of which cpus an address
@@ -642,10 +639,20 @@
  *    call won't even show up on the performance radar.  But in any case we do get
  *    rid of the cross-call when the task has a dead context or the task has only
  *    ever run on the local cpu.
+ *
+ * 4) If the mm never had a valid context yet, there is nothing to
+ *    flush.  CTX_NEVER_WAS_VALID checks this.
+ *
+ *    This check used to be done with CTX_VALID(), but Kanoj Sarcar has
+ *    pointed out that this is an invalid optimization.  It can cause
+ *    stale translations to be left in the TLB.
  */
 void smp_flush_tlb_mm(struct mm_struct *mm)
 {
-	if (CTX_VALID(mm->context)) {
+	if (CTX_NEVER_WAS_VALID(mm->context))
+		return;
+
+	{
 		u32 ctx = CTX_HWBITS(mm->context);
 		int cpu = smp_processor_id();
 
@@ -665,7 +672,10 @@
 void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start,
 			 unsigned long end)
 {
-	if (CTX_VALID(mm->context)) {
+	if (CTX_NEVER_WAS_VALID(mm->context))
+		return;
+
+	{
 		u32 ctx = CTX_HWBITS(mm->context);
 		int cpu = smp_processor_id();
 
@@ -686,7 +696,10 @@
 
 void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page)
 {
-	if (CTX_VALID(mm->context)) {
+	if (CTX_NEVER_WAS_VALID(mm->context))
+		return;
+
+	{
 		u32 ctx = CTX_HWBITS(mm->context);
 		int cpu = smp_processor_id();
 
diff -urN linux-2.4.8-pre5/arch/sparc64/mm/extable.c linux/arch/sparc64/mm/extable.c
--- linux-2.4.8-pre5/arch/sparc64/mm/extable.c	Wed Nov 10 08:31:37 1999
+++ linux/arch/sparc64/mm/extable.c	Mon Dec  3 22:59:19 2001
@@ -43,27 +43,32 @@
         return 0;
 }
 
+extern spinlock_t modlist_lock;
+
 unsigned long
 search_exception_table(unsigned long addr, unsigned long *g2)
 {
-	unsigned long ret;
+	unsigned long ret = 0, flags;
 
 #ifndef CONFIG_MODULES
 	/* There is only the kernel to search.  */
 	ret = search_one_table(__start___ex_table,
 			       __stop___ex_table-1, addr, g2);
-	if (ret) return ret;
+	return ret;
 #else
 	/* The kernel is the last "module" -- no need to treat it special.  */
 	struct module *mp;
+
+	spin_lock_irqsave(&modlist_lock, flags);
 	for (mp = module_list; mp != NULL; mp = mp->next) {
-		if (mp->ex_table_start == NULL)
+		if (mp->ex_table_start == NULL || !(mp->flags & (MOD_RUNNING | MOD_INITIALIZING)))
 			continue;
 		ret = search_one_table(mp->ex_table_start,
 				       mp->ex_table_end-1, addr, g2);
-		if (ret) return ret;
+		if (ret)
+			break;
 	}
+	spin_unlock_irqrestore(&modlist_lock, flags);
+	return ret;
 #endif
-
-	return 0;
 }
diff -urN linux-2.4.8-pre5/arch/sparc64/mm/init.c linux/arch/sparc64/mm/init.c
--- linux-2.4.8-pre5/arch/sparc64/mm/init.c	Wed May 16 10:20:11 2001
+++ linux/arch/sparc64/mm/init.c	Mon Dec  3 22:59:19 2001
@@ -1,4 +1,4 @@
-/*  $Id: init.c,v 1.176 2001/05/16 15:07:11 davem Exp $
+/*  $Id: init.c,v 1.178 2001/08/06 13:09:00 davem Exp $
  *  arch/sparc64/mm/init.c
  *
  *  Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu)
@@ -833,6 +833,7 @@
 }
 
 /* Caller does TLB context flushing on local CPU if necessary.
+ * The caller also ensures that CTX_VALID(mm->context) is false.
  *
  * We must be careful about boundary cases so that we never
  * let the user have CTX 0 (nucleus) or we ever use a CTX
@@ -845,12 +846,6 @@
 	
 	spin_lock(&ctx_alloc_lock);
 	ctx = CTX_HWBITS(tlb_context_cache + 1);
-	if (ctx == 0)
-		ctx = 1;
-	if (CTX_VALID(mm->context)) {
-		unsigned long nr = CTX_HWBITS(mm->context);
-		mmu_context_bmap[nr>>6] &= ~(1UL << (nr & 63));
-	}
 	new_ctx = find_next_zero_bit(mmu_context_bmap, 1UL << CTX_VERSION_SHIFT, ctx);
 	if (new_ctx >= (1UL << CTX_VERSION_SHIFT)) {
 		new_ctx = find_next_zero_bit(mmu_context_bmap, ctx, 1);
diff -urN linux-2.4.8-pre5/drivers/net/pci-skeleton.c linux/drivers/net/pci-skeleton.c
--- linux-2.4.8-pre5/drivers/net/pci-skeleton.c	Mon Jul  2 14:03:04 2001
+++ linux/drivers/net/pci-skeleton.c	Mon Dec  3 22:59:19 2001
@@ -94,6 +94,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/delay.h>
+#include <linux/ethtool.h>
 #include <linux/mii.h>
 #include <asm/io.h>
 
diff -urN linux-2.4.8-pre5/drivers/net/sk98lin/skge.c linux/drivers/net/sk98lin/skge.c
--- linux-2.4.8-pre5/drivers/net/sk98lin/skge.c	Mon Dec  3 22:59:10 2001
+++ linux/drivers/net/sk98lin/skge.c	Mon Dec  3 22:59:19 2001
@@ -368,7 +368,7 @@
 
 /* global variables *********************************************************/
 static const char *BootString = BOOT_STRING;
-static struct net_device *root_dev = NULL;
+struct net_device *sk98lin_root_dev = NULL;
 static int probed __initdata = 0;
 struct inode_operations SkInodeOps;
 //static struct file_operations SkFileOps;  /* with open/relase */
@@ -685,7 +685,7 @@
 static int __init skge_init_module(void)
 {
 	int cards;
-	root_dev = NULL;
+	sk98lin_root_dev = NULL;
 	
 	/* just to avoid warnings ... */
 	debug = 0;
@@ -717,12 +717,12 @@
 unsigned long Flags;
 SK_EVPARA EvPara;
 
-	while (root_dev) {
-		pNet = (DEV_NET*) root_dev->priv;
+	while (sk98lin_root_dev) {
+		pNet = (DEV_NET*) sk98lin_root_dev->priv;
 		pAC = pNet->pAC;
 		next = pAC->Next;
 
-		netif_stop_queue(root_dev);
+		netif_stop_queue(sk98lin_root_dev);
 		SkGeYellowLED(pAC, pAC->IoBase, 0);
 
 		if(pAC->BoardLevel == 2) {
@@ -754,17 +754,17 @@
 			kfree(pAC->dev[1]);
 		}
 
-		FreeResources(root_dev);
+		FreeResources(sk98lin_root_dev);
 
-		root_dev->get_stats = NULL;
+		sk98lin_root_dev->get_stats = NULL;
 		/* 
 		 * otherwise unregister_netdev calls get_stats with
 		 * invalid IO ...  :-(
 		 */
-		unregister_netdev(root_dev);
-		kfree(root_dev);
+		unregister_netdev(sk98lin_root_dev);
+		kfree(sk98lin_root_dev);
 		kfree(pAC);
-		root_dev = next;
+		sk98lin_root_dev = next;
 	}
 
 	/* clear proc-dir */
@@ -911,8 +911,8 @@
 	/*
 	 * Register the device here
 	 */
-	pAC->Next = root_dev;
-	root_dev = dev;
+	pAC->Next = sk98lin_root_dev;
+	sk98lin_root_dev = dev;
 
 	return (0);
 } /* SkGeBoardInit */
diff -urN linux-2.4.8-pre5/drivers/net/sk98lin/skproc.c linux/drivers/net/sk98lin/skproc.c
--- linux-2.4.8-pre5/drivers/net/sk98lin/skproc.c	Mon Dec  3 22:59:10 2001
+++ linux/drivers/net/sk98lin/skproc.c	Mon Dec  3 22:59:19 2001
@@ -65,7 +65,7 @@
 				void *data);
 
 static const char SK_Root_Dir_entry[] = "sk98lin";
-extern struct net_device *root_dev;
+extern struct net_device *sk98lin_root_dev;
 
 
 struct proc_dir_entry pSkRootDir = { 
@@ -106,7 +106,7 @@
 	unsigned long			Flags;		
 	unsigned int			Size;
 	struct net_device 		*next;
-	struct net_device 		*SkgeProcDev = root_dev;
+	struct net_device 		*SkgeProcDev = sk98lin_root_dev;
 
 	SK_PNMI_STRUCT_DATA 	*pPnmiStruct;
 	SK_PNMI_STAT		*pPnmiStat;
diff -urN linux-2.4.8-pre5/drivers/net/sungem.c linux/drivers/net/sungem.c
--- linux-2.4.8-pre5/drivers/net/sungem.c	Wed Jun 20 21:00:55 2001
+++ linux/drivers/net/sungem.c	Mon Dec  3 22:59:19 2001
@@ -1,4 +1,4 @@
-/* $Id: sungem.c,v 1.17 2001/06/17 09:22:46 jgarzik Exp $
+/* $Id: sungem.c,v 1.18 2001/08/06 13:34:47 davem Exp $
  * sungem.c: Sun GEM ethernet driver.
  *
  * Copyright (C) 2000, 2001 David S. Miller (davem@redhat.com)
@@ -1576,8 +1576,10 @@
 
 static int __devinit gem_get_device_address(struct gem *gp)
 {
+#if defined(__sparc__) || defined(__powerpc__)
 	struct net_device *dev = gp->dev;
 	struct pci_dev *pdev = gp->pdev;
+#endif
 
 #ifdef __sparc__
 	struct pcidev_cookie *pcp = pdev->sysdata;
diff -urN linux-2.4.8-pre5/drivers/net/sunhme.h linux/drivers/net/sunhme.h
--- linux-2.4.8-pre5/drivers/net/sunhme.h	Thu Apr 12 12:11:39 2001
+++ linux/drivers/net/sunhme.h	Mon Dec  3 22:59:19 2001
@@ -1,4 +1,4 @@
-/* $Id: sunhme.h,v 1.32 2000/12/13 18:31:47 davem Exp $
+/* $Id: sunhme.h,v 1.33 2001/08/03 06:23:04 davem Exp $
  * sunhme.h: Definitions for Sparc HME/BigMac 10/100baseT ethernet driver.
  *           Also known as the "Happy Meal".
  *
@@ -276,92 +276,10 @@
  * Debugging eeprom burnt code is more fun than programming this chip!
  */
 
-/* First, the DP83840 register numbers. */
-#define DP83840_BMCR            0x00        /* Basic mode control register */
-#define DP83840_BMSR            0x01        /* Basic mode status register  */
-#define DP83840_PHYSID1         0x02        /* PHYS ID 1                   */
-#define DP83840_PHYSID2         0x03        /* PHYS ID 2                   */
-#define DP83840_ADVERTISE       0x04        /* Advertisement control reg   */
-#define DP83840_LPA             0x05        /* Link partner ability reg    */
-#define DP83840_EXPANSION       0x06        /* Expansion register          */
-#define DP83840_DCOUNTER        0x12        /* Disconnect counter          */
-#define DP83840_FCSCOUNTER      0x13        /* False carrier counter       */
-#define DP83840_NWAYTEST        0x14        /* N-way auto-neg test reg     */
-#define DP83840_RERRCOUNTER     0x15        /* Receive error counter       */
-#define DP83840_SREVISION       0x16        /* Silicon revision            */
+/* Generic MII registers defined in linux/mii.h, these below
+ * are DP83840 specific.
+ */
 #define DP83840_CSCONFIG        0x17        /* CS configuration            */
-#define DP83840_LBRERROR        0x18        /* Lpback, rx, bypass error    */
-#define DP83840_PHYADDR         0x19        /* PHY address                 */
-#define DP83840_RESERVED        0x1a        /* Unused...                   */
-#define DP83840_TPISTATUS       0x1b        /* TPI status for 10mbps       */
-#define DP83840_NCONFIG         0x1c        /* Network interface config    */
-
-/* Basic mode control register. */
-#define BMCR_RESV               0x007f  /* Unused...                   */
-#define BMCR_CTST               0x0080  /* Collision test              */
-#define BMCR_FULLDPLX           0x0100  /* Full duplex                 */
-#define BMCR_ANRESTART          0x0200  /* Auto negotiation restart    */
-#define BMCR_ISOLATE            0x0400  /* Disconnect DP83840 from MII */
-#define BMCR_PDOWN              0x0800  /* Powerdown the DP83840       */
-#define BMCR_ANENABLE           0x1000  /* Enable auto negotiation     */
-#define BMCR_SPEED100           0x2000  /* Select 100Mbps              */
-#define BMCR_LOOPBACK           0x4000  /* TXD loopback bits           */
-#define BMCR_RESET              0x8000  /* Reset the DP83840           */
-
-/* Basic mode status register. */
-#define BMSR_ERCAP              0x0001  /* Ext-reg capability          */
-#define BMSR_JCD                0x0002  /* Jabber detected             */
-#define BMSR_LSTATUS            0x0004  /* Link status                 */
-#define BMSR_ANEGCAPABLE        0x0008  /* Able to do auto-negotiation */
-#define BMSR_RFAULT             0x0010  /* Remote fault detected       */
-#define BMSR_ANEGCOMPLETE       0x0020  /* Auto-negotiation complete   */
-#define BMSR_RESV               0x07c0  /* Unused...                   */
-#define BMSR_10HALF             0x0800  /* Can do 10mbps, half-duplex  */
-#define BMSR_10FULL             0x1000  /* Can do 10mbps, full-duplex  */
-#define BMSR_100HALF            0x2000  /* Can do 100mbps, half-duplex */
-#define BMSR_100FULL            0x4000  /* Can do 100mbps, full-duplex */
-#define BMSR_100BASE4           0x8000  /* Can do 100mbps, 4k packets  */
-
-/* Advertisement control register. */
-#define ADVERTISE_SLCT          0x001f  /* Selector bits               */
-#define ADVERTISE_CSMA          0x0001  /* Only selector supported     */
-#define ADVERTISE_10HALF        0x0020  /* Try for 10mbps half-duplex  */
-#define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
-#define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */
-#define ADVERTISE_100FULL       0x0100  /* Try for 100mbps full-duplex */
-#define ADVERTISE_100BASE4      0x0200  /* Try for 100mbps 4k packets  */
-#define ADVERTISE_RESV          0x1c00  /* Unused...                   */
-#define ADVERTISE_RFAULT        0x2000  /* Say we can detect faults    */
-#define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */
-#define ADVERTISE_NPAGE         0x8000  /* Next page bit               */
-
-#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
-                       ADVERTISE_100HALF | ADVERTISE_100FULL)
-
-/* Link partner ability register. */
-#define LPA_SLCT                0x001f  /* Same as advertise selector  */
-#define LPA_10HALF              0x0020  /* Can do 10mbps half-duplex   */
-#define LPA_10FULL              0x0040  /* Can do 10mbps full-duplex   */
-#define LPA_100HALF             0x0080  /* Can do 100mbps half-duplex  */
-#define LPA_100FULL             0x0100  /* Can do 100mbps full-duplex  */
-#define LPA_100BASE4            0x0200  /* Can do 100mbps 4k packets   */
-#define LPA_RESV                0x1c00  /* Unused...                   */
-#define LPA_RFAULT              0x2000  /* Link partner faulted        */
-#define LPA_LPACK               0x4000  /* Link partner acked us       */
-#define LPA_NPAGE               0x8000  /* Next page bit               */
-
-/* Expansion register for auto-negotiation. */
-#define EXPANSION_NWAY          0x0001  /* Can do N-way auto-nego      */
-#define EXPANSION_LCWP          0x0002  /* Got new RX page code word   */
-#define EXPANSION_ENABLENPAGE   0x0004  /* This enables npage words    */
-#define EXPANSION_NPCAPABLE     0x0008  /* Link partner supports npage */
-#define EXPANSION_MFAULTS       0x0010  /* Multiple faults detected    */
-#define EXPANSION_RESV          0xffe0  /* Unused...                   */
-
-/* N-way test register. */
-#define NWAYTEST_RESV1          0x00ff  /* Unused...                   */
-#define NWAYTEST_LOOPBACK       0x0100  /* Enable loopback for N-way   */
-#define NWAYTEST_RESV2          0xfe00  /* Unused...                   */
 
 /* The Carrier Sense config register. */
 #define CSCONFIG_RESV1          0x0001  /* Unused...                   */
@@ -378,41 +296,6 @@
 #define CSCONFIG_TCDISABLE      0x2000  /* Disable timeout counter     */
 #define CSCONFIG_RESV4          0x4000  /* Unused...                   */
 #define CSCONFIG_NDISABLE       0x8000  /* Disable NRZI                */
-
-/* Loopback, receive, bypass error register. */
-#define LBRERROR_EBUFFER        0x0001  /* Show elasticity buf errors  */
-#define LBRERROR_PACKET         0x0002  /* Show packet errors          */
-#define LBRERROR_LINK           0x0004  /* Show link errors            */
-#define LBRERROR_END            0x0008  /* Show premature end errors   */
-#define LBRERROR_CODE           0x0010  /* Show code errors            */
-#define LBRERROR_RESV1          0x00e0  /* Unused...                   */
-#define LBRERROR_LBACK          0x0300  /* Remote and twister loopback */
-#define LBRERROR_10TX           0x0400  /* Transceiver loopback 10mbps */
-#define LBRERROR_ENDEC          0x0800  /* ENDEC loopback 10mbps       */
-#define LBRERROR_ALIGN          0x1000  /* Bypass symbol alignment     */
-#define LBRERROR_SCRAMBLER      0x2000  /* Bypass (de)scrambler        */
-#define LBRERROR_ENCODER        0x4000  /* Bypass 4B5B/5B4B encoders   */
-#define LBRERROR_BEBUF          0x8000  /* Bypass elasticity buffers   */
-
-/* Physical address register. */
-#define PHYADDR_ADDRESS         0x001f  /* The address itself          */
-#define PHYADDR_DISCONNECT      0x0020  /* Disconnect status           */
-#define PHYADDR_10MBPS          0x0040  /* 1=10mbps, 0=100mbps         */
-#define PHYADDR_RESV            0xff80  /* Unused...                   */
-
-/* TPI status register for 10mbps. */
-#define TPISTATUS_RESV1         0x01ff  /* Unused...                   */
-#define TPISTATUS_SERIAL        0x0200  /* Enable 10mbps serial mode   */
-#define TPISTATUS_RESV2         0xfc00  /* Unused...                   */
-
-/* Network interface config register. */
-#define NCONFIG_JENABLE         0x0001  /* Jabber enable               */
-#define NCONFIG_RESV1           0x0002  /* Unused...                   */
-#define NCONFIG_SQUELCH         0x0004  /* Use low squelch             */
-#define NCONFIG_UTP             0x0008  /* 1=UTP, 0=STP                */
-#define NCONFIG_HBEAT           0x0010  /* Heart-beat enable           */
-#define NCONFIG_LDISABLE        0x0020  /* Disable the link            */
-#define NCONFIG_RESV2           0xffc0  /* Unused...                   */
 
 /* Happy Meal descriptor rings and such.
  * All descriptor rings must be aligned on a 2K boundry.
diff -urN linux-2.4.8-pre5/drivers/net/tulip/tulip_core.c linux/drivers/net/tulip/tulip_core.c
--- linux-2.4.8-pre5/drivers/net/tulip/tulip_core.c	Tue Jul 17 18:53:55 2001
+++ linux/drivers/net/tulip/tulip_core.c	Mon Dec  3 22:59:19 2001
@@ -1420,6 +1420,10 @@
 	if (chip_idx == LC82C168)
 		csr0 &= ~0xfff10000; /* zero reserved bits 31:20, 16 */
 
+	/* DM9102A has troubles with MRM, clear bit 24 too. */
+	if (pdev->vendor == 0x1282 && pdev->device == 0x9102)
+		csr0 &= ~0x01200000;
+
 	/*
 	 *	And back to business
 	 */
@@ -1762,9 +1766,9 @@
 		kfree (tp->mtable);
 #ifndef USE_IO_OPS
 	iounmap((void *)ioaddr);
-#endif
 
 err_out_free_res:
+#endif
 	pci_release_regions (pdev);
 
 err_out_free_netdev:
diff -urN linux-2.4.8-pre5/drivers/net/tun.c linux/drivers/net/tun.c
--- linux-2.4.8-pre5/drivers/net/tun.c	Mon Jun 11 19:15:27 2001
+++ linux/drivers/net/tun.c	Mon Dec  3 22:59:19 2001
@@ -218,7 +218,7 @@
 	if (tun->flags & TUN_NOCHECKSUM)
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
  
-	netif_rx(skb);
+	netif_rx_ni(skb);
    
 	tun->stats.rx_packets++;
 	tun->stats.rx_bytes += len;
diff -urN linux-2.4.8-pre5/drivers/video/aty/atyfb_base.c linux/drivers/video/aty/atyfb_base.c
--- linux-2.4.8-pre5/drivers/video/aty/atyfb_base.c	Mon Dec  3 22:59:11 2001
+++ linux/drivers/video/aty/atyfb_base.c	Mon Dec  3 22:59:20 2001
@@ -61,6 +61,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/vt_kern.h>
+#include <linux/kd.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
diff -urN linux-2.4.8-pre5/fs/buffer.c linux/fs/buffer.c
--- linux-2.4.8-pre5/fs/buffer.c	Mon Dec  3 22:59:11 2001
+++ linux/fs/buffer.c	Mon Dec  3 22:59:20 2001
@@ -219,9 +219,9 @@
 			continue;
 		if (test_and_set_bit(BH_Lock, &bh->b_state))
 			continue;
-		get_bh(bh);
 		if (atomic_set_buffer_clean(bh)) {
 			__refile_buffer(bh);
+			get_bh(bh);
 			array[count++] = bh;
 			if (count < NRSYNC)
 				continue;
@@ -231,7 +231,6 @@
 			return -EAGAIN;
 		}
 		unlock_buffer(bh);
-		put_bh(bh);
 	}
 	spin_unlock(&lru_list_lock);
 
@@ -251,13 +250,17 @@
 	run_task_queue(&tq_disk);
 }
 
-static int wait_for_locked_buffers(kdev_t dev, int index, int refile)
+/*
+ * Wait for a buffer on the proper list.
+ *
+ * This must be called with the LRU lock held, and
+ * will return with it released.
+ */
+static int wait_for_buffers(kdev_t dev, int index, int refile)
 {
 	struct buffer_head * next;
 	int nr;
 
-repeat:
-	spin_lock(&lru_list_lock);
 	next = lru_list[index];
 	nr = nr_buffers_type[index] * 2;
 	while (next && --nr >= 0) {
@@ -276,12 +279,26 @@
 		spin_unlock(&lru_list_lock);
 		wait_on_buffer (bh);
 		put_bh(bh);
-		goto repeat;
+		return -EAGAIN;
 	}
 	spin_unlock(&lru_list_lock);
 	return 0;
 }
 
+static inline void wait_for_some_buffers(kdev_t dev)
+{
+	spin_lock(&lru_list_lock);
+	wait_for_buffers(dev, BUF_LOCKED, 1);
+}
+
+static int wait_for_locked_buffers(kdev_t dev, int index, int refile)
+{
+	do {
+		spin_lock(&lru_list_lock);
+	} while (wait_for_buffers(dev, index, refile));
+	return 0;
+}
+
 /* Call sync_buffers with wait!=0 to ensure that the call does not
  * return until all buffer writes have completed.  Sync() may return
  * before the writes have finished; fsync() may not.
@@ -775,15 +792,16 @@
 /*
  * We used to try various strange things. Let's not.
  * We'll just try to balance dirty buffers, and possibly
- * launder some pages.
+ * launder some pages and do our best to make more memory
+ * available.
  */
 static void refill_freelist(int size)
 {
-	balance_dirty(NODEV);
-	if (free_shortage())
-		page_launder(GFP_NOFS, 0);
 	if (!grow_buffers(size)) {
+		balance_dirty(NODEV);
+		page_launder(GFP_NOFS, 0);		
 		wakeup_bdflush();
+		wakeup_kswapd();
 		current->policy |= SCHED_YIELD;
 		__set_current_state(TASK_RUNNING);
 		schedule();
@@ -1094,19 +1112,19 @@
 
 	if (state < 0)
 		return;
+
+	/* If we're getting into imbalance, start write-out */
+	spin_lock(&lru_list_lock);
+	write_some_buffers(dev);
 	wakeup_bdflush();
 
 	/*
-	 * If we're getting a lot out of balance, start some IO ourselves.
-	 *
-	 * This only queues it, and does not actually start it - we'll let
-	 * bdflush do that, or let it happen as a result of a lot of calls
-	 * to balance_dirty() filling up the request queues.
+	 * And if we're _really_ out of balance, wait for
+	 * some of the dirty/locked buffers ourselves.
+	 * This will throttle heavy writers.
 	 */
-	if (state > 0) {
-		spin_lock(&lru_list_lock);
-		write_some_buffers(dev);
-	}
+	if (state > 0)
+		wait_for_some_buffers(dev);
 }
 
 static __inline__ void __mark_dirty(struct buffer_head *bh)
@@ -2581,7 +2599,7 @@
 
 			spin_lock(&lru_list_lock);
 			bh = lru_list[BUF_DIRTY];
-			if (!time_before(jiffies, bh->b_flushtime))
+			if (bh && !time_before(jiffies, bh->b_flushtime))
 				continue;
 			spin_unlock(&lru_list_lock);
 		}
@@ -2682,7 +2700,7 @@
 
 		spin_lock(&lru_list_lock);
 		if (!write_some_buffers(NODEV) || balance_dirty_state(NODEV) < 0) {
-			run_task_queue(&tq_disk);
+			wait_for_some_buffers(NODEV);
 			interruptible_sleep_on(&bdflush_wait);
 		}
 	}
@@ -2713,6 +2731,8 @@
 	complete((struct completion *)startup);
 
 	for (;;) {
+		wait_for_some_buffers(NODEV);
+
 		/* update interval */
 		interval = bdf_prm.b_un.interval;
 		if (interval) {
diff -urN linux-2.4.8-pre5/include/asm-sparc/pgtable.h linux/include/asm-sparc/pgtable.h
--- linux-2.4.8-pre5/include/asm-sparc/pgtable.h	Thu Nov  9 15:57:41 2000
+++ linux/include/asm-sparc/pgtable.h	Mon Dec  3 22:59:20 2001
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.106 2000/11/08 04:49:24 davem Exp $ */
+/* $Id: pgtable.h,v 1.107 2001/08/06 13:16:37 davem Exp $ */
 #ifndef _SPARC_PGTABLE_H
 #define _SPARC_PGTABLE_H
 
@@ -27,6 +27,7 @@
 #ifndef __ASSEMBLY__
 
 extern void load_mmu(void);
+extern unsigned long calc_highpages(void);
 			       
 BTFIXUPDEF_CALL(void, quick_kernel_fault, unsigned long)
 
diff -urN linux-2.4.8-pre5/include/asm-sparc64/mmu_context.h linux/include/asm-sparc64/mmu_context.h
--- linux-2.4.8-pre5/include/asm-sparc64/mmu_context.h	Sun Mar 25 18:14:21 2001
+++ linux/include/asm-sparc64/mmu_context.h	Mon Dec  3 22:59:20 2001
@@ -1,4 +1,4 @@
-/* $Id: mmu_context.h,v 1.47 2001/03/22 07:26:04 davem Exp $ */
+/* $Id: mmu_context.h,v 1.48 2001/08/03 06:18:52 davem Exp $ */
 #ifndef __SPARC64_MMU_CONTEXT_H
 #define __SPARC64_MMU_CONTEXT_H
 
@@ -23,6 +23,7 @@
 #define CTX_FIRST_VERSION	((1UL << CTX_VERSION_SHIFT) + 1UL)
 #define CTX_VALID(__ctx)	\
 	 (!(((__ctx) ^ tlb_context_cache) & CTX_VERSION_MASK))
+#define CTX_NEVER_WAS_VALID(__ctx) ((__ctx) == 0UL)
 #define CTX_HWBITS(__ctx)	((__ctx) & ~CTX_VERSION_MASK)
 
 extern void get_new_mmu_context(struct mm_struct *mm);
diff -urN linux-2.4.8-pre5/include/linux/netdevice.h linux/include/linux/netdevice.h
--- linux-2.4.8-pre5/include/linux/netdevice.h	Mon Dec  3 22:59:11 2001
+++ linux/include/linux/netdevice.h	Mon Dec  3 22:59:20 2001
@@ -562,6 +562,17 @@
 
 extern int		netdev_nit;
 
+/* Post buffer to the network code from _non interrupt_ context.
+ * see net/core/dev.c for netif_rx description.
+ */
+static inline int netif_rx_ni(struct sk_buff *skb)
+{
+       int err = netif_rx(skb);
+       if (softirq_pending(smp_processor_id()))
+               do_softirq();
+       return err;
+}
+
 static inline void dev_init_buffers(struct net_device *dev)
 {
 	/* WILL BE REMOVED IN 2.5.0 */
diff -urN linux-2.4.8-pre5/include/net/addrconf.h linux/include/net/addrconf.h
--- linux-2.4.8-pre5/include/net/addrconf.h	Wed May 16 10:31:27 2001
+++ linux/include/net/addrconf.h	Mon Dec  3 22:59:20 2001
@@ -88,6 +88,10 @@
 extern void			addrconf_prefix_rcv(struct net_device *dev,
 						    u8 *opt, int len);
 
+/* Device notifier */
+extern int register_inet6addr_notifier(struct notifier_block *nb);
+extern int unregister_inet6addr_notifier(struct notifier_block *nb);
+
 static inline struct inet6_dev *
 __in6_dev_get(struct net_device *dev)
 {
diff -urN linux-2.4.8-pre5/mm/shmem.c linux/mm/shmem.c
--- linux-2.4.8-pre5/mm/shmem.c	Mon Dec  3 22:59:11 2001
+++ linux/mm/shmem.c	Mon Dec  3 22:59:20 2001
@@ -537,6 +537,30 @@
 	return inode;
 }
 
+static int shmem_set_size(struct shmem_sb_info *info,
+			  unsigned long max_blocks, unsigned long max_inodes)
+{
+	int error;
+	unsigned long blocks, inodes;
+
+	spin_lock(&info->stat_lock);
+	blocks = info->max_blocks - info->free_blocks;
+	inodes = info->max_inodes - info->free_inodes;
+	error = -EINVAL;
+	if (max_blocks < blocks)
+		goto out;
+	if (max_inodes < inodes)
+		goto out;
+	error = 0;
+	info->max_blocks  = max_blocks;
+	info->free_blocks = max_blocks - blocks;
+	info->max_inodes  = max_inodes;
+	info->free_inodes = max_inodes - inodes;
+out:
+	spin_unlock(&info->stat_lock);
+	return error;
+}
+
 #ifdef CONFIG_TMPFS
 static ssize_t
 shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
@@ -1001,30 +1025,6 @@
 			return 1;
 	}
 	return 0;
-}
-
-static int shmem_set_size(struct shmem_sb_info *info,
-			  unsigned long max_blocks, unsigned long max_inodes)
-{
-	int error;
-	unsigned long blocks, inodes;
-
-	spin_lock(&info->stat_lock);
-	blocks = info->max_blocks - info->free_blocks;
-	inodes = info->max_inodes - info->free_inodes;
-	error = -EINVAL;
-	if (max_blocks < blocks)
-		goto out;
-	if (max_inodes < inodes)
-		goto out;
-	error = 0;
-	info->max_blocks  = max_blocks;
-	info->free_blocks = max_blocks - blocks;
-	info->max_inodes  = max_inodes;
-	info->free_inodes = max_inodes - inodes;
-out:
-	spin_unlock(&info->stat_lock);
-	return error;
 }
 
 static int shmem_remount_fs (struct super_block *sb, int *flags, char *data)
diff -urN linux-2.4.8-pre5/net/core/skbuff.c linux/net/core/skbuff.c
--- linux-2.4.8-pre5/net/core/skbuff.c	Tue Jul 10 16:11:43 2001
+++ linux/net/core/skbuff.c	Mon Dec  3 22:59:20 2001
@@ -4,7 +4,7 @@
  *	Authors:	Alan Cox <iiitac@pyr.swan.ac.uk>
  *			Florian La Roche <rzsfl@rz.uni-sb.de>
  *
- *	Version:	$Id: skbuff.c,v 1.88 2001/07/09 23:19:14 davem Exp $
+ *	Version:	$Id: skbuff.c,v 1.89 2001/08/06 13:25:02 davem Exp $
  *
  *	Fixes:	
  *		Alan Cox	:	Fixed the worst of the load balancer bugs.
@@ -180,7 +180,7 @@
 	/* Get the HEAD */
 	skb = skb_head_from_pool();
 	if (skb == NULL) {
-		skb = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
+		skb = kmem_cache_alloc(skbuff_head_cache, gfp_mask & ~__GFP_DMA);
 		if (skb == NULL)
 			goto nohead;
 	}
diff -urN linux-2.4.8-pre5/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c
--- linux-2.4.8-pre5/net/ipv4/af_inet.c	Wed Jun 20 21:00:55 2001
+++ linux/net/ipv4/af_inet.c	Mon Dec  3 22:59:20 2001
@@ -5,7 +5,7 @@
  *
  *		PF_INET protocol family socket handler.
  *
- * Version:	$Id: af_inet.c,v 1.131 2001/06/13 16:25:03 davem Exp $
+ * Version:	$Id: af_inet.c,v 1.133 2001/08/06 13:21:16 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -117,8 +117,6 @@
 #include <linux/wireless.h>		/* Note : will define WIRELESS_EXT */
 #endif	/* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
 
-#define min(a,b)	((a)<(b)?(a):(b))
-
 struct linux_mib net_statistics[NR_CPUS*2];
 
 #ifdef INET_REFCNT_DEBUG
@@ -882,14 +880,15 @@
 			if (br_ioctl_hook != NULL)
 				return br_ioctl_hook(arg);
 #endif
+			return -ENOPKG;
+
 		case SIOCGIFDIVERT:
 		case SIOCSIFDIVERT:
 #ifdef CONFIG_NET_DIVERT
-			return(divert_ioctl(cmd, (struct divert_cf *) arg));
+			return divert_ioctl(cmd, (struct divert_cf *) arg);
 #else
 			return -ENOPKG;
 #endif	/* CONFIG_NET_DIVERT */
-			return -ENOPKG;
 			
 		case SIOCADDDLCI:
 		case SIOCDELDLCI:
diff -urN linux-2.4.8-pre5/net/ipv4/icmp.c linux/net/ipv4/icmp.c
--- linux-2.4.8-pre5/net/ipv4/icmp.c	Wed Jun 20 21:00:55 2001
+++ linux/net/ipv4/icmp.c	Mon Dec  3 22:59:20 2001
@@ -3,7 +3,7 @@
  *	
  *		Alan Cox, <alan@redhat.com>
  *
- *	Version: $Id: icmp.c,v 1.77 2001/06/14 13:40:46 davem Exp $
+ *	Version: $Id: icmp.c,v 1.79 2001/08/03 22:20:39 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *	modify it under the terms of the GNU General Public License
@@ -88,8 +88,6 @@
 #include <asm/uaccess.h>
 #include <net/checksum.h>
 
-#define min(a,b)	((a)<(b)?(a):(b))
-
 /*
  *	Build xmit assembly blocks
  */
@@ -240,12 +238,15 @@
 int xrlim_allow(struct dst_entry *dst, int timeout)
 {
 	unsigned long now;
+	static int burst = HZ;
 
 	now = jiffies;
 	dst->rate_tokens += now - dst->rate_last;
 	dst->rate_last = now;
-	if (dst->rate_tokens > XRLIM_BURST_FACTOR*timeout)
-		dst->rate_tokens = XRLIM_BURST_FACTOR*timeout;
+	if (burst < XRLIM_BURST_FACTOR*timeout)
+		burst = XRLIM_BURST_FACTOR*timeout;
+	if (dst->rate_tokens > burst)
+		dst->rate_tokens = burst;
 	if (dst->rate_tokens >= timeout) {
 		dst->rate_tokens -= timeout;
 		return 1;
@@ -635,8 +636,8 @@
 	read_lock(&raw_v4_lock);
 	if ((raw_sk = raw_v4_htable[hash]) != NULL) 
 	{
-		while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->saddr,
-						 iph->daddr, skb->dev->ifindex)) != NULL) {
+		while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->daddr,
+						 iph->saddr, skb->dev->ifindex)) != NULL) {
 			raw_err(raw_sk, skb, info);
 			raw_sk = raw_sk->next;
 			iph = (struct iphdr *)skb->data;
diff -urN linux-2.4.8-pre5/net/ipv4/ip_output.c linux/net/ipv4/ip_output.c
--- linux-2.4.8-pre5/net/ipv4/ip_output.c	Tue Jul 10 16:11:43 2001
+++ linux/net/ipv4/ip_output.c	Mon Dec  3 22:59:20 2001
@@ -5,7 +5,7 @@
  *
  *		The Internet Protocol (IP) output module.
  *
- * Version:	$Id: ip_output.c,v 1.94 2001/07/10 00:40:13 davem Exp $
+ * Version:	$Id: ip_output.c,v 1.96 2001/08/03 22:20:39 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -211,7 +211,8 @@
 	 *	Multicasts are looped back for other local users
 	 */
 
-	if (rt->rt_flags&RTCF_MULTICAST && (!sk || sk->protinfo.af_inet.mc_loop)) {
+	if (rt->rt_flags&RTCF_MULTICAST) {
+		if ((!sk || sk->protinfo.af_inet.mc_loop)
 #ifdef CONFIG_IP_MROUTE
 		/* Small optimization: do not loopback not local frames,
 		   which returned after forwarding; they will be  dropped
@@ -221,9 +222,9 @@
 
 		   This check is duplicated in ip_mr_input at the moment.
 		 */
-		if ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED))
+		    && ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED))
 #endif
-		{
+		) {
 			struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
 			if (newskb)
 				NF_HOOK(PF_INET, NF_IP_POST_ROUTING, newskb, NULL,
@@ -342,6 +343,13 @@
 	struct rtable *rt;
 	struct iphdr *iph;
 
+	/* Skip all of this if the packet is already routed,
+	 * f.e. by something like SCTP.
+	 */
+	rt = (struct rtable *) skb->dst;
+	if (rt != NULL)
+		goto packet_routed;
+
 	/* Make sure we can route this packet. */
 	rt = (struct rtable *)__sk_dst_check(sk, 0);
 	if (rt == NULL) {
@@ -365,6 +373,7 @@
 	}
 	skb->dst = dst_clone(&rt->u.dst);
 
+packet_routed:
 	if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
 		goto no_route;
 
diff -urN linux-2.4.8-pre5/net/ipv4/netfilter/ip_conntrack_core.c linux/net/ipv4/netfilter/ip_conntrack_core.c
--- linux-2.4.8-pre5/net/ipv4/netfilter/ip_conntrack_core.c	Fri Apr 27 14:15:01 2001
+++ linux/net/ipv4/netfilter/ip_conntrack_core.c	Mon Dec  3 22:59:20 2001
@@ -356,7 +356,7 @@
 	inner = (struct iphdr *)(hdr + 1);
 	datalen = skb->len - iph->ihl*4 - sizeof(*hdr);
 
-	if (skb->len < iph->ihl * 4 + sizeof(struct icmphdr)) {
+	if (skb->len < iph->ihl * 4 + sizeof(*hdr) + sizeof(*iph)) {
 		DEBUGP("icmp_error_track: too short\n");
 		return NULL;
 	}
diff -urN linux-2.4.8-pre5/net/ipv4/netfilter/ip_nat_proto_tcp.c linux/net/ipv4/netfilter/ip_nat_proto_tcp.c
--- linux-2.4.8-pre5/net/ipv4/netfilter/ip_nat_proto_tcp.c	Fri Mar 17 10:56:20 2000
+++ linux/net/ipv4/netfilter/ip_nat_proto_tcp.c	Mon Dec  3 22:59:20 2001
@@ -92,10 +92,17 @@
 		oldip = iph->daddr;
 		portptr = &hdr->dest;
 	}
-	hdr->check = ip_nat_cheat_check(~oldip, manip->ip,
+
+	/* this could be a inner header returned in icmp packet; in such
+	   cases we cannot update the checksum field since it is outside of
+	   the 8 bytes of transport layer headers we are guaranteed */
+	if(((void *)&hdr->check + sizeof(hdr->check) - (void *)iph) <= len) {
+		hdr->check = ip_nat_cheat_check(~oldip, manip->ip,
 					ip_nat_cheat_check(*portptr ^ 0xFFFF,
 							   manip->u.tcp.port,
 							   hdr->check));
+	}
+
 	*portptr = manip->u.tcp.port;
 }
 
diff -urN linux-2.4.8-pre5/net/ipv4/tcp_minisocks.c linux/net/ipv4/tcp_minisocks.c
--- linux-2.4.8-pre5/net/ipv4/tcp_minisocks.c	Thu Apr 12 12:11:39 2001
+++ linux/net/ipv4/tcp_minisocks.c	Mon Dec  3 22:59:20 2001
@@ -5,7 +5,7 @@
  *
  *		Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:	$Id: tcp_minisocks.c,v 1.9 2001/03/06 22:42:56 davem Exp $
+ * Version:	$Id: tcp_minisocks.c,v 1.11 2001/08/03 14:27:25 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -371,7 +371,7 @@
 		tw->family	= sk->family;
 		tw->reuse	= sk->reuse;
 		tw->rcv_wscale	= tp->rcv_wscale;
-		atomic_set(&tw->refcnt, 0);
+		atomic_set(&tw->refcnt, 1);
 
 		tw->hashent	= sk->hashent;
 		tw->rcv_nxt	= tp->rcv_nxt;
@@ -407,6 +407,7 @@
 		}
 
 		tcp_tw_schedule(tw, timeo);
+		tcp_tw_put(tw);
 	} else {
 		/* Sorry, if we're out of memory, just CLOSE this
 		 * socket up.  We've got bigger problems than
diff -urN linux-2.4.8-pre5/net/ipv6/addrconf.c linux/net/ipv6/addrconf.c
--- linux-2.4.8-pre5/net/ipv6/addrconf.c	Wed Jun 20 21:00:55 2001
+++ linux/net/ipv6/addrconf.c	Mon Dec  3 22:59:20 2001
@@ -6,7 +6,7 @@
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *	Alexey Kuznetsov	<kuznet@ms2.inr.ac.ru>
  *
- *	$Id: addrconf.c,v 1.66 2001/06/11 00:39:29 davem Exp $
+ *	$Id: addrconf.c,v 1.67 2001/08/03 09:32:17 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -45,6 +45,7 @@
 #include <linux/sysctl.h>
 #endif
 #include <linux/delay.h>
+#include <linux/notifier.h>
 
 #include <linux/proc_fs.h>
 #include <net/sock.h>
@@ -99,6 +100,8 @@
 static void addrconf_rs_timer(unsigned long data);
 static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
 
+static struct notifier_block *inet6addr_chain;
+
 struct ipv6_devconf ipv6_devconf =
 {
 	0,				/* forwarding		*/
@@ -392,6 +395,8 @@
 	write_unlock_bh(&idev->lock);
 	read_unlock(&addrconf_lock);
 
+	notifier_call_chain(&inet6addr_chain,NETDEV_UP,ifa);
+
 	return ifa;
 }
 
@@ -433,6 +438,7 @@
 
 	ipv6_ifa_notify(RTM_DELADDR, ifp);
 
+	notifier_call_chain(&inet6addr_chain,NETDEV_DOWN,ifp);
 
 	addrconf_del_timer(ifp);
 
@@ -1958,6 +1964,20 @@
 
 
 #endif
+
+/*
+ *      Device notifier
+ */
+
+int register_inet6addr_notifier(struct notifier_block *nb)
+{
+        return notifier_chain_register(&inet6addr_chain, nb);
+}
+
+int unregister_inet6addr_notifier(struct notifier_block *nb)
+{
+        return notifier_chain_unregister(&inet6addr_chain,nb);
+}
 
 /*
  *	Init / cleanup code
diff -urN linux-2.4.8-pre5/net/ipv6/netfilter/Makefile linux/net/ipv6/netfilter/Makefile
--- linux-2.4.8-pre5/net/ipv6/netfilter/Makefile	Thu Apr 19 14:10:22 2001
+++ linux/net/ipv6/netfilter/Makefile	Mon Dec  3 22:59:20 2001
@@ -9,7 +9,7 @@
 
 O_TARGET := netfilter.o
 
-export-objs :=
+export-objs := ip6_tables.o
 
 # Link order matters here.
 obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o
diff -urN linux-2.4.8-pre5/net/ipv6/netfilter/ip6_tables.c linux/net/ipv6/netfilter/ip6_tables.c
--- linux-2.4.8-pre5/net/ipv6/netfilter/ip6_tables.c	Tue May 15 01:29:35 2001
+++ linux/net/ipv6/netfilter/ip6_tables.c	Mon Dec  3 22:59:20 2001
@@ -1791,5 +1791,13 @@
 #endif
 }
 
+EXPORT_SYMBOL(ip6t_register_table);
+EXPORT_SYMBOL(ip6t_unregister_table);
+EXPORT_SYMBOL(ip6t_do_table);
+EXPORT_SYMBOL(ip6t_register_match);
+EXPORT_SYMBOL(ip6t_unregister_match);
+EXPORT_SYMBOL(ip6t_register_target);
+EXPORT_SYMBOL(ip6t_unregister_target);
+
 module_init(init);
 module_exit(fini);
diff -urN linux-2.4.8-pre5/net/netsyms.c linux/net/netsyms.c
--- linux-2.4.8-pre5/net/netsyms.c	Wed Jul 11 15:44:45 2001
+++ linux/net/netsyms.c	Mon Dec  3 22:59:20 2001
@@ -61,6 +61,7 @@
 #include <net/ipv6.h>
 #include <net/ndisc.h>
 #include <net/transp_v6.h>
+#include <net/addrconf.h>
 
 extern int sysctl_local_port_range[2];
 extern int tcp_port_rover;
@@ -280,6 +281,9 @@
 #ifdef CONFIG_IPV6
 EXPORT_SYMBOL(ipv6_addr_type);
 EXPORT_SYMBOL(icmpv6_send);
+EXPORT_SYMBOL(ndisc_mc_map);
+EXPORT_SYMBOL(register_inet6addr_notifier);
+EXPORT_SYMBOL(unregister_inet6addr_notifier);
 #endif
 #if defined (CONFIG_IPV6_MODULE) || defined (CONFIG_KHTTPD) || defined (CONFIG_KHTTPD_MODULE)
 /* inet functions common to v4 and v6 */
diff -urN linux-2.4.8-pre5/net/packet/af_packet.c linux/net/packet/af_packet.c
--- linux-2.4.8-pre5/net/packet/af_packet.c	Fri Jun 29 19:38:26 2001
+++ linux/net/packet/af_packet.c	Mon Dec  3 22:59:20 2001
@@ -5,7 +5,7 @@
  *
  *		PACKET - implements raw packet sockets.
  *
- * Version:	$Id: af_packet.c,v 1.55 2001/06/28 01:34:29 davem Exp $
+ * Version:	$Id: af_packet.c,v 1.56 2001/08/06 13:21:16 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -1488,14 +1488,15 @@
 				return br_ioctl_hook(arg);
 #endif
 #endif				
+			return -ENOPKG;
 
 		case SIOCGIFDIVERT:
 		case SIOCSIFDIVERT:
 #ifdef CONFIG_NET_DIVERT
-			return(divert_ioctl(cmd, (struct divert_cf *) arg));
-#endif /* CONFIG_NET_DIVERT */
-
+			return divert_ioctl(cmd, (struct divert_cf *) arg);
+#else
 			return -ENOPKG;
+#endif /* CONFIG_NET_DIVERT */
 			
 #ifdef CONFIG_INET
 		case SIOCADDRT:
diff -urN linux-2.4.8-pre5/net/sched/cls_route.c linux/net/sched/cls_route.c
--- linux-2.4.8-pre5/net/sched/cls_route.c	Wed Aug 18 11:38:49 1999
+++ linux/net/sched/cls_route.c	Mon Dec  3 22:59:20 2001
@@ -316,13 +316,14 @@
 {
 	struct route4_head *head = (struct route4_head*)tp->root;
 	struct route4_filter **fp, *f = (struct route4_filter*)arg;
-	unsigned h = f->handle;
+	unsigned h = 0;
 	struct route4_bucket *b;
 	int i;
 
 	if (!head || !f)
 		return -EINVAL;
 
+	h = f->handle;
 	b = f->bkt;
 
 	for (fp = &b->ht[from_hash(h>>16)]; *fp; fp = &(*fp)->next) {
diff -urN linux-2.4.8-pre5/net/sched/cls_u32.c linux/net/sched/cls_u32.c
--- linux-2.4.8-pre5/net/sched/cls_u32.c	Mon Jan 22 13:30:21 2001
+++ linux/net/sched/cls_u32.c	Mon Dec  3 22:59:20 2001
@@ -162,7 +162,7 @@
 		if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT)))
 			goto next_ht;
 
-		if (n->sel.flags&(TC_U32_EAT|TC_U32_VAROFFSET)) {
+		if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) {
 			off2 = n->sel.off + 3;
 			if (n->sel.flags&TC_U32_VAROFFSET)
 				off2 += ntohs(n->sel.offmask & *(u16*)(ptr+n->sel.offoff)) >>n->sel.offshift;
diff -urN linux-2.4.8-pre5/net/sched/sch_cbq.c linux/net/sched/sch_cbq.c
--- linux-2.4.8-pre5/net/sched/sch_cbq.c	Mon Jun 11 19:15:27 2001
+++ linux/net/sched/sch_cbq.c	Mon Dec  3 22:59:20 2001
@@ -1245,8 +1245,10 @@
 
 		cl = cl_head;
 		do {
-			if (cl->q->ops->drop && cl->q->ops->drop(cl->q))
+			if (cl->q->ops->drop && cl->q->ops->drop(cl->q)) {
+				sch->q.qlen--;
 				return 1;
+			}
 		} while ((cl = cl->next_alive) != cl_head);
 	}
 	return 0;
