## Automatically generated incremental diff
## From:   linux-2.5.69-bk12
## To:     linux-2.5.69-bk13
## Robot:  $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $

diff -urN linux-2.5.69-bk12/Makefile linux-2.5.69-bk13/Makefile
--- linux-2.5.69-bk12/Makefile	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/Makefile	2003-05-18 04:45:48.000000000 -0700
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 5
 SUBLEVEL = 69
-EXTRAVERSION = -bk12
+EXTRAVERSION = -bk13
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
diff -urN linux-2.5.69-bk12/crypto/autoload.c linux-2.5.69-bk13/crypto/autoload.c
--- linux-2.5.69-bk12/crypto/autoload.c	2003-05-04 16:53:12.000000000 -0700
+++ linux-2.5.69-bk13/crypto/autoload.c	2003-05-18 04:45:49.000000000 -0700
@@ -23,7 +23,7 @@
  */
 void crypto_alg_autoload(const char *name)
 {
-	request_module(name);
+	request_module("%s", name);
 }
 
 struct crypto_alg *crypto_alg_mod_lookup(const char *name)
diff -urN linux-2.5.69-bk12/crypto/deflate.c linux-2.5.69-bk13/crypto/deflate.c
--- linux-2.5.69-bk12/crypto/deflate.c	2003-05-04 16:53:42.000000000 -0700
+++ linux-2.5.69-bk13/crypto/deflate.c	2003-05-18 04:45:49.000000000 -0700
@@ -81,7 +81,7 @@
 		ret = -ENOMEM;
 		goto out;
 	}
-	memset(stream->workspace, 0, sizeof(stream->workspace));
+	memset(stream->workspace, 0, zlib_deflate_workspacesize());
 	ret = zlib_deflateInit2(stream, DEFLATE_DEF_LEVEL, Z_DEFLATED,
 	                        -DEFLATE_DEF_WINBITS, DEFLATE_DEF_MEMLEVEL,
 	                        Z_DEFAULT_STRATEGY);
@@ -108,7 +108,7 @@
 		ret = -ENOMEM;
 		goto out;
 	}
-	memset(stream->workspace, 0, sizeof(stream->workspace));
+	memset(stream->workspace, 0, zlib_inflate_workspacesize());
 	ret = zlib_inflateInit2(stream, -DEFLATE_DEF_WINBITS);
 	if (ret != Z_OK) {
 		ret = -EINVAL;
diff -urN linux-2.5.69-bk12/crypto/md4.c linux-2.5.69-bk13/crypto/md4.c
--- linux-2.5.69-bk12/crypto/md4.c	2003-05-04 16:53:31.000000000 -0700
+++ linux-2.5.69-bk13/crypto/md4.c	2003-05-18 04:45:49.000000000 -0700
@@ -215,7 +215,7 @@
 	md4_transform(mctx->hash, mctx->block);
 	cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(u32));
 	memcpy(out, mctx->hash, sizeof(mctx->hash));
-	memset(mctx, 0, sizeof(mctx));
+	memset(mctx, 0, sizeof(*mctx));
 }
 
 static struct crypto_alg alg = {
diff -urN linux-2.5.69-bk12/crypto/md5.c linux-2.5.69-bk13/crypto/md5.c
--- linux-2.5.69-bk12/crypto/md5.c	2003-05-04 16:53:14.000000000 -0700
+++ linux-2.5.69-bk13/crypto/md5.c	2003-05-18 04:45:49.000000000 -0700
@@ -210,7 +210,7 @@
 	md5_transform(mctx->hash, mctx->block);
 	cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(u32));
 	memcpy(out, mctx->hash, sizeof(mctx->hash));
-	memset(mctx, 0, sizeof(mctx));
+	memset(mctx, 0, sizeof(*mctx));
 }
 
 static struct crypto_alg alg = {
diff -urN linux-2.5.69-bk12/crypto/tcrypt.c linux-2.5.69-bk13/crypto/tcrypt.c
--- linux-2.5.69-bk12/crypto/tcrypt.c	2003-05-04 16:53:37.000000000 -0700
+++ linux-2.5.69-bk13/crypto/tcrypt.c	2003-05-18 04:45:49.000000000 -0700
@@ -113,7 +113,7 @@
 	printk("\ntesting md5 across pages\n");
 
 	/* setup the dummy buffer first */
-	memset(xbuf, 0, sizeof (xbuf));
+	memset(xbuf, 0, XBUFSIZE);
 	memcpy(&xbuf[IDX1], "abcdefghijklm", 13);
 	memcpy(&xbuf[IDX2], "nopqrstuvwxyz", 13);
 
@@ -188,7 +188,7 @@
 
 	printk("\ntesting hmac_md5 across pages\n");
 
-	memset(xbuf, 0, sizeof (xbuf));
+	memset(xbuf, 0, XBUFSIZE);
 
 	memcpy(&xbuf[IDX1], "what do ya want ", 16);
 	memcpy(&xbuf[IDX2], "for nothing?", 12);
@@ -267,7 +267,7 @@
 	printk("\ntesting hmac_sha1 across pages\n");
 
 	/* setup the dummy buffer first */
-	memset(xbuf, 0, sizeof (xbuf));
+	memset(xbuf, 0, XBUFSIZE);
 
 	memcpy(&xbuf[IDX1], "what do ya want ", 16);
 	memcpy(&xbuf[IDX2], "for nothing?", 12);
@@ -450,7 +450,7 @@
 	printk("\ntesting sha1 across pages\n");
 
 	/* setup the dummy buffer first */
-	memset(xbuf, 0, sizeof (xbuf));
+	memset(xbuf, 0, XBUFSIZE);
 	memcpy(&xbuf[IDX1], "abcdbcdecdefdefgefghfghighij", 28);
 	memcpy(&xbuf[IDX2], "hijkijkljklmklmnlmnomnopnopq", 28);
 
@@ -525,7 +525,7 @@
 	printk("\ntesting sha256 across pages\n");
 
 	/* setup the dummy buffer first */
-	memset(xbuf, 0, sizeof (xbuf));
+	memset(xbuf, 0, XBUFSIZE);
 	memcpy(&xbuf[IDX1], "abcdbcdecdefdefgefghfghighij", 28);
 	memcpy(&xbuf[IDX2], "hijkijkljklmklmnlmnomnopnopq", 28);
 
@@ -1027,7 +1027,7 @@
 	}
 
 	/* setup the dummy buffer first */
-	memset(xbuf, 0, sizeof (xbuf));
+	memset(xbuf, 0, XBUFSIZE);
 
 	xbuf[IDX1] = des_tv[i].plaintext[0];
 	xbuf[IDX2] = des_tv[i].plaintext[1];
diff -urN linux-2.5.69-bk12/drivers/atm/Kconfig linux-2.5.69-bk13/drivers/atm/Kconfig
--- linux-2.5.69-bk12/drivers/atm/Kconfig	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/atm/Kconfig	2003-05-18 04:45:49.000000000 -0700
@@ -7,14 +7,14 @@
 
 config ATM_TCP
 	tristate "ATM over TCP"
-	depends on INET
+	depends on INET && ATM
 	help
 	  ATM over TCP driver. Useful mainly for development and for
 	  experiments. If unsure, say N.
 
 config ATM_LANAI
 	tristate "Efficient Networks Speedstream 3010"
-	depends on PCI
+	depends on PCI && ATM
 	help
 	  Supports ATM cards based on the Efficient Networks "Lanai"
 	  chipset such as the Speedstream 3010 and the ENI-25p.  The
@@ -23,7 +23,7 @@
 
 config ATM_ENI
 	tristate "Efficient Networks ENI155P"
-	depends on PCI
+	depends on PCI && ATM
 	---help---
 	  Driver for the Efficient Networks ENI155p series and SMC ATM
 	  Power155 155 Mbps ATM adapters. Both, the versions with 512KB and
@@ -133,7 +133,7 @@
 
 config ATM_FIRESTREAM
 	tristate "Fujitsu FireStream (FS50/FS155) "
-	depends on PCI
+	depends on PCI && ATM
 	help
 	  Driver for the Fujitsu FireStream 155 (MB86697) and
 	  FireStream 50 (MB86695) ATM PCI chips.
@@ -145,7 +145,7 @@
 
 config ATM_ZATM
 	tristate "ZeitNet ZN1221/ZN1225"
-	depends on PCI
+	depends on PCI && ATM
 	help
 	  Driver for the ZeitNet ZN1221 (MMF) and ZN1225 (UTP-5) 155 Mbps ATM
 	  adapters.
@@ -182,7 +182,7 @@
 #   fi
 config ATM_NICSTAR
 	tristate "IDT 77201 (NICStAR) (ForeRunnerLE)"
-	depends on PCI
+	depends on PCI && ATM
 	help
 	  The NICStAR chipset family is used in a large number of ATM NICs for
 	  25 and for 155 Mbps, including IDT cards and the Fore ForeRunnerLE
@@ -217,7 +217,7 @@
 
 config ATM_IDT77252
 	tristate "IDT 77252 (NICStAR II)"
-	depends on PCI
+	depends on PCI && ATM
 	help
 	  Driver for the IDT 77252 ATM PCI chips.
 
@@ -253,7 +253,7 @@
 
 config ATM_AMBASSADOR
 	tristate "Madge Ambassador (Collage PCI 155 Server)"
-	depends on PCI
+	depends on PCI && ATM
 	help
 	  This is a driver for ATMizer based ATM card produced by Madge
 	  Networks Ltd. Say Y (or M to compile as a module named ambassador)
@@ -277,7 +277,7 @@
 
 config ATM_HORIZON
 	tristate "Madge Horizon [Ultra] (Collage PCI 25 and Collage PCI 155 Client)"
-	depends on PCI
+	depends on PCI && ATM
 	help
 	  This is a driver for the Horizon chipset ATM adapter cards once
 	  produced by Madge Networks Ltd. Say Y (or M to compile as a module
@@ -301,7 +301,7 @@
 
 config ATM_IA
 	tristate "Interphase ATM PCI x575/x525/x531"
-	depends on PCI
+	depends on PCI && ATM
 	---help---
 	  This is a driver for the Interphase (i)ChipSAR adapter cards
 	  which include a variety of variants in term of the size of the
@@ -334,7 +334,7 @@
 
 config ATM_FORE200E_MAYBE
 	tristate "FORE Systems 200E-series"
-	depends on PCI || SBUS
+	depends on (PCI || SBUS) && ATM
 	---help---
 	  This is a driver for the FORE Systems 200E-series ATM adapter
 	  cards. It simultaneously supports PCA-200E and SBA-200E models
diff -urN linux-2.5.69-bk12/drivers/atm/atmtcp.c linux-2.5.69-bk13/drivers/atm/atmtcp.c
--- linux-2.5.69-bk12/drivers/atm/atmtcp.c	2003-05-04 16:53:33.000000000 -0700
+++ linux-2.5.69-bk13/drivers/atm/atmtcp.c	2003-05-18 04:45:49.000000000 -0700
@@ -153,6 +153,7 @@
 
 static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
 {
+	unsigned long flags;
 	struct atm_cirange ci;
 	struct atm_vcc *vcc;
 
@@ -162,9 +163,14 @@
 	if (ci.vci_bits == ATM_CI_MAX) ci.vci_bits = MAX_VCI_BITS;
 	if (ci.vpi_bits > MAX_VPI_BITS || ci.vpi_bits < 0 ||
 	    ci.vci_bits > MAX_VCI_BITS || ci.vci_bits < 0) return -EINVAL;
+	spin_lock_irqsave(&dev->lock, flags);
 	for (vcc = dev->vccs; vcc; vcc = vcc->next)
 		if ((vcc->vpi >> ci.vpi_bits) ||
-		    (vcc->vci >> ci.vci_bits)) return -EBUSY;
+		    (vcc->vci >> ci.vci_bits)) {
+			spin_unlock_irqrestore(&dev->lock, flags);
+			return -EBUSY;
+		}
+	spin_unlock_irqrestore(&dev->lock, flags);
 	dev->ci_range = ci;
 	return 0;
 }
@@ -227,6 +233,7 @@
 
 static void atmtcp_c_close(struct atm_vcc *vcc)
 {
+	unsigned long flags;
 	struct atm_dev *atmtcp_dev;
 	struct atmtcp_dev_data *dev_data;
 	struct atm_vcc *walk;
@@ -239,13 +246,16 @@
 	kfree(dev_data);
 	shutdown_atm_dev(atmtcp_dev);
 	vcc->dev_data = NULL;
+	spin_lock_irqsave(&atmtcp_dev->lock, flags);
 	for (walk = atmtcp_dev->vccs; walk; walk = walk->next)
 		wake_up(&walk->sleep);
+	spin_unlock_irqrestore(&atmtcp_dev->lock, flags);
 }
 
 
 static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
 {
+	unsigned long flags;
 	struct atm_dev *dev;
 	struct atmtcp_hdr *hdr;
 	struct atm_vcc *out_vcc;
@@ -260,11 +270,13 @@
 		    (struct atmtcp_control *) skb->data);
 		goto done;
 	}
+	spin_lock_irqsave(&dev->lock, flags);
 	for (out_vcc = dev->vccs; out_vcc; out_vcc = out_vcc->next)
 		if (out_vcc->vpi == ntohs(hdr->vpi) &&
 		    out_vcc->vci == ntohs(hdr->vci) &&
 		    out_vcc->qos.rxtp.traffic_class != ATM_NONE)
 			break;
+	spin_unlock_irqrestore(&dev->lock, flags);
 	if (!out_vcc) {
 		atomic_inc(&vcc->stats->tx_err);
 		goto done;
@@ -318,6 +330,7 @@
 	.ops		= &atmtcp_c_dev_ops,
 	.type		= "atmtcp",
 	.number		= 999,
+	.lock		= SPIN_LOCK_UNLOCKED
 };
 
 
@@ -350,9 +363,12 @@
 	struct atm_dev *dev;
 
 	dev = NULL;
-	if (itf != -1) dev = atm_find_dev(itf);
+	if (itf != -1) dev = atm_dev_lookup(itf);
 	if (dev) {
-		if (dev->ops != &atmtcp_v_dev_ops) return -EMEDIUMTYPE;
+		if (dev->ops != &atmtcp_v_dev_ops) {
+			atm_dev_release(dev);
+			return -EMEDIUMTYPE;
+		}
 		if (PRIV(dev)->vcc) return -EBUSY;
 	}
 	else {
@@ -383,14 +399,18 @@
 	struct atm_dev *dev;
 	struct atmtcp_dev_data *dev_data;
 
-	dev = atm_find_dev(itf);
+	dev = atm_dev_lookup(itf);
 	if (!dev) return -ENODEV;
-	if (dev->ops != &atmtcp_v_dev_ops) return -EMEDIUMTYPE;
+	if (dev->ops != &atmtcp_v_dev_ops) {
+		atm_dev_release(dev);
+		return -EMEDIUMTYPE;
+	}
 	dev_data = PRIV(dev);
 	if (!dev_data->persist) return 0;
 	dev_data->persist = 0;
 	if (PRIV(dev)->vcc) return 0;
 	kfree(dev_data);
+	atm_dev_release(dev);
 	shutdown_atm_dev(dev);
 	return 0;
 }
diff -urN linux-2.5.69-bk12/drivers/atm/eni.c linux-2.5.69-bk13/drivers/atm/eni.c
--- linux-2.5.69-bk12/drivers/atm/eni.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/atm/eni.c	2003-05-18 04:45:49.000000000 -0700
@@ -1887,8 +1887,10 @@
 
 static int get_ci(struct atm_vcc *vcc,short *vpi,int *vci)
 {
+	unsigned long flags;
 	struct atm_vcc *walk;
 
+	spin_lock_irqsave(&vcc->dev->lock, flags);
 	if (*vpi == ATM_VPI_ANY) *vpi = 0;
 	if (*vci == ATM_VCI_ANY) {
 		for (*vci = ATM_NOT_RSV_VCI; *vci < NR_VCI; (*vci)++) {
@@ -1907,17 +1909,29 @@
 			}
 			break;
 		}
+		spin_unlock_irqrestore(&vcc->dev->lock, flags);
 		return *vci == NR_VCI ? -EADDRINUSE : 0;
 	}
-	if (*vci == ATM_VCI_UNSPEC) return 0;
+	if (*vci == ATM_VCI_UNSPEC) {
+		spin_unlock_irqrestore(&vcc->dev->lock, flags);
+		return 0;
+	}
 	if (vcc->qos.rxtp.traffic_class != ATM_NONE &&
-	    ENI_DEV(vcc->dev)->rx_map[*vci])
+	    ENI_DEV(vcc->dev)->rx_map[*vci]) {
+		spin_unlock_irqrestore(&vcc->dev->lock, flags);
 		return -EADDRINUSE;
-	if (vcc->qos.txtp.traffic_class == ATM_NONE) return 0;
+	}
+	if (vcc->qos.txtp.traffic_class == ATM_NONE) {
+		spin_unlock_irqrestore(&vcc->dev->lock, flags);
+		return 0;
+	}
 	for (walk = vcc->dev->vccs; walk; walk = walk->next)
 		if (test_bit(ATM_VF_ADDR,&walk->flags) && walk->vci == *vci &&
-		    walk->qos.txtp.traffic_class != ATM_NONE)
+		    walk->qos.txtp.traffic_class != ATM_NONE) {
+			spin_unlock_irqrestore(&vcc->dev->lock, flags);
 			return -EADDRINUSE;
+		}
+	spin_unlock_irqrestore(&vcc->dev->lock, flags);
 	return 0;
 }
 
@@ -2125,6 +2139,7 @@
 
 static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page)
 {
+	unsigned long flags;
 	static const char *signal[] = { "LOST","unknown","okay" };
 	struct eni_dev *eni_dev = ENI_DEV(dev);
 	struct atm_vcc *vcc;
@@ -2197,6 +2212,7 @@
 		return sprintf(page,"%10sbacklog %u packets\n","",
 		    skb_queue_len(&tx->backlog));
 	}
+	spin_lock_irqsave(&dev->lock, flags);
 	for (vcc = dev->vccs; vcc; vcc = vcc->next) {
 		struct eni_vcc *eni_vcc = ENI_VCC(vcc);
 		int length;
@@ -2215,8 +2231,10 @@
 			length += sprintf(page+length,"tx[%d], txing %d bytes",
 			    eni_vcc->tx->index,eni_vcc->txing);
 		page[length] = '\n';
+		spin_unlock_irqrestore(&dev->lock, flags);
 		return length+1;
 	}
+	spin_unlock_irqrestore(&dev->lock, flags);
 	for (i = 0; i < eni_dev->free_len; i++) {
 		struct eni_free *fe = eni_dev->free_list+i;
 		unsigned long offset;
diff -urN linux-2.5.69-bk12/drivers/atm/fore200e.c linux-2.5.69-bk13/drivers/atm/fore200e.c
--- linux-2.5.69-bk12/drivers/atm/fore200e.c	2003-05-04 16:53:57.000000000 -0700
+++ linux-2.5.69-bk13/drivers/atm/fore200e.c	2003-05-18 04:45:49.000000000 -0700
@@ -1074,13 +1074,16 @@
 static struct atm_vcc* 
 fore200e_find_vcc(struct fore200e* fore200e, struct rpd* rpd)
 {
+    unsigned long flags;
     struct atm_vcc* vcc;
 
+    spin_lock_irqsave(&fore200e->atm_dev->lock, flags);
     for (vcc = fore200e->atm_dev->vccs; vcc; vcc = vcc->next) {
 
 	if (vcc->vpi == rpd->atm_header.vpi && vcc->vci == rpd->atm_header.vci)
 	    break;
     }
+    spin_unlock_irqrestore(&fore200e->atm_dev->lock, flags);
     
     return vcc;
 }
@@ -1352,9 +1355,13 @@
 static int
 fore200e_walk_vccs(struct atm_vcc *vcc, short *vpi, int *vci)
 {
+    unsigned long flags;
     struct atm_vcc* walk;
 
     /* find a free VPI */
+
+    spin_lock_irqsave(&vcc->dev->lock, flags);
+
     if (*vpi == ATM_VPI_ANY) {
 
 	for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next) {
@@ -1378,6 +1385,8 @@
 	}
     }
 
+    spin_unlock_irqrestore(&vcc->dev->lock, flags);
+
     return 0;
 }
 
@@ -2638,6 +2647,7 @@
 static int
 fore200e_proc_read(struct atm_dev *dev,loff_t* pos,char* page)
 {
+    unsigned long flags;
     struct fore200e* fore200e  = FORE200E_DEV(dev);
     int              len, left = *pos;
 
@@ -2884,6 +2894,7 @@
 	len = sprintf(page,"\n"    
 		      " VCCs:\n  address\tVPI.VCI:AAL\t(min/max tx PDU size) (min/max rx PDU size)\n");
 	
+	spin_lock_irqsave(&fore200e->atm_dev->lock, flags);
 	for (vcc = fore200e->atm_dev->vccs; vcc; vcc = vcc->next) {
 
 	    fore200e_vcc = FORE200E_VCC(vcc);
@@ -2898,6 +2909,7 @@
 			   fore200e_vcc->rx_max_pdu
 		);
 	}
+	spin_unlock_irqrestore(&fore200e->atm_dev->lock, flags);
 
 	return len;
     }
diff -urN linux-2.5.69-bk12/drivers/atm/he.c linux-2.5.69-bk13/drivers/atm/he.c
--- linux-2.5.69-bk12/drivers/atm/he.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/atm/he.c	2003-05-18 04:45:49.000000000 -0700
@@ -345,6 +345,7 @@
 static __inline__ struct atm_vcc*
 he_find_vcc(struct he_dev *he_dev, unsigned cid)
 {
+	unsigned long flags;
 	struct atm_vcc *vcc;
 	short vpi;
 	int vci;
@@ -352,10 +353,15 @@
 	vpi = cid >> he_dev->vcibits;
 	vci = cid & ((1<<he_dev->vcibits)-1);
 
+	spin_lock_irqsave(&he_dev->atm_dev->lock, flags);
 	for (vcc = he_dev->atm_dev->vccs; vcc; vcc = vcc->next)
 		if (vcc->vci == vci && vcc->vpi == vpi
-			&& vcc->qos.rxtp.traffic_class != ATM_NONE) return vcc;
+			&& vcc->qos.rxtp.traffic_class != ATM_NONE) {
+				spin_unlock_irqrestore(&he_dev->atm_dev->lock, flags);
+				return vcc;
+			}
 
+	spin_unlock_irqrestore(&he_dev->atm_dev->lock, flags);
 	return NULL;
 }
 
diff -urN linux-2.5.69-bk12/drivers/atm/idt77252.c linux-2.5.69-bk13/drivers/atm/idt77252.c
--- linux-2.5.69-bk12/drivers/atm/idt77252.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/atm/idt77252.c	2003-05-18 04:45:50.000000000 -0700
@@ -2402,8 +2402,10 @@
 static int
 idt77252_find_vcc(struct atm_vcc *vcc, short *vpi, int *vci)
 {
+	unsigned long flags;
 	struct atm_vcc *walk;
 
+	spin_lock_irqsave(&vcc->dev->lock, flags);
 	if (*vpi == ATM_VPI_ANY) {
 		*vpi = 0;
 		walk = vcc->dev->vccs;
@@ -2430,6 +2432,7 @@
 		}
 	}
 
+	spin_unlock_irqrestore(&vcc->dev->lock, flags);
 	return 0;
 }
 
diff -urN linux-2.5.69-bk12/drivers/block/genhd.c linux-2.5.69-bk13/drivers/block/genhd.c
--- linux-2.5.69-bk12/drivers/block/genhd.c	2003-05-04 16:53:14.000000000 -0700
+++ linux-2.5.69-bk13/drivers/block/genhd.c	2003-05-18 04:45:50.000000000 -0700
@@ -367,9 +367,7 @@
 
 static struct gendisk *base_probe(dev_t dev, int *part, void *data)
 {
-	char name[30];
-	sprintf(name, "block-major-%d", MAJOR(dev));
-	request_module(name);
+	request_module("block-major-%d", MAJOR(dev));
 	return NULL;
 }
 
diff -urN linux-2.5.69-bk12/drivers/block/scsi_ioctl.c linux-2.5.69-bk13/drivers/block/scsi_ioctl.c
--- linux-2.5.69-bk12/drivers/block/scsi_ioctl.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/block/scsi_ioctl.c	2003-05-18 04:45:50.000000000 -0700
@@ -48,6 +48,7 @@
 static int blk_do_rq(request_queue_t *q, struct block_device *bdev, 
 		     struct request *rq)
 {
+	char sense[SCSI_SENSE_BUFFERSIZE];
 	DECLARE_COMPLETION(wait);
 	int err = 0;
 
@@ -59,6 +60,12 @@
 	 */
 	rq->ref_count++;
 
+	if (!rq->sense) {
+		memset(sense, 0, sizeof(sense));
+		rq->sense = sense;
+		rq->sense_len = 0;
+	}
+
 	rq->flags |= REQ_NOMERGE;
 	rq->waiting = &wait;
         drive_stat_acct(rq, rq->nr_sectors, 1);
diff -urN linux-2.5.69-bk12/drivers/char/misc.c linux-2.5.69-bk13/drivers/char/misc.c
--- linux-2.5.69-bk12/drivers/char/misc.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/char/misc.c	2003-05-18 04:45:50.000000000 -0700
@@ -114,10 +114,8 @@
 	if (c != &misc_list)
 		new_fops = fops_get(c->fops);
 	if (!new_fops) {
-		char modname[20];
 		up(&misc_sem);
-		sprintf(modname, "char-major-%d-%d", MISC_MAJOR, minor);
-		request_module(modname);
+		request_module("char-major-%d-%d", MISC_MAJOR, minor);
 		down(&misc_sem);
 		c = misc_list.next;
 		while ((c != &misc_list) && (c->minor != minor))
diff -urN linux-2.5.69-bk12/drivers/char/tty_io.c linux-2.5.69-bk13/drivers/char/tty_io.c
--- linux-2.5.69-bk12/drivers/char/tty_io.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/char/tty_io.c	2003-05-18 04:45:50.000000000 -0700
@@ -260,9 +260,7 @@
 	/* Eduardo Blanco <ejbs@cs.cs.com.uy> */
 	/* Cyrus Durgin <cider@speakeasy.org> */
 	if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED)) {
-		char modname [20];
-		sprintf(modname, "tty-ldisc-%d", ldisc);
-		request_module (modname);
+		request_module("tty-ldisc-%d", ldisc);
 	}
 	if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED))
 		return -EINVAL;
diff -urN linux-2.5.69-bk12/drivers/md/dm-target.c linux-2.5.69-bk13/drivers/md/dm-target.c
--- linux-2.5.69-bk12/drivers/md/dm-target.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/md/dm-target.c	2003-05-18 04:45:50.000000000 -0700
@@ -58,14 +58,7 @@
 
 static void load_module(const char *name)
 {
-	char module_name[DM_MOD_NAME_SIZE] = "dm-";
-
-	/* Length check for strcat() below */
-	if (strlen(name) > (DM_MOD_NAME_SIZE - 4))
-		return;
-
-	strcat(module_name, name);
-	request_module(module_name);
+	request_module("dm-%s", name);
 }
 
 struct target_type *dm_get_target_type(const char *name)
diff -urN linux-2.5.69-bk12/drivers/md/md.c linux-2.5.69-bk13/drivers/md/md.c
--- linux-2.5.69-bk12/drivers/md/md.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/md/md.c	2003-05-18 04:45:50.000000000 -0700
@@ -1564,9 +1564,7 @@
 #ifdef CONFIG_KMOD
 	if (!pers[pnum])
 	{
-		char module_name[80];
-		sprintf (module_name, "md-personality-%d", pnum);
-		request_module (module_name);
+		request_module("md-personality-%d", pnum);
 	}
 #endif
 
diff -urN linux-2.5.69-bk12/drivers/media/video/videodev.c linux-2.5.69-bk13/drivers/media/video/videodev.c
--- linux-2.5.69-bk12/drivers/media/video/videodev.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/media/video/videodev.c	2003-05-18 04:45:50.000000000 -0700
@@ -83,11 +83,8 @@
 	down(&videodev_lock);
 	vfl=video_device[minor];
 	if(vfl==NULL) {
-		char modname[20];
-
 		up(&videodev_lock);
-		sprintf (modname, "char-major-%d-%d", VIDEO_MAJOR, minor);
-		request_module(modname);
+		request_module("char-major-%d-%d", VIDEO_MAJOR, minor);
 		down(&videodev_lock);
 		vfl=video_device[minor];
 		if (vfl==NULL) {
diff -urN linux-2.5.69-bk12/drivers/mtd/chips/chipreg.c linux-2.5.69-bk13/drivers/mtd/chips/chipreg.c
--- linux-2.5.69-bk12/drivers/mtd/chips/chipreg.c	2003-05-04 16:53:12.000000000 -0700
+++ linux-2.5.69-bk13/drivers/mtd/chips/chipreg.c	2003-05-18 04:45:50.000000000 -0700
@@ -64,7 +64,7 @@
 
 	drv = get_mtd_chip_driver(name);
 
-	if (!drv && !request_module(name))
+	if (!drv && !request_module("%s", name))
 		drv = get_mtd_chip_driver(name);
 
 	if (!drv)
diff -urN linux-2.5.69-bk12/drivers/net/arcnet/arcnet.c linux-2.5.69-bk13/drivers/net/arcnet/arcnet.c
--- linux-2.5.69-bk12/drivers/net/arcnet/arcnet.c	2003-05-04 16:53:35.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/arcnet/arcnet.c	2003-05-18 04:45:50.000000000 -0700
@@ -340,7 +340,7 @@
 	dev->hard_header_len = sizeof(struct archdr);
 	dev->mtu = choose_mtu();
 
-	dev->addr_len = 1;
+	dev->addr_len = ARCNET_ALEN;
 	dev->tx_queue_len = 30;
 	dev->broadcast[0] = 0x00;	/* for us, broadcasts are address 0 */
 	dev->watchdog_timeo = TX_TIMEOUT;
diff -urN linux-2.5.69-bk12/drivers/net/arcnet/rfc1201.c linux-2.5.69-bk13/drivers/net/arcnet/rfc1201.c
--- linux-2.5.69-bk12/drivers/net/arcnet/rfc1201.c	2003-05-04 16:53:14.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/arcnet/rfc1201.c	2003-05-18 04:45:50.000000000 -0700
@@ -56,6 +56,7 @@
 void __init arcnet_rfc1201_init(void)
 {
 	arc_proto_map[ARC_P_IP]
+	    = arc_proto_map[ARC_P_IPV6]
 	    = arc_proto_map[ARC_P_ARP]
 	    = arc_proto_map[ARC_P_RARP]
 	    = arc_proto_map[ARC_P_IPX]
@@ -114,6 +115,8 @@
 	switch (soft->proto) {
 	case ARC_P_IP:
 		return htons(ETH_P_IP);
+	case ARC_P_IPV6:
+		return htons(ETH_P_IPV6);
 	case ARC_P_ARP:
 		return htons(ETH_P_ARP);
 	case ARC_P_RARP:
@@ -389,6 +392,9 @@
 	case ETH_P_IP:
 		soft->proto = ARC_P_IP;
 		break;
+	case ETH_P_IPV6:
+		soft->proto = ARC_P_IPV6;
+		break;
 	case ETH_P_ARP:
 		soft->proto = ARC_P_ARP;
 		break;
diff -urN linux-2.5.69-bk12/drivers/net/irda/sir_dongle.c linux-2.5.69-bk13/drivers/net/irda/sir_dongle.c
--- linux-2.5.69-bk12/drivers/net/irda/sir_dongle.c	2003-05-04 16:53:05.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/irda/sir_dongle.c	2003-05-18 04:45:50.000000000 -0700
@@ -66,10 +66,7 @@
 	int err = -EINVAL;
 
 #ifdef CONFIG_KMOD
-	char modname[30];
-
-	sprintf(modname, "irda-dongle-%d", type);
-	request_module(modname);
+	request_module("irda-dongle-%d", type);
 #endif
 
 	if (dev->dongle_drv != NULL)
diff -urN linux-2.5.69-bk12/drivers/net/ppp_generic.c linux-2.5.69-bk13/drivers/net/ppp_generic.c
--- linux-2.5.69-bk12/drivers/net/ppp_generic.c	2003-05-18 04:45:44.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/ppp_generic.c	2003-05-18 04:45:50.000000000 -0700
@@ -1948,9 +1948,6 @@
 	struct ppp_option_data data;
 	void *state, *ostate;
 	unsigned char ccp_option[CCP_MAX_OPTION_LENGTH];
-#ifdef CONFIG_KMOD
-	char modname[32];
-#endif
 
 	err = -EFAULT;
 	if (copy_from_user(&data, (void *) arg, sizeof(data))
@@ -1965,8 +1962,7 @@
 	cp = find_compressor(ccp_option[0]);
 #ifdef CONFIG_KMOD
 	if (cp == 0) {
-		sprintf(modname, "ppp-compress-%d", ccp_option[0]);
-		request_module(modname);
+		request_module("ppp-compress-%d", ccp_option[0]);
 		cp = find_compressor(ccp_option[0]);
 	}
 #endif /* CONFIG_KMOD */
diff -urN linux-2.5.69-bk12/drivers/net/sunhme.c linux-2.5.69-bk13/drivers/net/sunhme.c
--- linux-2.5.69-bk12/drivers/net/sunhme.c	2003-05-04 16:53:09.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/sunhme.c	2003-05-18 04:45:50.000000000 -0700
@@ -3092,8 +3092,12 @@
 
 #ifdef __sparc__
 	hp->hm_revision = prom_getintdefault(node, "hm-rev", 0xff);
-	if (hp->hm_revision == 0xff)
-		hp->hm_revision = 0xa0;
+	if (hp->hm_revision == 0xff) {
+		unsigned char prev;
+
+		pci_read_config_byte(pdev, PCI_REVISION_ID, &prev);
+		hp->hm_revision = 0xc0 | (prev & 0x0f);
+	}
 #else
 	/* works with this on non-sparc hosts */
 	hp->hm_revision = 0x20;
@@ -3102,7 +3106,7 @@
 	/* Now enable the feature flags we can. */
 	if (hp->hm_revision == 0x20 || hp->hm_revision == 0x21)
 		hp->happy_flags = HFLAG_20_21;
-	else if (hp->hm_revision != 0xa0)
+	else if (hp->hm_revision != 0xa0 && hp->hm_revision != 0xc0)
 		hp->happy_flags = HFLAG_NOT_A0;
 
 	if (qp != NULL)
diff -urN linux-2.5.69-bk12/drivers/net/wan/comx.c linux-2.5.69-bk13/drivers/net/wan/comx.c
--- linux-2.5.69-bk12/drivers/net/wan/comx.c	2003-05-04 16:53:14.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/comx.c	2003-05-18 04:45:50.000000000 -0700
@@ -613,7 +613,6 @@
 	char *page;
 	struct comx_hardware *hw = comx_channels;
 	struct comx_protocol *line = comx_lines;
-	char str[30];
 	int ret=0;
 
 	if (count > PAGE_SIZE) {
@@ -691,8 +690,7 @@
 		}
 #ifdef CONFIG_KMOD
 		if(!hw && comx_strcasecmp(HWNAME_NONE,page) != 0){
-			sprintf(str,"comx-hw-%s",page);
-			request_module(str);
+			request_module("comx-hw-%s",page);
 		}		
 		hw=comx_channels;
 		while (hw) {
@@ -734,8 +732,7 @@
 		}
 #ifdef CONFIG_KMOD
 		if(!line && comx_strcasecmp(PROTONAME_NONE, page) != 0) {
-			sprintf(str,"comx-proto-%s",page);
-			request_module(str);
+			request_module("comx-proto-%s",page);
 		}		
 		line=comx_lines;
 		while (line) {
diff -urN linux-2.5.69-bk12/drivers/net/wan/cycx_drv.c linux-2.5.69-bk13/drivers/net/wan/cycx_drv.c
--- linux-2.5.69-bk12/drivers/net/wan/cycx_drv.c	2003-05-04 16:53:32.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/cycx_drv.c	2003-05-18 04:45:50.000000000 -0700
@@ -6,7 +6,7 @@
 *
 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
 *
-* Copyright:	(c) 1998-2000 Arnaldo Carvalho de Melo
+* Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
 *
 * Based on sdladrv.c by Gene Kozin <genek@compuserve.com>
 *
@@ -66,15 +66,9 @@
 MODULE_DESCRIPTION("Cyclom 2x Sync Card Driver");
 MODULE_LICENSE("GPL");
 
-
-/* Function Prototypes */
-/* Module entry points. These are called by the OS and must be public. */
-int init_module(void);
-void cleanup_module(void);
-
 /* Hardware-specific functions */
-static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len);
-static void cycx_bootcfg(cycxhw_t *hw);
+static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len);
+static void cycx_bootcfg(struct cycx_hw *hw);
 
 static int reset_cyc2x(u32 addr);
 static int detect_cyc2x(u32 addr);
@@ -86,27 +80,19 @@
 
 #define wait_cyc(addr) cycx_exec(addr + CMD_OFFSET)
 
-#define cyc2x_readb(b) readb(b)
-#define cyc2x_readw(b) readw(b)
-#define cyc2x_writeb(b, addr) writeb(b, addr)
-#define cyc2x_writew(w, addr) writew(w, addr)
-#define cyc2x_memcpy_toio(addr, buf, len) memcpy_toio((addr), buf, len)
-#define cyc2x_memcpy_fromio(buf, addr, len) memcpy_fromio(buf, (addr), len)
-
 /* Global Data */
 
 /* private data */
 static char modname[] = "cycx_drv";
 static char fullname[] = "Cyclom 2X Support Module";
-static char copyright[] = "(c) 1998-2000 Arnaldo Carvalho de Melo "
+static char copyright[] = "(c) 1998-2003 Arnaldo Carvalho de Melo "
 			  "<acme@conectiva.com.br>";
 
 /* Hardware configuration options.
  * These are arrays of configuration options used by verification routines.
  * The first element of each array is its size (i.e. number of options).
  */
-static u32 cyc2x_dpmbase_options[] =
-{
+static u32 cyc2x_dpmbase_options[] = {
 	20,
 	0xA0000, 0xA4000, 0xA8000, 0xAC000, 0xB0000, 0xB4000, 0xB8000,
 	0xBC000, 0xC0000, 0xC4000, 0xC8000, 0xCC000, 0xD0000, 0xD4000,
@@ -149,7 +135,7 @@
  * Return:	0	ok.
  *		< 0	error */
 EXPORT_SYMBOL(cycx_setup);
-int cycx_setup(cycxhw_t *hw, void *cfm, u32 len)
+int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len)
 {
 	unsigned long dpmbase = hw->dpmbase;
 	int err;
@@ -158,7 +144,7 @@
 	if (!get_option_index(cycx_2x_irq_options, hw->irq)) {
 		printk(KERN_ERR "%s: IRQ %d is illegal!\n", modname, hw->irq);
 		return -EINVAL;
-	} 
+	}
 
 	/* Setup adapter dual-port memory window and test memory */
 	if (!hw->dpmbase) {
@@ -190,10 +176,10 @@
 		cycx_down(hw);         /* shutdown adapter */
 
 	return err;
-} 
+}
 
 EXPORT_SYMBOL(cycx_down);
-int cycx_down(cycxhw_t *hw)
+int cycx_down(struct cycx_hw *hw)
 {
 	iounmap((u32 *)hw->dpmbase);
 
@@ -202,16 +188,16 @@
 
 /* Enable interrupt generation.  */
 EXPORT_SYMBOL(cycx_inten);
-void cycx_inten(cycxhw_t *hw)
+void cycx_inten(struct cycx_hw *hw)
 {
-	cyc2x_writeb(0, hw->dpmbase);
+	writeb(0, hw->dpmbase);
 }
 
 /* Generate an interrupt to adapter's CPU. */
 EXPORT_SYMBOL(cycx_intr);
-void cycx_intr(cycxhw_t *hw)
+void cycx_intr(struct cycx_hw *hw)
 {
-	cyc2x_writew(0, hw->dpmbase + GEN_CYCX_INTR);
+	writew(0, hw->dpmbase + GEN_CYCX_INTR);
 }
 
 /* Execute Adapter Command.
@@ -223,9 +209,9 @@
 	u16 i = 0;
 	/* wait till addr content is zeroed */
 
-	while (cyc2x_readw(addr)) {
+	while (readw(addr)) {
 		udelay(1000);
-		
+
 		if (++i > 50)
 			return -1;
 	}
@@ -236,12 +222,12 @@
 /* Read absolute adapter memory.
  * Transfer data from adapter's memory to data buffer. */
 EXPORT_SYMBOL(cycx_peek);
-int cycx_peek(cycxhw_t *hw, u32 addr, void *buf, u32 len)
+int cycx_peek(struct cycx_hw *hw, u32 addr, void *buf, u32 len)
 {
 	if (len == 1)
-		*(u8*)buf = cyc2x_readb(hw->dpmbase + addr);
+		*(u8*)buf = readb(hw->dpmbase + addr);
 	else
-		cyc2x_memcpy_fromio(buf, hw->dpmbase + addr, len);
+		memcpy_fromio(buf, hw->dpmbase + addr, len);
 
 	return 0;
 }
@@ -249,12 +235,12 @@
 /* Write Absolute Adapter Memory.
  * Transfer data from data buffer to adapter's memory. */
 EXPORT_SYMBOL(cycx_poke);
-int cycx_poke(cycxhw_t *hw, u32 addr, void *buf, u32 len)
+int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len)
 {
 	if (len == 1)
-		cyc2x_writeb(*(u8*)buf, hw->dpmbase + addr);
+		writeb(*(u8*)buf, hw->dpmbase + addr);
 	else
-		cyc2x_memcpy_toio(hw->dpmbase + addr, buf, len);
+		memcpy_toio(hw->dpmbase + addr, buf, len);
 
 	return 0;
 }
@@ -269,10 +255,10 @@
 	int tries = 0;
 
 	for (; tries < 3 ; tries++) {
-		cyc2x_writew(TEST_PATTERN, addr + 0x10);
+		writew(TEST_PATTERN, addr + 0x10);
 
-		if (cyc2x_readw(addr + 0x10) == TEST_PATTERN)
-			if (cyc2x_readw(addr + 0x10) == TEST_PATTERN)
+		if (readw(addr + 0x10) == TEST_PATTERN)
+			if (readw(addr + 0x10) == TEST_PATTERN)
 				return 1;
 
 		delay_cycx(1);
@@ -289,7 +275,7 @@
 
 	for (i = 0 ; i < cnt ; i++) {
 /*		for (j = 0 ; j < 50 ; j++); Delay - FIXME busy waiting... */
-		cyc2x_writeb(*buffer++, pt_code++);
+		writeb(*buffer++, pt_code++);
 	}
 }
 
@@ -298,8 +284,8 @@
  * o wait for reset code to copy it to right portion of memory */
 static int buffer_load(u32 addr, u8 *buffer, u32 cnt)
 {
-	cyc2x_memcpy_toio(addr + DATA_OFFSET, buffer, cnt);
-	cyc2x_writew(GEN_BOOT_DAT, addr + CMD_OFFSET);
+	memcpy_toio(addr + DATA_OFFSET, buffer, cnt);
+	writew(GEN_BOOT_DAT, addr + CMD_OFFSET);
 
 	return wait_cyc(addr);
 }
@@ -308,30 +294,30 @@
 static void cycx_start(u32 addr)
 {
 	/* put in 0x30 offset the jump instruction to the code entry point */
-	cyc2x_writeb(0xea, addr + 0x30);
-	cyc2x_writeb(0x00, addr + 0x31);
-	cyc2x_writeb(0xc4, addr + 0x32);
-	cyc2x_writeb(0x00, addr + 0x33);
-	cyc2x_writeb(0x00, addr + 0x34);
+	writeb(0xea, addr + 0x30);
+	writeb(0x00, addr + 0x31);
+	writeb(0xc4, addr + 0x32);
+	writeb(0x00, addr + 0x33);
+	writeb(0x00, addr + 0x34);
 
 	/* cmd to start executing code */
-	cyc2x_writew(GEN_START, addr + CMD_OFFSET);
-}         
+	writew(GEN_START, addr + CMD_OFFSET);
+}
 
 /* Load and boot reset code. */
 static void cycx_reset_boot(u32 addr, u8 *code, u32 len)
 {
 	u32 pt_start = addr + START_OFFSET;
 
-        cyc2x_writeb(0xea, pt_start++); /* jmp to f000:3f00 */
-        cyc2x_writeb(0x00, pt_start++);
-        cyc2x_writeb(0xfc, pt_start++);
-        cyc2x_writeb(0x00, pt_start++);
-        cyc2x_writeb(0xf0, pt_start);
+	writeb(0xea, pt_start++); /* jmp to f000:3f00 */
+	writeb(0x00, pt_start++);
+	writeb(0xfc, pt_start++);
+	writeb(0x00, pt_start++);
+	writeb(0xf0, pt_start);
 	reset_load(addr, code, len);
 
 	/* 80186 was in hold, go */
-	cyc2x_writeb(0, addr + START_CPU);
+	writeb(0, addr + START_CPU);
 	delay_cycx(1);
 }
 
@@ -342,22 +328,22 @@
 	u32 i;
 
 	/* boot buffer lenght */
-	cyc2x_writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
-	cyc2x_writew(GEN_DEFPAR, pt_boot_cmd);
+	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
+	writew(GEN_DEFPAR, pt_boot_cmd);
 
 	if (wait_cyc(addr) < 0)
 		return -1;
 
-	cyc2x_writew(0, pt_boot_cmd + sizeof(u16));
-	cyc2x_writew(0x4000, pt_boot_cmd + 2 * sizeof(u16));
-	cyc2x_writew(GEN_SET_SEG, pt_boot_cmd);
+	writew(0, pt_boot_cmd + sizeof(u16));
+	writew(0x4000, pt_boot_cmd + 2 * sizeof(u16));
+	writew(GEN_SET_SEG, pt_boot_cmd);
 
 	if (wait_cyc(addr) < 0)
 		return -1;
 
 	for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ)
 		if (buffer_load(addr, code + i,
-				MIN(CFM_LOAD_BUFSZ, (len - i))) < 0) {
+				min_t(u32, CFM_LOAD_BUFSZ, (len - i))) < 0) {
 			printk(KERN_ERR "%s: Error !!\n", modname);
 			return -1;
 		}
@@ -373,21 +359,22 @@
 	u32 i;
 
 	/* boot buffer lenght */
-	cyc2x_writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
-	cyc2x_writew(GEN_DEFPAR, pt_boot_cmd);
+	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
+	writew(GEN_DEFPAR, pt_boot_cmd);
 
 	if (wait_cyc(addr) < 0)
 		return -1;
 
-	cyc2x_writew(0x0000, pt_boot_cmd + sizeof(u16));
-	cyc2x_writew(0xc400, pt_boot_cmd + 2 * sizeof(u16));
-	cyc2x_writew(GEN_SET_SEG, pt_boot_cmd);
+	writew(0x0000, pt_boot_cmd + sizeof(u16));
+	writew(0xc400, pt_boot_cmd + 2 * sizeof(u16));
+	writew(GEN_SET_SEG, pt_boot_cmd);
 
 	if (wait_cyc(addr) < 0)
 		return -1;
 
 	for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ)
-		if (buffer_load(addr, code + i,MIN(CFM_LOAD_BUFSZ,(len - i)))) {
+		if (buffer_load(addr, code + i,
+				min_t(u32, CFM_LOAD_BUFSZ, (len - i)))) {
 			printk(KERN_ERR "%s: Error !!\n", modname);
 			return -1;
 		}
@@ -395,13 +382,13 @@
 	return 0;
 }
 
-/* Load adapter from the memory image of the CYCX firmware module. 
+/* Load adapter from the memory image of the CYCX firmware module.
  * o verify firmware integrity and compatibility
  * o start adapter up */
-static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len)
+static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len)
 {
 	int i, j;
-	cycx_header_t *img_hdr;
+	struct cycx_fw_header *img_hdr;
 	u8 *reset_image,
 	   *data_image,
 	   *code_image;
@@ -430,37 +417,39 @@
 	}
 
 	/* Verify firmware module length and checksum */
-	cksum = checksum((u8*)&cfm->info, sizeof(cfm_info_t) +
-					      cfm->info.codesize);
+	cksum = checksum((u8*)&cfm->info, sizeof(struct cycx_fw_info) +
+					  cfm->info.codesize);
 /*
-        FIXME cfm->info.codesize is off by 2
-	if (((len - sizeof(cfm_t) - 1) != cfm->info.codesize) ||
+	FIXME cfm->info.codesize is off by 2
+	if (((len - sizeof(struct cycx_firmware) - 1) != cfm->info.codesize) ||
 */
 	if (cksum != cfm->checksum) {
 		printk(KERN_ERR "%s:%s: firmware corrupted!\n",
 				modname, __FUNCTION__);
 		printk(KERN_ERR " cdsize = 0x%x (expected 0x%lx)\n",
-				len - sizeof(cfm_t) - 1, cfm->info.codesize);
-                printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n",
+				len - sizeof(struct cycx_firmware) - 1,
+				cfm->info.codesize);
+		printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n",
 				cksum, cfm->checksum);
 		return -EINVAL;
 	}
 
 	/* If everything is ok, set reset, data and code pointers */
 
-	img_hdr = (cycx_header_t*)(((u8*)cfm) + sizeof(cfm_t) - 1);
+	img_hdr = (struct cycx_fw_header *)(((u8 *)cfm) +
+					    sizeof(struct cycx_firmware) - 1);
 #ifdef FIRMWARE_DEBUG
 	printk(KERN_INFO "%s:%s: image sizes\n", __FUNCTION__, modname);
 	printk(KERN_INFO " reset=%lu\n", img_hdr->reset_size);
 	printk(KERN_INFO "  data=%lu\n", img_hdr->data_size);
 	printk(KERN_INFO "  code=%lu\n", img_hdr->code_size);
 #endif
-	reset_image = ((u8 *)img_hdr) + sizeof(cycx_header_t);
+	reset_image = ((u8 *)img_hdr) + sizeof(struct cycx_fw_header);
 	data_image = reset_image + img_hdr->reset_size;
 	code_image = data_image + img_hdr->data_size;
 
 	/*---- Start load ----*/
-        /* Announce */
+	/* Announce */
 	printk(KERN_INFO "%s: loading firmware %s (ID=%u)...\n", modname,
 			 cfm->descr[0] ? cfm->descr : "unknown firmware",
 			 cfm->info.codeid);
@@ -474,13 +463,13 @@
 		}
 
 		/* Load reset.bin */
-                cycx_reset_boot(hw->dpmbase, reset_image, img_hdr->reset_size);
+		cycx_reset_boot(hw->dpmbase, reset_image, img_hdr->reset_size);
 		/* reset is waiting for boot */
-		cyc2x_writew(GEN_POWER_ON, pt_cycld);
+		writew(GEN_POWER_ON, pt_cycld);
 		delay_cycx(1);
 
 		for (j = 0 ; j < 3 ; j++)
-			if (!cyc2x_readw(pt_cycld))
+			if (!readw(pt_cycld))
 				goto reset_loaded;
 			else
 				delay_cycx(1);
@@ -514,7 +503,7 @@
 	printk(KERN_INFO "%s: firmware loaded!\n", modname);
 
 	/* enable interrupts */
-        cycx_inten(hw);
+	cycx_inten(hw);
 
 	return 0;
 }
@@ -525,10 +514,10 @@
    - As of now, only static buffers are available to the user.
      So, the bit VD_RXDIRC must be set in 'valid'. That means that user
      wants to use the static transmission and reception buffers. */
-static void cycx_bootcfg(cycxhw_t *hw)
+static void cycx_bootcfg(struct cycx_hw *hw)
 {
 	/* use fixed buffers */
-	cyc2x_writeb(FIXED_BUFFERS, hw->dpmbase + CONF_OFFSET); 
+	writeb(FIXED_BUFFERS, hw->dpmbase + CONF_OFFSET);
 }
 
 /* Detect Cyclom 2x adapter.
@@ -561,9 +550,9 @@
 /* Reset adapter's CPU. */
 static int reset_cyc2x(u32 addr)
 {
-	cyc2x_writeb(0, addr + RST_ENABLE);
+	writeb(0, addr + RST_ENABLE);
 	delay_cycx(2);
-	cyc2x_writeb(0, addr + RST_DISABLE);
+	writeb(0, addr + RST_DISABLE);
 	delay_cycx(2);
 
 	return memory_exists(addr);
@@ -573,7 +562,7 @@
 static void delay_cycx(int sec)
 {
 	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(sec*HZ);
+	schedule_timeout(sec * HZ);
 }
 
 /* Calculate 16-bit CRC using CCITT polynomial. */
diff -urN linux-2.5.69-bk12/drivers/net/wan/cycx_main.c linux-2.5.69-bk13/drivers/net/wan/cycx_main.c
--- linux-2.5.69-bk12/drivers/net/wan/cycx_main.c	2003-05-04 16:53:14.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/cycx_main.c	2003-05-18 04:45:50.000000000 -0700
@@ -3,7 +3,7 @@
 *
 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
 *
-* Copyright:	(c) 1998-2001 Arnaldo Carvalho de Melo
+* Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
 *
 * Based on sdlamain.c by Gene Kozin <genek@compuserve.com> &
 *			 Jaspreet Singh	<jaspreet@sangoma.com>
@@ -70,12 +70,12 @@
 /* Function Prototypes */
 
 /* WAN link driver entry points */
-static int setup (wan_device_t *wandev, wandev_conf_t *conf);
-static int shutdown (wan_device_t *wandev);
-static int ioctl (wan_device_t *wandev, unsigned cmd, unsigned long arg);
+static int setup(struct wan_device *wandev, wandev_conf_t *conf);
+static int shutdown(struct wan_device *wandev);
+static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg);
 
 /* Miscellaneous functions */
-static irqreturn_t cycx_isr (int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t cycx_isr(int irq, void *dev_id, struct pt_regs *regs);
 
 /* Global Data
  * Note: All data must be explicitly initialized!!!
@@ -87,7 +87,7 @@
 static char copyright[] = "(c) 1998-2001 Arnaldo Carvalho de Melo "
 			  "<acme@conectiva.com.br>";
 static int ncards = CONFIG_CYCLOMX_CARDS;
-static cycx_t *card_array;	/* adapter data space */
+static struct cycx_device *card_array;	/* adapter data space */
 
 /* Kernel Loadable Module Entry Points */
 
@@ -103,7 +103,7 @@
  *		< 0	error.
  * Context:	process
  */
-int __init cyclomx_init (void)
+int __init cyclomx_init(void)
 {
 	int cnt, err = -ENOMEM;
 
@@ -113,16 +113,16 @@
 	/* Verify number of cards and allocate adapter data space */
 	ncards = min_t(int, ncards, MAX_CARDS);
 	ncards = max_t(int, ncards, 1);
-	card_array = kmalloc(sizeof(cycx_t) * ncards, GFP_KERNEL);
+	card_array = kmalloc(sizeof(struct cycx_device) * ncards, GFP_KERNEL);
 	if (!card_array)
 		goto out;
 
-	memset(card_array, 0, sizeof(cycx_t) * ncards);
+	memset(card_array, 0, sizeof(struct cycx_device) * ncards);
 
 	/* Register adapters with WAN router */
 	for (cnt = 0; cnt < ncards; ++cnt) {
-		cycx_t *card = &card_array[cnt];
-		wan_device_t *wandev = &card->wandev;
+		struct cycx_device *card = &card_array[cnt];
+		struct wan_device *wandev = &card->wandev;
 
 		sprintf(card->devname, "%s%d", drvname, cnt + 1);
 		wandev->magic    = ROUTER_MAGIC;
@@ -156,12 +156,12 @@
  * o unregister all adapters from the WAN router
  * o release all remaining system resources
  */
-static void __exit cyclomx_cleanup (void)
+static void __exit cyclomx_cleanup(void)
 {
 	int i = 0;
 
 	for (; i < ncards; ++i) {
-		cycx_t *card = &card_array[i];
+		struct cycx_device *card = &card_array[i];
 		unregister_wan_device(card->devname);
 	}
 
@@ -181,14 +181,14 @@
  * configuration structure is in kernel memory (including extended data, if
  * any).
  */
-static int setup (wan_device_t *wandev, wandev_conf_t *conf)
+static int setup(struct wan_device *wandev, wandev_conf_t *conf)
 {
 	int err = -EFAULT;
-	cycx_t *card;
+	struct cycx_device *card;
 	int irq;
 
 	/* Sanity checks */
-	
+
 	if (!wandev || !wandev->private || !conf)
 		goto out;
 
@@ -220,7 +220,7 @@
 	}
 
 	/* Configure hardware, load firmware, etc. */
-	memset(&card->hw, 0, sizeof(cycxhw_t));
+	memset(&card->hw, 0, sizeof(card->hw));
 	card->hw.irq	 = irq;
 	card->hw.dpmbase = conf->maddr;
 	card->hw.dpmsize = CYCX_WINDOWSIZE;
@@ -243,14 +243,14 @@
 	/* Protocol-specific initialization */
 	switch (card->hw.fwid) {
 #ifdef CONFIG_CYCLOMX_X25
-		case CFID_X25_2X:
-			err = cyx_init(card, conf);
-			break;
+	case CFID_X25_2X:
+		err = cyx_init(card, conf);
+		break;
 #endif
-		default:
-			printk(KERN_ERR "%s: this firmware is not supported!\n",
-					wandev->name);
-			err = -EINVAL;
+	default:
+		printk(KERN_ERR "%s: this firmware is not supported!\n",
+				wandev->name);
+		err = -EINVAL;
 	}
 
 	if (err) {
@@ -266,17 +266,17 @@
 }
 
 /*
- * Shut down WAN link driver. 
+ * Shut down WAN link driver.
  * o shut down adapter hardware
  * o release system resources.
  *
  * This function is called by the router when device is being unregistered or
  * when it handles ROUTER_DOWN IOCTL.
  */
-static int shutdown (wan_device_t *wandev)
+static int shutdown(struct wan_device *wandev)
 {
 	int ret = -EFAULT;
-	cycx_t *card;
+	struct cycx_device *card;
 
 	/* sanity checks */
 	if (!wandev || !wandev->private)
@@ -296,7 +296,7 @@
 }
 
 /*
- * Driver I/O control. 
+ * Driver I/O control.
  * o verify arguments
  * o perform requested action
  *
@@ -305,7 +305,7 @@
  *
  * no reserved ioctls for the cyclom 2x up to now
  */
-static int ioctl (wan_device_t *wandev, unsigned cmd, unsigned long arg)
+static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg)
 {
 	return -EINVAL;
 }
@@ -316,9 +316,9 @@
  * o acknowledge Cyclom 2X hardware interrupt.
  * o call protocol-specific interrupt service routine, if any.
  */
-static irqreturn_t cycx_isr (int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t cycx_isr(int irq, void *dev_id, struct pt_regs *regs)
 {
-	cycx_t *card = (cycx_t *)dev_id;
+	struct cycx_device *card = (struct cycx_device *)dev_id;
 
 	if (!card || card->wandev.state == WAN_UNCONFIGURED)
 		goto out;
@@ -335,32 +335,8 @@
 out:	return IRQ_NONE;
 }
 
-/*
- * This routine is called by the protocol-specific modules when network
- * interface is being open.  The only reason we need this, is because we
- * have to call MOD_INC_USE_COUNT, but cannot include 'module.h' where it's
- * defined more than once into the same kernel module.
- */
-void cyclomx_mod_inc_use_count (cycx_t *card)
-{
-	++card->open_cnt;
-	MOD_INC_USE_COUNT;
-}
-
-/*
- * This routine is called by the protocol-specific modules when network
- * interface is being closed.  The only reason we need this, is because we
- * have to call MOD_DEC_USE_COUNT, but cannot include 'module.h' where it's
- * defined more than once into the same kernel module.
- */
-void cyclomx_mod_dec_use_count (cycx_t *card)
-{
-	--card->open_cnt;
-	MOD_DEC_USE_COUNT;
-}
-
 /* Set WAN device state.  */
-void cyclomx_set_state (cycx_t *card, int state)
+void cyclomx_set_state(struct cycx_device *card, int state)
 {
 	unsigned long flags;
 	char *string_state = NULL;
@@ -369,15 +345,13 @@
 
 	if (card->wandev.state != state) {
 		switch (state) {
-			case WAN_CONNECTED:
-				string_state = "connected!";
-				break;
-
-			case WAN_DISCONNECTED:
-				string_state = "disconnected!";
-				break;
+		case WAN_CONNECTED:
+			string_state = "connected!";
+			break;
+		case WAN_DISCONNECTED:
+			string_state = "disconnected!";
+			break;
 		}
-
 		printk(KERN_INFO "%s: link %s\n", card->devname, string_state);
 		card->wandev.state = state;
 	}
diff -urN linux-2.5.69-bk12/drivers/net/wan/cycx_x25.c linux-2.5.69-bk13/drivers/net/wan/cycx_x25.c
--- linux-2.5.69-bk12/drivers/net/wan/cycx_x25.c	2003-05-04 16:53:03.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/cycx_x25.c	2003-05-18 04:45:50.000000000 -0700
@@ -3,7 +3,7 @@
 *
 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
 *
-* Copyright:	(c) 1998-2001 Arnaldo Carvalho de Melo
+* Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
 *
 * Based on sdla_x25.c by Gene Kozin <genek@compuserve.com>
 *
@@ -79,14 +79,17 @@
 #define CYCLOMX_X25_DEBUG 1
 
 #include <linux/version.h>
-#include <linux/kernel.h>	/* printk(), and other useful stuff */
-#include <linux/stddef.h>	/* offsetof(), etc. */
 #include <linux/errno.h>	/* return codes */
+#include <linux/if_arp.h>       /* ARPHRD_HWX25 */
+#include <linux/kernel.h>	/* printk(), and other useful stuff */
+#include <linux/module.h>	/* SET_MODULE_OWNER */
 #include <linux/string.h>	/* inline memset(), etc. */
-#include <linux/slab.h>	/* kmalloc(), kfree() */
+#include <linux/slab.h>		/* kmalloc(), kfree() */
+#include <linux/stddef.h>	/* offsetof(), etc. */
 #include <linux/wanrouter.h>	/* WAN router definitions */
+
 #include <asm/byteorder.h>	/* htons(), etc. */
-#include <linux/if_arp.h>       /* ARPHRD_HWX25 */
+
 #include <linux/cyclomx.h>	/* Cyclom 2X common user API definitions */
 #include <linux/cycx_x25.h>	/* X.25 firmware API definitions */
 
@@ -97,7 +100,7 @@
 /* Data Structures */
 /* This is an extension of the 'struct net_device' we create for each network
    interface to keep the rest of X.25 channel-specific data. */
-typedef struct x25_channel {
+struct cycx_x25_channel {
 	/* This member must be first. */
 	struct net_device *slave;	/* WAN slave */
 
@@ -114,75 +117,80 @@
 	u8 drop_sequence;		/* mark sequence for dropping */
 	u32 idle_tmout;			/* sec, before disconnecting */
 	struct sk_buff *rx_skb;		/* receive socket buffer */
-	cycx_t *card;			/* -> owner */
+	struct cycx_device *card;	/* -> owner */
 	struct net_device_stats ifstats;/* interface statistics */
-} x25_channel_t;
+};
 
 /* Function Prototypes */
 /* WAN link driver entry points. These are called by the WAN router module. */
-static int update (wan_device_t *wandev),
-	   new_if (wan_device_t *wandev, struct net_device *dev,
-		   wanif_conf_t *conf),
-	   del_if (wan_device_t *wandev, struct net_device *dev);
+static int update(struct wan_device *wandev),
+	   new_if(struct wan_device *wandev, struct net_device *dev,
+		  wanif_conf_t *conf),
+	   del_if(struct wan_device *wandev, struct net_device *dev);
 
 /* Network device interface */
-static int if_init (struct net_device *dev),
-	   if_open (struct net_device *dev),
-	   if_close (struct net_device *dev),
-	   if_header (struct sk_buff *skb, struct net_device *dev,
-		      u16 type, void *daddr, void *saddr, unsigned len),
-	   if_rebuild_hdr (struct sk_buff *skb),
-	   if_send (struct sk_buff *skb, struct net_device *dev);
+static int if_init(struct net_device *dev),
+	   if_open(struct net_device *dev),
+	   if_close(struct net_device *dev),
+	   if_header(struct sk_buff *skb, struct net_device *dev,
+		     u16 type, void *daddr, void *saddr, unsigned len),
+	   if_rebuild_hdr(struct sk_buff *skb),
+	   if_send(struct sk_buff *skb, struct net_device *dev);
 
-static struct net_device_stats * if_stats (struct net_device *dev);
+static struct net_device_stats *if_stats(struct net_device *dev);
 
 /* Interrupt handlers */
-static void cyx_isr (cycx_t *card),
-	    tx_intr (cycx_t *card, TX25Cmd *cmd),
-	    rx_intr (cycx_t *card, TX25Cmd *cmd),
-	    log_intr (cycx_t *card, TX25Cmd *cmd),
-	    stat_intr (cycx_t *card, TX25Cmd *cmd),
-	    connect_confirm_intr (cycx_t *card, TX25Cmd *cmd),
-	    disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd),
-	    connect_intr (cycx_t *card, TX25Cmd *cmd),
-	    disconnect_intr (cycx_t *card, TX25Cmd *cmd),
-	    spur_intr (cycx_t *card, TX25Cmd *cmd);
+static void cyx_isr(struct cycx_device *card),
+	    tx_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
+	    rx_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
+	    log_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
+	    stat_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
+	    connect_confirm_intr(struct cycx_device *card,
+				 struct cycx_x25_cmd *cmd),
+	    disconnect_confirm_intr(struct cycx_device *card,
+				    struct cycx_x25_cmd *cmd),
+	    connect_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
+	    disconnect_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
+	    spur_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd);
 
 /* X.25 firmware interface functions */
-static int x25_configure (cycx_t *card, TX25Config *conf),
-	   x25_get_stats (cycx_t *card),
-	   x25_send (cycx_t *card, u8 link, u8 lcn, u8 bitm, int len,
-		     void *buf),
-	   x25_connect_response (cycx_t *card, x25_channel_t *chan),
-	   x25_disconnect_response (cycx_t *card, u8 link, u8 lcn);
+static int x25_configure(struct cycx_device *card,
+			 struct cycx_x25_config *conf),
+	   x25_get_stats(struct cycx_device *card),
+	   x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len,
+		    void *buf),
+	   x25_connect_response(struct cycx_device *card,
+				struct cycx_x25_channel *chan),
+	   x25_disconnect_response(struct cycx_device *card, u8 link, u8 lcn);
 
 /* channel functions */
-static int chan_connect (struct net_device *dev),
-    	   chan_send (struct net_device *dev, struct sk_buff *skb);
+static int chan_connect(struct net_device *dev),
+	   chan_send(struct net_device *dev, struct sk_buff *skb);
 
-static void chan_disconnect (struct net_device *dev),
+static void chan_disconnect(struct net_device *dev),
 	    chan_x25_send_event(struct net_device *dev, u8 event);
 
 /* Miscellaneous functions */
-static void set_chan_state (struct net_device *dev, u8 state),
-	    chan_timer (unsigned long d);
+static void set_chan_state(struct net_device *dev, u8 state),
+	    chan_timer(unsigned long d);
 
-static void nibble_to_byte (u8 *s, u8 *d, u8 len, u8 nibble),
-	    reset_timer (struct net_device *dev);
+static void nibble_to_byte(u8 *s, u8 *d, u8 len, u8 nibble),
+	    reset_timer(struct net_device *dev);
 
-static u8 bps_to_speed_code (u32 bps);
-static u8 log2 (u32 n);
+static u8 bps_to_speed_code(u32 bps);
+static u8 log2(u32 n);
 
-static unsigned dec_to_uint (u8 *str, int len);
+static unsigned dec_to_uint(u8 *str, int len);
 
-static struct net_device *get_dev_by_lcn (wan_device_t *wandev, s16 lcn);
-static struct net_device *get_dev_by_dte_addr (wan_device_t *wandev, char *dte);
+static struct net_device *get_dev_by_lcn(struct wan_device *wandev, s16 lcn);
+static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
+					      char *dte);
 
 #ifdef CYCLOMX_X25_DEBUG
 static void hex_dump(char *msg, unsigned char *p, int len);
-static void x25_dump_config(TX25Config *conf);
-static void x25_dump_stats(TX25Stats *stats);
-static void x25_dump_devs(wan_device_t *wandev);
+static void x25_dump_config(struct cycx_x25_config *conf);
+static void x25_dump_stats(struct cycx_x25_stats *stats);
+static void x25_dump_devs(struct wan_device *wandev);
 #else
 #define hex_dump(msg, p, len)
 #define x25_dump_config(conf)
@@ -200,9 +208,9 @@
  *
  * Return:	0	o.k.
  *		< 0	failure.  */
-int cyx_init (cycx_t *card, wandev_conf_t *conf)
+int cyx_init(struct cycx_device *card, wandev_conf_t *conf)
 {
-	TX25Config cfg;
+	struct cycx_x25_config cfg;
 
 	/* Verify configuration ID */
 	if (conf->config_id != WANCONFIG_X25) {
@@ -256,7 +264,7 @@
 		cfg.remaddr = 3; /* DTE */
 	}
 
-        if (conf->interface == WANOPT_RS232)
+	if (conf->interface == WANOPT_RS232)
 	        cfg.flags = 0;      /* FIXME just reset the 2nd bit */
 
 	if (conf->u.x25.hi_pvc) {
@@ -318,7 +326,7 @@
 
 /* WAN Device Driver Entry Points */
 /* Update device status & statistics. */
-static int update (wan_device_t *wandev)
+static int update(struct wan_device *wandev)
 {
 	/* sanity checks */
 	if (!wandev || !wandev->private)
@@ -342,23 +350,25 @@
  *
  * Return:	0	o.k.
  *		< 0	failure (channel will not be created) */
-static int new_if (wan_device_t *wandev, struct net_device *dev,
-		   wanif_conf_t *conf)
+static int new_if(struct wan_device *wandev, struct net_device *dev,
+		  wanif_conf_t *conf)
 {
-	cycx_t *card = wandev->private;
-	x25_channel_t *chan;
+	struct cycx_device *card = wandev->private;
+	struct cycx_x25_channel *chan;
 	int err = 0;
 
 	if (!conf->name[0] || strlen(conf->name) > WAN_IFNAME_SZ) {
-		printk(KERN_INFO "%s: invalid interface name!\n",card->devname);
+		printk(KERN_INFO "%s: invalid interface name!\n",
+		       card->devname);
 		return -EINVAL;
 	}
 
 	/* allocate and initialize private data */
-	if ((chan = kmalloc(sizeof(x25_channel_t), GFP_KERNEL)) == NULL)
+	chan = kmalloc(sizeof(struct cycx_x25_channel), GFP_KERNEL);
+	if (!chan)
 		return -ENOMEM;
 
-	memset(chan, 0, sizeof(x25_channel_t));
+	memset(chan, 0, sizeof(*chan));
 	strcpy(chan->name, conf->name);
 	chan->card = card;
 	chan->link = conf->port;
@@ -385,19 +395,19 @@
 				}
 			}
 
-                	strncpy(chan->local_addr, conf->local_addr,
+			strncpy(chan->local_addr, conf->local_addr,
 				WAN_ADDRESS_SZ);
 		}
 
-                chan->svc = 1;
-                strncpy(chan->addr, &conf->addr[1], WAN_ADDRESS_SZ);
+		chan->svc = 1;
+		strncpy(chan->addr, &conf->addr[1], WAN_ADDRESS_SZ);
 		init_timer(&chan->timer);
 		chan->timer.function = chan_timer;
 		chan->timer.data = (unsigned long)dev;
 
-                /* Set channel timeouts (default if not specified) */
-                chan->idle_tmout = conf->idle_timeout ? conf->idle_timeout : 90;
-        } else if (is_digit(conf->addr[0])) {	/* PVC */
+		/* Set channel timeouts (default if not specified) */
+		chan->idle_tmout = conf->idle_timeout ? conf->idle_timeout : 90;
+	} else if (is_digit(conf->addr[0])) {	/* PVC */
 		s16 lcn = dec_to_uint(conf->addr, 0);
 
 		if (lcn >= card->u.x.lo_pvc && lcn <= card->u.x.hi_pvc)
@@ -431,10 +441,10 @@
 }
 
 /* Delete logical channel. */
-static int del_if (wan_device_t *wandev, struct net_device *dev)
+static int del_if(struct wan_device *wandev, struct net_device *dev)
 {
 	if (dev->priv) {
-		x25_channel_t *chan = dev->priv;
+		struct cycx_x25_channel *chan = dev->priv;
 
 		if (chan->svc) {
 			if (chan->local_addr)
@@ -457,11 +467,11 @@
  * This routine is called only once for each interface, during Linux network
  * interface registration.  Returning anything but zero will fail interface
  * registration. */
-static int if_init (struct net_device *dev)
+static int if_init(struct net_device *dev)
 {
-	x25_channel_t *chan = dev->priv;
-	cycx_t *card = chan->card;
-	wan_device_t *wandev = &card->wandev;
+	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_device *card = chan->card;
+	struct wan_device *wandev = &card->wandev;
 
 	/* Initialize device driver entry points */
 	dev->open = if_open;
@@ -488,8 +498,9 @@
 	dev->mem_end = (unsigned long)(wandev->maddr + wandev->msize - 1);
 	dev->flags |= IFF_NOARP;
 
-        /* Set transmit buffer queue length */
-        dev->tx_queue_len = 10;
+	/* Set transmit buffer queue length */
+	dev->tx_queue_len = 10;
+	SET_MODULE_OWNER(dev);
 
 	/* Initialize socket buffers */
 	set_chan_state(dev, WAN_DISCONNECTED);
@@ -502,34 +513,26 @@
  * o if link is disconnected then initiate connection
  *
  * Return 0 if O.k. or errno.  */
-static int if_open (struct net_device *dev)
+static int if_open(struct net_device *dev)
 {
-	x25_channel_t *chan = dev->priv;
-	cycx_t *card = chan->card;
-
 	if (netif_running(dev))
-		return -EBUSY; /* only one open is allowed */ 
+		return -EBUSY; /* only one open is allowed */
 
 	netif_start_queue(dev);
-	cyclomx_mod_inc_use_count(card);
-
 	return 0;
 }
 
 /* Close network interface.
  * o reset flags.
  * o if there's no more open channels then disconnect physical link. */
-static int if_close (struct net_device *dev)
+static int if_close(struct net_device *dev)
 {
-	x25_channel_t *chan = dev->priv;
-	cycx_t *card = chan->card;
+	struct cycx_x25_channel *chan = dev->priv;
 
 	netif_stop_queue(dev);
-	
+
 	if (chan->state == WAN_CONNECTED || chan->state == WAN_CONNECTING)
 		chan_disconnect(dev);
-		
-	cyclomx_mod_dec_use_count(card);
 
 	return 0;
 }
@@ -542,7 +545,7 @@
  * set skb->protocol to 0 and discard packet later.
  *
  * Return:	media header length. */
-static int if_header (struct sk_buff *skb, struct net_device *dev,
+static int if_header(struct sk_buff *skb, struct net_device *dev,
 		      u16 type, void *daddr, void *saddr, unsigned len)
 {
 	skb->protocol = type;
@@ -553,7 +556,7 @@
 /* * Re-build media header.
  * Return:	1	physical address resolved.
  *		0	physical address not resolved */
-static int if_rebuild_hdr (struct sk_buff *skb)
+static int if_rebuild_hdr(struct sk_buff *skb)
 {
 	return 1;
 }
@@ -573,65 +576,65 @@
  *    bottom half" (with interrupts enabled).
  * 2. Setting tbusy flag will inhibit further transmit requests from the
  *    protocol stack and can be used for flow control with protocol layer. */
-static int if_send (struct sk_buff *skb, struct net_device *dev)
+static int if_send(struct sk_buff *skb, struct net_device *dev)
 {
-	x25_channel_t *chan = dev->priv;
-	cycx_t *card = chan->card;
+	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_device *card = chan->card;
 
 	if (!chan->svc)
 		chan->protocol = skb->protocol;
 
 	if (card->wandev.state != WAN_CONNECTED)
 		++chan->ifstats.tx_dropped;
-        else if (chan->svc && chan->protocol &&
+	else if (chan->svc && chan->protocol &&
 		 chan->protocol != skb->protocol) {
-                printk(KERN_INFO
-                        "%s: unsupported Ethertype 0x%04X on interface %s!\n",
-                        card->devname, skb->protocol, dev->name);
-                ++chan->ifstats.tx_errors;
-        } else if (chan->protocol == ETH_P_IP) {
+		printk(KERN_INFO
+		       "%s: unsupported Ethertype 0x%04X on interface %s!\n",
+		       card->devname, skb->protocol, dev->name);
+		++chan->ifstats.tx_errors;
+	} else if (chan->protocol == ETH_P_IP) {
 		switch (chan->state) {
-			case WAN_DISCONNECTED:
-				if (chan_connect(dev)) {
-					netif_stop_queue(dev);
-					return -EBUSY;
-				}
-				/* fall thru */
-			case WAN_CONNECTED:
-				reset_timer(dev);
-				dev->trans_start = jiffies;
+		case WAN_DISCONNECTED:
+			if (chan_connect(dev)) {
 				netif_stop_queue(dev);
+				return -EBUSY;
+			}
+			/* fall thru */
+		case WAN_CONNECTED:
+			reset_timer(dev);
+			dev->trans_start = jiffies;
+			netif_stop_queue(dev);
 
-				if (chan_send(dev, skb))
-					return -EBUSY;
+			if (chan_send(dev, skb))
+				return -EBUSY;
 
-				break;
-			default:
-				++chan->ifstats.tx_dropped;	
-				++card->wandev.stats.tx_dropped;
-		} 
+			break;
+		default:
+			++chan->ifstats.tx_dropped;
+			++card->wandev.stats.tx_dropped;
+	}
 	} else { /* chan->protocol == ETH_P_X25 */
 		switch (skb->data[0]) {
-			case 0: break;
-			case 1: /* Connect request */
-				chan_connect(dev);
-				goto free_packet;
-		        case 2: /* Disconnect request */
-				chan_disconnect(dev);
-				goto free_packet;
-		        default:
-				printk(KERN_INFO
-				       "%s: unknown %d x25-iface request on %s!\n",
-                       			card->devname, skb->data[0], dev->name);
-               			++chan->ifstats.tx_errors;
-				goto free_packet;
+		case 0: break;
+		case 1: /* Connect request */
+			chan_connect(dev);
+			goto free_packet;
+		case 2: /* Disconnect request */
+			chan_disconnect(dev);
+			goto free_packet;
+	        default:
+			printk(KERN_INFO
+			       "%s: unknown %d x25-iface request on %s!\n",
+			       card->devname, skb->data[0], dev->name);
+			++chan->ifstats.tx_errors;
+			goto free_packet;
 		}
 
 		skb_pull(skb, 1); /* Remove control byte */
 		reset_timer(dev);
 		dev->trans_start = jiffies;
 		netif_stop_queue(dev);
-		
+
 		if (chan_send(dev, skb)) {
 			/* prepare for future retransmissions */
 			skb_push(skb, 1);
@@ -647,18 +650,18 @@
 
 /* Get Ethernet-style interface statistics.
  * Return a pointer to struct net_device_stats */
-static struct net_device_stats *if_stats (struct net_device *dev)
+static struct net_device_stats *if_stats(struct net_device *dev)
 {
-        x25_channel_t *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->priv;
 
 	return chan ? &chan->ifstats : NULL;
 }
 
 /* Interrupt Handlers */
 /* X.25 Interrupt Service Routine. */
-static void cyx_isr (cycx_t *card)
+static void cyx_isr(struct cycx_device *card)
 {
-	TX25Cmd cmd;
+	struct cycx_x25_cmd cmd;
 	u16 z = 0;
 
 	card->in_isr = 1;
@@ -666,38 +669,38 @@
 	cycx_peek(&card->hw, X25_RXMBOX_OFFS, &cmd, sizeof(cmd));
 
 	switch (cmd.command) {
-		case X25_DATA_INDICATION:
-			rx_intr(card, &cmd);
-			break;
-		case X25_ACK_FROM_VC:
-			tx_intr(card, &cmd);
-			break;
-		case X25_LOG: 
-			log_intr(card, &cmd);
-			break;
-		case X25_STATISTIC: 
-			stat_intr(card, &cmd);
-			break;
-		case X25_CONNECT_CONFIRM:
-			connect_confirm_intr(card, &cmd);
-			break;
-		case X25_CONNECT_INDICATION:
-			connect_intr(card, &cmd);
-			break;
-		case X25_DISCONNECT_INDICATION:
-			disconnect_intr(card, &cmd);
-			break;
-		case X25_DISCONNECT_CONFIRM:
-			disconnect_confirm_intr(card, &cmd);
-			break;
-		case X25_LINE_ON:
-			cyclomx_set_state(card, WAN_CONNECTED);
-			break;
-		case X25_LINE_OFF:
-			cyclomx_set_state(card, WAN_DISCONNECTED);
-			break;
-		default: 
-			spur_intr(card, &cmd); /* unwanted interrupt */
+	case X25_DATA_INDICATION:
+		rx_intr(card, &cmd);
+		break;
+	case X25_ACK_FROM_VC:
+		tx_intr(card, &cmd);
+		break;
+	case X25_LOG:
+		log_intr(card, &cmd);
+		break;
+	case X25_STATISTIC:
+		stat_intr(card, &cmd);
+		break;
+	case X25_CONNECT_CONFIRM:
+		connect_confirm_intr(card, &cmd);
+		break;
+	case X25_CONNECT_INDICATION:
+		connect_intr(card, &cmd);
+		break;
+	case X25_DISCONNECT_INDICATION:
+		disconnect_intr(card, &cmd);
+		break;
+	case X25_DISCONNECT_CONFIRM:
+		disconnect_confirm_intr(card, &cmd);
+		break;
+	case X25_LINE_ON:
+		cyclomx_set_state(card, WAN_CONNECTED);
+		break;
+	case X25_LINE_OFF:
+		cyclomx_set_state(card, WAN_DISCONNECTED);
+		break;
+	default:
+		spur_intr(card, &cmd); /* unwanted interrupt */
 	}
 
 	cycx_poke(&card->hw, 0, &z, sizeof(z));
@@ -708,10 +711,10 @@
 /* Transmit interrupt handler.
  *	o Release socket buffer
  *	o Clear 'tbusy' flag */
-static void tx_intr (cycx_t *card, TX25Cmd *cmd)
+static void tx_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
 {
 	struct net_device *dev;
-	wan_device_t *wandev = &card->wandev;
+	struct wan_device *wandev = &card->wandev;
 	u8 lcn;
 
 	cycx_peek(&card->hw, cmd->buf, &lcn, sizeof(lcn));
@@ -730,7 +733,7 @@
  * RFC1356.
  * o map logical channel number to network interface.
  * o allocate socket buffer or append received packet to the existing one.
- * o if M-bit is reset (i.e. it's the last packet in a sequence) then 
+ * o if M-bit is reset (i.e. it's the last packet in a sequence) then
  *   decapsulate packet and pass socket buffer to the protocol stack.
  *
  * Notes:
@@ -739,11 +742,11 @@
  *    expected on this channel.
  * 2. If something goes wrong and X.25 packet has to be dropped (e.g. no
  *    socket buffers available) the whole packet sequence must be discarded. */
-static void rx_intr (cycx_t *card, TX25Cmd *cmd)
+static void rx_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
 {
-	wan_device_t *wandev = &card->wandev;
+	struct wan_device *wandev = &card->wandev;
 	struct net_device *dev;
-	x25_channel_t *chan;
+	struct cycx_x25_channel *chan;
 	struct sk_buff *skb;
 	u8 bitm, lcn;
 	int pktlen = cmd->len - 5;
@@ -785,7 +788,7 @@
 
 		if (chan->protocol == ETH_P_X25) /* X.25 socket layer control */
 			/* 0 = data packet (dev_alloc_skb zeroed skb->data) */
-			skb_put(skb, 1); 
+			skb_put(skb, 1);
 
 		skb->dev = dev;
 		skb->protocol = htons(chan->protocol);
@@ -823,11 +826,11 @@
 }
 
 /* Connect interrupt handler. */
-static void connect_intr (cycx_t *card, TX25Cmd *cmd)
+static void connect_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
 {
-	wan_device_t *wandev = &card->wandev;
+	struct wan_device *wandev = &card->wandev;
 	struct net_device *dev = NULL;
-	x25_channel_t *chan;
+	struct cycx_x25_channel *chan;
 	u8 d[32],
 	   loc[24],
 	   rem[24];
@@ -865,11 +868,12 @@
 }
 
 /* Connect confirm interrupt handler. */
-static void connect_confirm_intr (cycx_t *card, TX25Cmd *cmd)
+static void connect_confirm_intr(struct cycx_device *card,
+				 struct cycx_x25_cmd *cmd)
 {
-	wan_device_t *wandev = &card->wandev;
+	struct wan_device *wandev = &card->wandev;
 	struct net_device *dev;
-	x25_channel_t *chan;
+	struct cycx_x25_channel *chan;
 	u8 lcn, key;
 
 	cycx_peek(&card->hw, cmd->buf, &lcn, sizeof(lcn));
@@ -892,9 +896,10 @@
 }
 
 /* Disconnect confirm interrupt handler. */
-static void disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd)
+static void disconnect_confirm_intr(struct cycx_device *card,
+				    struct cycx_x25_cmd *cmd)
 {
-	wan_device_t *wandev = &card->wandev;
+	struct wan_device *wandev = &card->wandev;
 	struct net_device *dev;
 	u8 lcn;
 
@@ -912,9 +917,9 @@
 }
 
 /* disconnect interrupt handler. */
-static void disconnect_intr (cycx_t *card, TX25Cmd *cmd)
+static void disconnect_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
 {
-	wan_device_t *wandev = &card->wandev;
+	struct wan_device *wandev = &card->wandev;
 	struct net_device *dev;
 	u8 lcn;
 
@@ -922,7 +927,7 @@
 	dprintk(1, KERN_INFO "disconnect_intr:lcn=%d\n", lcn);
 
 	if ((dev = get_dev_by_lcn(wandev, lcn)) != NULL) {
-		x25_channel_t *chan = dev->priv;
+		struct cycx_x25_channel *chan = dev->priv;
 
 		x25_disconnect_response(card, chan->link, lcn);
 		set_chan_state(dev, WAN_DISCONNECTED);
@@ -931,7 +936,7 @@
 }
 
 /* LOG interrupt handler. */
-static void log_intr (cycx_t *card, TX25Cmd *cmd)
+static void log_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
 {
 #if CYCLOMX_X25_DEBUG
 	char bf[20];
@@ -959,7 +964,7 @@
 }
 
 /* STATISTIC interrupt handler. */
-static void stat_intr (cycx_t *card, TX25Cmd *cmd)
+static void stat_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
 {
 	cycx_peek(&card->hw, cmd->buf, &card->u.x.stats,
 		  sizeof(card->u.x.stats));
@@ -972,7 +977,7 @@
 /* Spurious interrupt handler.
  * o print a warning
  * If number of spurious interrupts exceeded some limit, then ??? */
-static void spur_intr (cycx_t *card, TX25Cmd *cmd)
+static void spur_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
 {
 	printk(KERN_INFO "%s: spurious interrupt (0x%X)!\n",
 			 card->devname, cmd->command);
@@ -997,10 +1002,10 @@
 
 /* Cyclom 2X Firmware-Specific Functions */
 /* Exec X.25 command. */
-static int x25_exec (cycx_t *card, int command, int link,
-		     void *d1, int len1, void *d2, int len2)
+static int x25_exec(struct cycx_device *card, int command, int link,
+		    void *d1, int len1, void *d2, int len2)
 {
-	TX25Cmd c;
+	struct cycx_x25_cmd c;
 	unsigned long flags;
 	u32 addr = 0x1200 + 0x2E0 * link + 0x1E2;
 	u8 retry = MAX_CMD_RETRY;
@@ -1045,14 +1050,14 @@
 }
 
 /* Configure adapter. */
-static int x25_configure (cycx_t *card, TX25Config *conf)
+static int x25_configure(struct cycx_device *card, struct cycx_x25_config *conf)
 {
 	struct {
 		u16 nlinks;
-		TX25Config conf[2];
+		struct cycx_x25_config conf[2];
 	} x25_cmd_conf;
 
-	memset (&x25_cmd_conf, 0, sizeof(x25_cmd_conf));
+	memset(&x25_cmd_conf, 0, sizeof(x25_cmd_conf));
 	x25_cmd_conf.nlinks = 2;
 	x25_cmd_conf.conf[0] = *conf;
 	/* FIXME: we need to find a way in the wanrouter framework
@@ -1074,7 +1079,7 @@
 }
 
 /* Get protocol statistics. */
-static int x25_get_stats (cycx_t *card)
+static int x25_get_stats(struct cycx_device *card)
 {
 	/* the firmware expects 20 in the size field!!!
 	   thanks to Daniela */
@@ -1110,27 +1115,27 @@
 /* return the number of nibbles */
 static int byte_to_nibble(u8 *s, u8 *d, char *nibble)
 {
-        int i = 0;
+	int i = 0;
 
-        if (*nibble && *s) {
-                d[i] |= *s++ - '0';
-                *nibble = 0;
-                ++i;
-        }
-
-        while (*s) {
-                d[i] = (*s - '0') << 4;
-                if (*(s + 1))
+	if (*nibble && *s) {
+		d[i] |= *s++ - '0';
+		*nibble = 0;
+		++i;
+	}
+
+	while (*s) {
+		d[i] = (*s - '0') << 4;
+		if (*(s + 1))
 			d[i] |= *(s + 1) - '0';
-                else {
-                        *nibble = 1;
-                        break;
-                }
-                ++i;
-                s += 2;
-        }
+		else {
+			*nibble = 1;
+			break;
+		}
+		++i;
+		s += 2;
+	}
 
-        return i;
+	return i;
 }
 
 static void nibble_to_byte(u8 *s, u8 *d, u8 len, u8 nibble)
@@ -1147,7 +1152,7 @@
 			*d++ = '0' + (*s & 0x0F);
 			--len;
 		} else break;
-		
+
 		++s;
 	}
 
@@ -1155,7 +1160,8 @@
 }
 
 /* Place X.25 call. */
-static int x25_place_call (cycx_t *card, x25_channel_t *chan)
+static int x25_place_call(struct cycx_device *card,
+			  struct cycx_x25_channel *chan)
 {
 	int err = 0,
 	    len;
@@ -1190,18 +1196,19 @@
 
 	d[5] = mylen << 4 | remotelen;
 	d[6 + len + 1] = 0xCC; /* TCP/IP over X.25, thanks to Daniela :) */
-	
+
 	if ((err = x25_exec(card, X25_CONNECT_REQUEST, chan->link,
 			    &d, 7 + len + 1, NULL, 0)) != 0)
 		clear_bit(--key, (void*)&card->u.x.connection_keys);
 	else
-                chan->lcn = -key;
+		chan->lcn = -key;
 
-        return err;
+	return err;
 }
 
 /* Place X.25 CONNECT RESPONSE. */
-static int x25_connect_response (cycx_t *card, x25_channel_t *chan)
+static int x25_connect_response(struct cycx_device *card,
+				struct cycx_x25_channel *chan)
 {
 	u8 d[8];
 
@@ -1215,7 +1222,7 @@
 }
 
 /* Place X.25 DISCONNECT RESPONSE.  */
-static int x25_disconnect_response (cycx_t *card, u8 link, u8 lcn)
+static int x25_disconnect_response(struct cycx_device *card, u8 link, u8 lcn)
 {
 	char d[5];
 
@@ -1228,7 +1235,8 @@
 }
 
 /* Clear X.25 call.  */
-static int x25_clear_call (cycx_t *card, u8 link, u8 lcn, u8 cause, u8 diagn)
+static int x25_clear_call(struct cycx_device *card, u8 link, u8 lcn, u8 cause,
+			  u8 diagn)
 {
 	u8 d[7];
 
@@ -1243,9 +1251,10 @@
 }
 
 /* Send X.25 data packet. */
-static int x25_send (cycx_t *card, u8 link, u8 lcn, u8 bitm, int len, void *buf)
+static int x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len,
+		    void *buf)
 {
-	u8 d[] = "?\xFF\x10??"; 
+	u8 d[] = "?\xFF\x10??";
 
 	d[0] = d[3] = lcn;
 	d[4] = bitm;
@@ -1255,29 +1264,30 @@
 
 /* Miscellaneous */
 /* Find network device by its channel number.  */
-static struct net_device *get_dev_by_lcn (wan_device_t *wandev, s16 lcn)
+static struct net_device *get_dev_by_lcn(struct wan_device *wandev, s16 lcn)
 {
 	struct net_device *dev = wandev->dev;
-	x25_channel_t *chan;
+	struct cycx_x25_channel *chan;
 
 	while (dev) {
-		chan = (x25_channel_t*)dev->priv;
+		chan = (struct cycx_x25_channel*)dev->priv;
 
 		if (chan->lcn == lcn)
 			break;
 		dev = chan->slave;
-	}	
+	}
 	return dev;
 }
 
 /* Find network device by its remote dte address. */
-static struct net_device *get_dev_by_dte_addr (wan_device_t *wandev, char *dte)
+static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
+					      char *dte)
 {
 	struct net_device *dev = wandev->dev;
-	x25_channel_t *chan;
+	struct cycx_x25_channel *chan;
 
 	while (dev) {
-		chan = (x25_channel_t*)dev->priv;
+		chan = (struct cycx_x25_channel*)dev->priv;
 
 		if (!strcmp(chan->addr, dte))
 			break;
@@ -1293,24 +1303,24 @@
  * Return:	0	connected
  *		>0	connection in progress
  *		<0	failure */
-static int chan_connect (struct net_device *dev)
+static int chan_connect(struct net_device *dev)
 {
-	x25_channel_t *chan = dev->priv;
-	cycx_t *card = chan->card;
+	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_device *card = chan->card;
 
 	if (chan->svc) {
-                if (!chan->addr[0])
+		if (!chan->addr[0])
 			return -EINVAL; /* no destination address */
 
-                dprintk(1, KERN_INFO "%s: placing X.25 call to %s...\n",
+		dprintk(1, KERN_INFO "%s: placing X.25 call to %s...\n",
 				  card->devname, chan->addr);
 
-                if (x25_place_call(card, chan))
+		if (x25_place_call(card, chan))
 			return -EIO;
 
-                set_chan_state(dev, WAN_CONNECTING);
-                return 1;
-        } else 
+		set_chan_state(dev, WAN_CONNECTING);
+		return 1;
+	} else
 		set_chan_state(dev, WAN_CONNECTED);
 
 	return 0;
@@ -1318,9 +1328,9 @@
 
 /* Disconnect logical channel.
  * o if SVC then clear X.25 call */
-static void chan_disconnect (struct net_device *dev)
+static void chan_disconnect(struct net_device *dev)
 {
-	x25_channel_t *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->priv;
 
 	if (chan->svc) {
 		x25_clear_call(chan->card, chan->link, chan->lcn, 0, 0);
@@ -1330,11 +1340,11 @@
 }
 
 /* Called by kernel timer */
-static void chan_timer (unsigned long d)
+static void chan_timer(unsigned long d)
 {
 	struct net_device *dev = (struct net_device *)d;
-	x25_channel_t *chan = dev->priv;
-	
+	struct cycx_x25_channel *chan = dev->priv;
+
 	if (chan->state == WAN_CONNECTED)
 		chan_disconnect(dev);
 	else
@@ -1343,10 +1353,10 @@
 }
 
 /* Set logical channel state. */
-static void set_chan_state (struct net_device *dev, u8 state)
+static void set_chan_state(struct net_device *dev, u8 state)
 {
-	x25_channel_t *chan = dev->priv;
-	cycx_t *card = chan->card;
+	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_device *card = chan->card;
 	unsigned long flags;
 	char *string_state = NULL;
 
@@ -1355,43 +1365,40 @@
 	if (chan->state != state) {
 		if (chan->svc && chan->state == WAN_CONNECTED)
 			del_timer(&chan->timer);
-	
+
 		switch (state) {
-			case WAN_CONNECTED:
-				string_state = "connected!";
-				*(u16*)dev->dev_addr = htons(chan->lcn);
-				netif_wake_queue(dev);
-				reset_timer(dev);
-
-				if (chan->protocol == ETH_P_X25)
-					chan_x25_send_event(dev, 1);
-
-				break;
-
-			case WAN_CONNECTING:
-				string_state = "connecting...";
-				break;
-
-			case WAN_DISCONNECTING:
-				string_state = "disconnecting...";
-				break;
-
-			case WAN_DISCONNECTED:
-				string_state = "disconnected!";
-				
-				if (chan->svc) {
-					*(unsigned short*)dev->dev_addr = 0;
-					chan->lcn = 0;
-                                }
+		case WAN_CONNECTED:
+			string_state = "connected!";
+			*(u16*)dev->dev_addr = htons(chan->lcn);
+			netif_wake_queue(dev);
+			reset_timer(dev);
+
+			if (chan->protocol == ETH_P_X25)
+				chan_x25_send_event(dev, 1);
+
+			break;
+		case WAN_CONNECTING:
+			string_state = "connecting...";
+			break;
+		case WAN_DISCONNECTING:
+			string_state = "disconnecting...";
+			break;
+		case WAN_DISCONNECTED:
+			string_state = "disconnected!";
+
+			if (chan->svc) {
+				*(unsigned short*)dev->dev_addr = 0;
+				chan->lcn = 0;
+			}
 
-				if (chan->protocol == ETH_P_X25)
-					chan_x25_send_event(dev, 2);
+			if (chan->protocol == ETH_P_X25)
+				chan_x25_send_event(dev, 2);
 
-				netif_wake_queue(dev);
-				break;
+			netif_wake_queue(dev);
+			break;
 		}
 
-		printk (KERN_INFO "%s: interface %s %s\n", card->devname,
+		printk(KERN_INFO "%s: interface %s %s\n", card->devname,
 				  dev->name, string_state);
 		chan->state = state;
 	}
@@ -1412,10 +1419,10 @@
  *    the packet into 'complete sequence' using M-bit.
  * 2. When transmission is complete, an event notification should be issued
  *    to the router.  */
-static int chan_send (struct net_device *dev, struct sk_buff *skb)
+static int chan_send(struct net_device *dev, struct sk_buff *skb)
 {
-	x25_channel_t *chan = dev->priv;
-	cycx_t *card = chan->card;
+	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_device *card = chan->card;
 	int bitm = 0;		/* final packet */
 	unsigned len = skb->len;
 
@@ -1426,7 +1433,7 @@
 
 	if (x25_send(card, chan->link, chan->lcn, bitm, len, skb->data))
 		return 1;
-		
+
 	if (bitm) {
 		skb_pull(skb, len);
 		return 1;
@@ -1442,28 +1449,28 @@
 
 static void chan_x25_send_event(struct net_device *dev, u8 event)
 {
-        struct sk_buff *skb;
-        unsigned char *ptr;
+	struct sk_buff *skb;
+	unsigned char *ptr;
 
-        if ((skb = dev_alloc_skb(1)) == NULL) {
-                printk(KERN_ERR "%s: out of memory\n", __FUNCTION__);
-                return;
-        }
-
-        ptr  = skb_put(skb, 1);
-        *ptr = event;
-
-        skb->dev = dev;
-        skb->protocol = htons(ETH_P_X25);
-        skb->mac.raw = skb->data;
-        skb->pkt_type = PACKET_HOST;
+	if ((skb = dev_alloc_skb(1)) == NULL) {
+		printk(KERN_ERR "%s: out of memory\n", __FUNCTION__);
+		return;
+	}
 
-        netif_rx(skb);
+	ptr  = skb_put(skb, 1);
+	*ptr = event;
+
+	skb->dev = dev;
+	skb->protocol = htons(ETH_P_X25);
+	skb->mac.raw = skb->data;
+	skb->pkt_type = PACKET_HOST;
+
+	netif_rx(skb);
 	dev->last_rx = jiffies;		/* timestamp */
 }
 
 /* Convert line speed in bps to a number used by cyclom 2x code. */
-static u8 bps_to_speed_code (u32 bps)
+static u8 bps_to_speed_code(u32 bps)
 {
 	u8 number = 0; /* defaults to the lowest (1200) speed ;> */
 
@@ -1480,24 +1487,24 @@
 }
 
 /* log base 2 */
-static u8 log2 (u32 n)
+static u8 log2(u32 n)
 {
-        u8 log = 0;
+	u8 log = 0;
 
-        if (!n)
+	if (!n)
 		return 0;
 
-        while (n > 1) {
-                n >>= 1;
-                ++log;
-        }
+	while (n > 1) {
+		n >>= 1;
+		++log;
+	}
 
-        return log;
+	return log;
 }
 
 /* Convert decimal string to unsigned integer.
  * If len != 0 then only 'len' characters of the string are converted. */
-static unsigned dec_to_uint (u8 *str, int len)
+static unsigned dec_to_uint(u8 *str, int len)
 {
 	unsigned val = 0;
 
@@ -1512,13 +1519,13 @@
 
 static void reset_timer(struct net_device *dev)
 {
-	x25_channel_t *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->priv;
 
 	if (chan->svc)
 		mod_timer(&chan->timer, jiffies+chan->idle_tmout*HZ);
 }
 #ifdef CYCLOMX_X25_DEBUG
-static void x25_dump_config(TX25Config *conf)
+static void x25_dump_config(struct cycx_x25_config *conf)
 {
 	printk(KERN_INFO "X.25 configuration\n");
 	printk(KERN_INFO "-----------------\n");
@@ -1540,7 +1547,7 @@
 	printk(KERN_INFO "flags=0x%x\n", conf->flags);
 }
 
-static void x25_dump_stats(TX25Stats *stats)
+static void x25_dump_stats(struct cycx_x25_stats *stats)
 {
 	printk(KERN_INFO "X.25 statistics\n");
 	printk(KERN_INFO "--------------\n");
@@ -1556,7 +1563,7 @@
 	printk(KERN_INFO "rx_aborts=%d\n", stats->rx_aborts);
 }
 
-static void x25_dump_devs(wan_device_t *wandev)
+static void x25_dump_devs(struct wan_device *wandev)
 {
 	struct net_device *dev = wandev->dev;
 
@@ -1565,7 +1572,7 @@
 	printk(KERN_INFO "---------------------------------------\n");
 
 	while(dev) {
-		x25_channel_t *chan = dev->priv;
+		struct cycx_x25_channel *chan = dev->priv;
 
 		printk(KERN_INFO "%-5.5s %-15.15s   %d     ETH_P_%s\n",
 				 chan->name, chan->addr, netif_queue_stopped(dev),
diff -urN linux-2.5.69-bk12/drivers/net/wan/sdla_chdlc.c linux-2.5.69-bk13/drivers/net/wan/sdla_chdlc.c
--- linux-2.5.69-bk12/drivers/net/wan/sdla_chdlc.c	2003-05-04 16:53:14.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/sdla_chdlc.c	2003-05-18 04:45:50.000000000 -0700
@@ -186,21 +186,22 @@
 
 /****** Function Prototypes *************************************************/
 /* WAN link driver entry points. These are called by the WAN router module. */
-static int update (wan_device_t* wandev);
-static int new_if (wan_device_t* wandev, netdevice_t* dev,
-	wanif_conf_t* conf);
+static int update(struct wan_device* wandev);
+static int new_if(struct wan_device* wandev, struct net_device* dev,
+		  wanif_conf_t* conf);
 
 /* Network device interface */
-static int if_init   (netdevice_t* dev);
-static int if_open   (netdevice_t* dev);
-static int if_close  (netdevice_t* dev);
-static int if_header (struct sk_buff* skb, netdevice_t* dev,
-	unsigned short type, void* daddr, void* saddr, unsigned len);
+static int if_init(struct net_device* dev);
+static int if_open(struct net_device* dev);
+static int if_close(struct net_device* dev);
+static int if_header(struct sk_buff* skb, struct net_device* dev,
+		     unsigned short type, void* daddr, void* saddr,
+		     unsigned len);
 
 static int if_rebuild_hdr (struct sk_buff *skb);
-static struct net_device_stats* if_stats (netdevice_t* dev);
+static struct net_device_stats* if_stats(struct net_device* dev);
   
-static int if_send (struct sk_buff* skb, netdevice_t* dev);
+static int if_send(struct sk_buff* skb, struct net_device* dev);
 
 /* CHDLC Firmware interface functions */
 static int chdlc_configure 	(sdla_t* card, void* data);
@@ -214,7 +215,7 @@
 
 
 static int chdlc_disable_comm_shutdown (sdla_t *card);
-static void if_tx_timeout (netdevice_t *dev);
+static void if_tx_timeout(struct net_device *dev);
 
 /* Miscellaneous CHDLC Functions */
 static int set_chdlc_config (sdla_t* card);
@@ -230,8 +231,8 @@
 static int config_chdlc (sdla_t *card);
 static void disable_comm (sdla_t *card);
 
-static void trigger_chdlc_poll (netdevice_t *);
-static void chdlc_poll (netdevice_t *);
+static void trigger_chdlc_poll(struct net_device *dev);
+static void chdlc_poll(struct net_device *dev);
 static void chdlc_poll_delay (unsigned long dev_ptr);
 
 
@@ -245,20 +246,20 @@
 static void timer_intr(sdla_t *);
 
 /* Bottom half handlers */
-static void chdlc_work (netdevice_t *);
-static int chdlc_work_cleanup (netdevice_t *);
-static int bh_enqueue (netdevice_t *, struct sk_buff *);
+static void chdlc_work(struct net_device *dev);
+static int chdlc_work_cleanup(struct net_device *dev);
+static int bh_enqueue(struct net_device *dev, struct sk_buff *skb);
 
 /* Miscellaneous functions */
-static int chk_bcast_mcast_addr(sdla_t* card, netdevice_t* dev,
+static int chk_bcast_mcast_addr(sdla_t* card, struct net_device* dev,
 				struct sk_buff *skb);
 static int reply_udp( unsigned char *data, unsigned int mbox_len );
 static int intr_test( sdla_t* card);
 static int udp_pkt_type( struct sk_buff *skb , sdla_t* card);
 static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
-                                struct sk_buff *skb, netdevice_t* dev,
+                                struct sk_buff *skb, struct net_device* dev,
                                 chdlc_private_area_t* chdlc_priv_area);
-static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev,  
+static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev,  
 				chdlc_private_area_t* chdlc_priv_area);
 static unsigned short calc_checksum (char *, int);
 static void s508_lock (sdla_t *card, unsigned long *smp_flags);
@@ -598,10 +599,10 @@
  * as to minimize the time that we are inside the interrupt handler.
  *
  */
-static int update (wan_device_t* wandev)
+static int update(struct wan_device* wandev)
 {
 	sdla_t* card = wandev->private;
- 	netdevice_t* dev;
+ 	struct net_device* dev;
         volatile chdlc_private_area_t* chdlc_priv_area;
         SHARED_MEMORY_INFO_STRUCT *flags;
 	unsigned long timeout;
@@ -666,7 +667,8 @@
  * Return:	0	o.k.
  *		< 0	failure (channel will not be created)
  */
-static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf)
+static int new_if(struct wan_device* wandev, struct net_device* dev,
+		  wanif_conf_t* conf)
 {
 	sdla_t* card = wandev->private;
 	chdlc_private_area_t* chdlc_priv_area;
@@ -897,11 +899,11 @@
  * interface registration.  Returning anything but zero will fail interface
  * registration.
  */
-static int if_init (netdevice_t* dev)
-	{
+static int if_init(struct net_device* dev)
+{
 	chdlc_private_area_t* chdlc_priv_area = dev->priv;
 	sdla_t* card = chdlc_priv_area->card;
-	wan_device_t* wandev = &card->wandev;
+	struct wan_device* wandev = &card->wandev;
 
 	/* Initialize device driver entry points */
 	dev->open		= &if_open;
@@ -960,7 +962,7 @@
  *
  * Return 0 if O.k. or errno.
  */
-static int if_open (netdevice_t* dev)
+static int if_open(struct net_device* dev)
 {
 	chdlc_private_area_t* chdlc_priv_area = dev->priv;
 	sdla_t* card = chdlc_priv_area->card;
@@ -1013,7 +1015,7 @@
  * o if this is the last close, then disable communications and interrupts.
  * o reset flags.
  */
-static int if_close (netdevice_t* dev)
+static int if_close(struct net_device* dev)
 {
 	chdlc_private_area_t* chdlc_priv_area = dev->priv;
 	sdla_t* card = chdlc_priv_area->card;
@@ -1084,8 +1086,9 @@
  *
  * Return:	media header length.
  */
-static int if_header (struct sk_buff* skb, netdevice_t* dev,
-	unsigned short type, void* daddr, void* saddr, unsigned len)
+static int if_header(struct sk_buff* skb, struct net_device* dev,
+		     unsigned short type, void* daddr, void* saddr,
+		     unsigned len)
 {
 	skb->protocol = htons(type);
 
@@ -1096,7 +1099,7 @@
 /*============================================================================
  * Handle transmit timeout event from netif watchdog
  */
-static void if_tx_timeout (netdevice_t *dev)
+static void if_tx_timeout(struct net_device *dev)
 {
     	chdlc_private_area_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -1144,7 +1147,7 @@
  * 2. Setting tbusy flag will inhibit further transmit requests from the
  *    protocol stack and can be used for flow control with protocol layer.
  */
-static int if_send (struct sk_buff* skb, netdevice_t* dev)
+static int if_send(struct sk_buff* skb, struct net_device* dev)
 {
 	chdlc_private_area_t *chdlc_priv_area = dev->priv;
 	sdla_t *card = chdlc_priv_area->card;
@@ -1278,7 +1281,7 @@
  * multicast source IP address.
  */
 
-static int chk_bcast_mcast_addr(sdla_t *card, netdevice_t* dev,
+static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
 				struct sk_buff *skb)
 {
 	u32 src_ip_addr;
@@ -1421,7 +1424,7 @@
  * Get ethernet-style interface statistics.
  * Return a pointer to struct enet_statistics.
  */
-static struct net_device_stats* if_stats (netdevice_t* dev)
+static struct net_device_stats* if_stats(struct net_device* dev)
 {
 	sdla_t *my_card;
 	chdlc_private_area_t* chdlc_priv_area;
@@ -1710,7 +1713,7 @@
  *       PREPROCESSOR STATEMENT ABOVE, UNLESS YOU KNOW WHAT YOU ARE
  *       DOING */
 
-static void chdlc_work (netdevice_t * dev)
+static void chdlc_work(struct net_device * dev)
 {
 	chdlc_private_area_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -1751,7 +1754,7 @@
 	return;
 }
 
-static int chdlc_work_cleanup (netdevice_t *dev)
+static int chdlc_work_cleanup(struct net_device *dev)
 {
 	chdlc_private_area_t* chan = dev->priv;
 
@@ -1769,7 +1772,7 @@
 
 
 
-static int bh_enqueue (netdevice_t *dev, struct sk_buff *skb)
+static int bh_enqueue(struct net_device *dev, struct sk_buff *skb)
 {
 	/* Check for full */
 	chdlc_private_area_t* chan = dev->priv;
@@ -1804,7 +1807,7 @@
  */
 static void wpc_isr (sdla_t* card)
 {
-	netdevice_t* dev;
+	struct net_device* dev;
 	SHARED_MEMORY_INFO_STRUCT* flags = NULL;
 	int i;
 	sdla_t *my_card;
@@ -1931,7 +1934,7 @@
  */
 static void rx_intr (sdla_t* card)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	chdlc_private_area_t *chdlc_priv_area;
 	SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
 	CHDLC_DATA_RX_STATUS_EL_STRUCT *rxbuf = card->u.c.rxmb;
@@ -2083,7 +2086,7 @@
  */
 void timer_intr(sdla_t *card)
 {
-        netdevice_t* dev;
+        struct net_device* dev;
         chdlc_private_area_t* chdlc_priv_area = NULL;
         SHARED_MEMORY_INFO_STRUCT* flags = NULL;
 
@@ -2172,7 +2175,7 @@
 		cfg.IP_netmask		= 0;
 		
 	}else if (card->wandev.dev){
-		netdevice_t * dev = card->wandev.dev;
+		struct net_device *dev = card->wandev.dev;
 		chdlc_private_area_t *chdlc_priv_area = dev->priv;
 		
                 struct in_device *in_dev = dev->ip_ptr;
@@ -2402,7 +2405,7 @@
 
 static int configure_ip (sdla_t* card)
 {
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
         chdlc_private_area_t *chdlc_priv_area;
         char err;
 
@@ -2449,7 +2452,7 @@
 
 static int unconfigure_ip (sdla_t* card)
 {
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	chdlc_private_area_t *chdlc_priv_area;
 
 	if (!dev)
@@ -2477,7 +2480,7 @@
 
 static void process_route (sdla_t *card)
 {
-        netdevice_t *dev = card->wandev.dev;
+        struct net_device *dev = card->wandev.dev;
         unsigned char port_num;
         chdlc_private_area_t *chdlc_priv_area = NULL;
 	u32 local_IP_addr = 0;
@@ -2658,8 +2661,8 @@
  */
 
 static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
-                                struct sk_buff *skb, netdevice_t* dev,
-                                chdlc_private_area_t* chdlc_priv_area )
+			      struct sk_buff *skb, struct net_device* dev,
+			      chdlc_private_area_t* chdlc_priv_area)
 {
 	int udp_pkt_stored = 0;
 
@@ -2686,7 +2689,7 @@
  * Process UDP management packet.
  */
 
-static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev,
+static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev,
 				chdlc_private_area_t* chdlc_priv_area ) 
 {
 	unsigned char *buf;
@@ -3263,7 +3266,7 @@
 
                 card->wandev.state = card->u.c.state = state;
 		if (card->wandev.dev){
-			netdevice_t *dev = card->wandev.dev;
+			struct net_device *dev = card->wandev.dev;
 			chdlc_private_area_t *chdlc_priv_area = dev->priv;
 			chdlc_priv_area->common.state = state;
 		}
@@ -3293,7 +3296,7 @@
 
 static int config_chdlc (sdla_t *card)
 {
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	chdlc_private_area_t *chdlc_priv_area = dev->priv;
 	SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
 
@@ -3417,7 +3420,7 @@
  *      the chldc_poll routine.  
  */
 
-static void chdlc_poll (netdevice_t *dev)
+static void chdlc_poll(struct net_device *dev)
 {
 	chdlc_private_area_t *chdlc_priv_area;
 	sdla_t *card;
@@ -3567,7 +3570,7 @@
  *      a polling routine.
  *
  */	
-static void trigger_chdlc_poll (netdevice_t *dev)
+static void trigger_chdlc_poll(struct net_device *dev)
 {
 	chdlc_private_area_t *chdlc_priv_area;
 	sdla_t *card;
@@ -3592,7 +3595,7 @@
 
 static void chdlc_poll_delay (unsigned long dev_ptr)
 {
-	netdevice_t *dev = (netdevice_t *)dev_ptr;
+	struct net_device *dev = (struct net_device *)dev_ptr;
 	trigger_chdlc_poll(dev);
 }
 
diff -urN linux-2.5.69-bk12/drivers/net/wan/sdla_fr.c linux-2.5.69-bk13/drivers/net/wan/sdla_fr.c
--- linux-2.5.69-bk12/drivers/net/wan/sdla_fr.c	2003-05-04 16:53:56.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/sdla_fr.c	2003-05-18 04:45:50.000000000 -0700
@@ -323,27 +323,28 @@
 /****** Function Prototypes *************************************************/
 
 /* WAN link driver entry points. These are called by the WAN router module. */
-static int update(wan_device_t *wandev);
-static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf);
-static int del_if(wan_device_t *wandev, netdevice_t *dev);
+static int update(struct wan_device *wandev);
+static int new_if(struct wan_device *wandev, struct net_device *dev,
+		  wanif_conf_t *conf);
+static int del_if(struct wan_device *wandev, struct net_device *dev);
 static void disable_comm (sdla_t *card);
 
 /* WANPIPE-specific entry points */
 static int wpf_exec(struct sdla *card, void *u_cmd, void *u_data);
 
 /* Network device interface */
-static int if_init(netdevice_t *dev);
-static int if_open(netdevice_t *dev);
-static int if_close(netdevice_t *dev);
+static int if_init(struct net_device *dev);
+static int if_open(struct net_device *dev);
+static int if_close(struct net_device *dev);
 
-static void if_tx_timeout (netdevice_t *dev);
+static void if_tx_timeout(struct net_device *dev);
 
 static int if_rebuild_hdr (struct sk_buff *skb);
 
-static int if_send(struct sk_buff *skb, netdevice_t *dev);
-static int chk_bcast_mcast_addr(sdla_t *card, netdevice_t* dev,
+static int if_send(struct sk_buff *skb, struct net_device *dev);
+static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
                                 struct sk_buff *skb);
-static struct net_device_stats *if_stats(netdevice_t *dev);
+static struct net_device_stats *if_stats(struct net_device *dev);
 
 /* Interrupt handlers */
 static void fr_isr(sdla_t *card);
@@ -382,9 +383,9 @@
 static int fr_dlci_change(sdla_t *card, fr_mbox_t *mbox);
 
 /* Miscellaneous functions */
-static int update_chan_state(netdevice_t *dev);
-static void set_chan_state(netdevice_t *dev, int state);
-static netdevice_t *find_channel(sdla_t *card, unsigned dlci);
+static int update_chan_state(struct net_device *dev);
+static void set_chan_state(struct net_device *dev, int state);
+static struct net_device *find_channel(sdla_t *card, unsigned dlci);
 static int is_tx_ready(sdla_t *card, fr_channel_t *chan);
 static unsigned int dec_to_uint(unsigned char *str, int len);
 static int reply_udp( unsigned char *data, unsigned int mbox_len );
@@ -393,22 +394,23 @@
 static void init_chan_statistics( fr_channel_t* chan );
 static void init_global_statistics( sdla_t* card );
 static void read_DLCI_IB_mapping( sdla_t* card, fr_channel_t* chan );
-static int setup_for_delayed_transmit(netdevice_t* dev, struct sk_buff *skb);
+static int setup_for_delayed_transmit(struct net_device* dev,
+				      struct sk_buff *skb);
 
-netdevice_t * move_dev_to_next (sdla_t *, netdevice_t *);
-static int check_tx_status(sdla_t *, netdevice_t *);
+struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev);
+static int check_tx_status(sdla_t *card, struct net_device *dev);
 
 /* Frame Relay Socket API */
 static void trigger_fr_bh (fr_channel_t *);
-static void fr_bh (netdevice_t *);
-static int fr_bh_cleanup (netdevice_t *);
-static int bh_enqueue (netdevice_t *, struct sk_buff *);
-
-static void trigger_fr_poll (netdevice_t *);
-static void fr_poll (netdevice_t *);
-//static void add_gateway (netdevice_t *);
+static void fr_bh(struct net_device *dev);
+static int fr_bh_cleanup(struct net_device *dev);
+static int bh_enqueue(struct net_device *dev, struct sk_buff *skb);
+
+static void trigger_fr_poll(struct net_device *dev);
+static void fr_poll(struct net_device *dev);
+//static void add_gateway(struct net_device *dev);
 
-static void trigger_unconfig_fr (netdevice_t *dev);
+static void trigger_unconfig_fr(struct net_device *dev);
 static void unconfig_fr (sdla_t *);
 
 static void trigger_config_fr (sdla_t *);
@@ -416,11 +418,11 @@
 
 
 /* Inverse ARP and Dynamic routing functions */
-int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, netdevice_t *dev);
+int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, struct net_device *dev);
 int is_arp(void *buf);
-int send_inarp_request(sdla_t *card, netdevice_t *dev);
+int send_inarp_request(sdla_t *card, struct net_device *dev);
 
-static void trigger_fr_arp (netdevice_t *);
+static void trigger_fr_arp(struct net_device *dev);
 static void fr_arp (unsigned long data);
 
 
@@ -442,7 +444,8 @@
 void 	s508_s514_lock(sdla_t *card, unsigned long *smp_flags);
 
 unsigned short calc_checksum (char *, int);
-static int setup_fr_header(struct sk_buff** skb, netdevice_t* dev, char op_mode);
+static int setup_fr_header(struct sk_buff** skb,
+			   struct net_device* dev, char op_mode);
 
 
 /****** Public Functions ****************************************************/
@@ -746,7 +749,7 @@
 /*============================================================================
  * Update device status & statistics.
  */
-static int update (wan_device_t* wandev)
+static int update(struct wan_device* wandev)
 {
 	volatile sdla_t* card;
 	unsigned long timeout;
@@ -791,7 +794,8 @@
  * Return:	0	o.k.
  *		< 0	failure (channel will not be created)
  */
-static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf)
+static int new_if(struct wan_device* wandev, struct net_device* dev,
+		  wanif_conf_t* conf)
 {
 	sdla_t* card = wandev->private;
 	fr_channel_t* chan;
@@ -1020,7 +1024,7 @@
 /*============================================================================
  * Delete logical channel.
  */
-static int del_if (wan_device_t* wandev, netdevice_t* dev)
+static int del_if(struct wan_device* wandev, struct net_device* dev)
 {
 	fr_channel_t* chan = dev->priv;
 	unsigned long smp_flags=0;
@@ -1116,11 +1120,11 @@
  * interface registration.  Returning anything but zero will fail interface
  * registration.
  */
-static int if_init (netdevice_t* dev)
+static int if_init(struct net_device* dev)
 {
 	fr_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
-	wan_device_t* wandev = &card->wandev;
+	struct wan_device* wandev = &card->wandev;
 
 	/* Initialize device driver entry points */
 	dev->open		= &if_open;
@@ -1194,7 +1198,7 @@
  *
  * Return 0 if O.k. or errno.
  */
-static int if_open (netdevice_t* dev)
+static int if_open(struct net_device* dev)
 {
 	fr_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -1236,7 +1240,7 @@
  * o if this is the last open, then disable communications and interrupts.
  * o reset flags.
  */
-static int if_close (netdevice_t* dev)
+static int if_close(struct net_device* dev)
 {
 	fr_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -1259,8 +1263,7 @@
  */
 static int if_rebuild_hdr (struct sk_buff* skb)
 {
-
-	netdevice_t *dev = skb->dev;
+	struct net_device *dev = skb->dev;
 	fr_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
 
@@ -1272,7 +1275,7 @@
 /*============================================================================
  * Handle transmit timeout event from netif watchdog
  */
-static void if_tx_timeout (netdevice_t *dev)
+static void if_tx_timeout(struct net_device *dev)
 {
     	fr_channel_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -1315,7 +1318,7 @@
  *    will inhibit further transmit requests from the protocol stack 
  *    and can be used for flow control with protocol layer.
  */
-static int if_send (struct sk_buff* skb, netdevice_t* dev)
+static int if_send(struct sk_buff* skb, struct net_device* dev)
 {
     	fr_channel_t* chan = dev->priv;
     	sdla_t* card = chan->card;
@@ -1562,7 +1565,8 @@
  * Setup so that a frame can be transmitted on the occurrence of a transmit
  * interrupt.
  */
-static int setup_for_delayed_transmit (netdevice_t* dev, struct sk_buff *skb)
+static int setup_for_delayed_transmit(struct net_device* dev,
+				      struct sk_buff *skb)
 {
         fr_channel_t* chan = dev->priv;
         sdla_t* card = chan->card;
@@ -1614,7 +1618,7 @@
  * Return 0 if not broadcast/multicast address, otherwise return 1.
  */
 
-static int chk_bcast_mcast_addr(sdla_t *card, netdevice_t* dev,
+static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
                                 struct sk_buff *skb)
 {
         u32 src_ip_addr;
@@ -1826,7 +1830,7 @@
  * Get ethernet-style interface statistics.
  * Return a pointer to struct enet_statistics.
  */
-static struct net_device_stats *if_stats(netdevice_t *dev)
+static struct net_device_stats *if_stats(struct net_device *dev)
 {
 	fr_channel_t* chan = dev->priv;
 	
@@ -1952,7 +1956,7 @@
 	fr_channel_t* chan;
 	char *ptr = &flags->iflag;
 	struct sk_buff* skb;
-	netdevice_t* dev;
+	struct net_device* dev;
 	void* buf;
 	unsigned dlci, len, offs, len_incl_hdr;
 	int i, udp_type;	
@@ -2223,7 +2227,7 @@
 {
         fr508_flags_t* flags = card->flags;
         fr_tx_buf_ctl_t* bctl;
-        netdevice_t* dev;
+        struct net_device* dev;
         fr_channel_t* chan;
 
         if(card->hw.type == SDLA_S514){
@@ -2352,9 +2356,10 @@
 	/* Update the channel state call.  This is call is
          * triggered by if_send() function */
 	if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_UPDATE_STATE){
-		netdevice_t *dev;
+		struct net_device *dev;
 		if (card->wandev.state == WAN_CONNECTED){
-			for (dev=card->wandev.dev; dev; dev = *((netdevice_t **)dev->priv)){
+			for (dev = card->wandev.dev; dev;
+			     dev = *((struct net_device **)dev->priv)){
 				fr_channel_t *chan = dev->priv;	
 				if (chan->common.state != WAN_CONNECTED){
 					update_chan_state(dev);
@@ -2380,7 +2385,7 @@
 	/* Transmit ARP packets */
 	if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_ARP){
 		int i=0;
-		netdevice_t *dev;
+		struct net_device *dev;
 
 		if (card->u.f.arp_dev == NULL)
 			card->u.f.arp_dev = card->wandev.dev;
@@ -2584,7 +2589,7 @@
  *	This function is called by fr_poll() polling funtion.
  */
 
-static void process_route (netdevice_t *dev)
+static void process_route(struct net_device *dev)
 {
 	fr_channel_t *chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -2985,7 +2990,7 @@
 
 static unsigned int fr_send_hdr (sdla_t*card, int dlci, unsigned int offset)
 {
-	netdevice_t *dev = find_channel(card,dlci);	
+	struct net_device *dev = find_channel(card,dlci);	
 	fr_channel_t *chan;
 
 	if (!dev || !(chan=dev->priv))
@@ -3088,12 +3093,12 @@
 		case FRRES_MODEM_FAILURE:
 			return fr_modem_failure(card, mbox);
 
-		case FRRES_CHANNEL_DOWN:
-			{
-			netdevice_t *dev;
+		case FRRES_CHANNEL_DOWN: {
+			struct net_device *dev;
 
 			/* Remove all routes from associated DLCI's */
-			for (dev = card->wandev.dev; dev; dev = *((netdevice_t **)dev->priv)) {
+			for (dev = card->wandev.dev; dev;
+			     dev = *((struct net_device **)dev->priv)) {
 				fr_channel_t *chan = dev->priv;
 				if (chan->route_flag == ROUTE_ADDED) {
 					chan->route_flag = REMOVE_ROUTE;
@@ -3114,13 +3119,13 @@
 			return 1;
 			}
 
-		case FRRES_CHANNEL_UP:
-			{
-			netdevice_t *dev;
+		case FRRES_CHANNEL_UP: {
+			struct net_device *dev;
 
 			/* FIXME: Only startup devices that are on the list */
 			
-			for (dev = card->wandev.dev; dev; dev = *((netdevice_t **)dev->priv)) {
+			for (dev = card->wandev.dev; dev;
+			     dev = *((struct net_device **)dev->priv)) {
 				
 				set_chan_state(dev,WAN_CONNECTED);
 			}
@@ -3194,13 +3199,13 @@
 	dlci_status_t* status = (void*)mbox->data;
 	int cnt = mbox->cmd.length / sizeof(dlci_status_t);
 	fr_channel_t *chan;
-	netdevice_t* dev2;
+	struct net_device* dev2;
 	
 
 	for (; cnt; --cnt, ++status) {
 
 		unsigned short dlci= status->dlci;
-		netdevice_t* dev = find_channel(card, dlci);
+		struct net_device* dev = find_channel(card, dlci);
 		
 		if (dev == NULL){
 			printk(KERN_INFO 
@@ -3259,7 +3264,8 @@
 		}
 	}
 	
-	for (dev2 =card->wandev.dev; dev2; dev2 = *((netdevice_t **)dev2->priv)){
+	for (dev2 = card->wandev.dev; dev2;
+	     dev2 = *((struct net_device **)dev2->priv)){
 		
 		chan = dev2->priv;
 	
@@ -3315,7 +3321,7 @@
 /*============================================================================
  * Update channel state. 
  */
-static int update_chan_state (netdevice_t* dev)
+static int update_chan_state(struct net_device* dev)
 {
 	fr_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -3361,7 +3367,7 @@
 /*============================================================================
  * Set channel state.
  */
-static void set_chan_state (netdevice_t* dev, int state)
+static void set_chan_state(struct net_device* dev, int state)
 {
 	fr_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -3414,7 +3420,7 @@
  * NOTE: del_if() functions updates this array, it uses
  *       the spin locks to avoid corruption.
  */
-static netdevice_t* find_channel (sdla_t* card, unsigned dlci)
+static struct net_device* find_channel(sdla_t* card, unsigned dlci)
 {
 	if(dlci > HIGHEST_VALID_DLCI)
 		return NULL;
@@ -3471,7 +3477,7 @@
 {
         int udp_pkt_stored = 0;
 	
-	netdevice_t *dev=find_channel(card,dlci);
+	struct net_device *dev = find_channel(card, dlci);
 	fr_channel_t *chan;
 	
 	if (!dev || !(chan=dev->priv))
@@ -3517,7 +3523,7 @@
 	int err;
 	struct timeval tv;
 	int udp_mgmt_req_valid = 1;
-        netdevice_t* dev;
+        struct net_device* dev;
         fr_channel_t* chan;
         fr_udp_pkt_t *fr_udp_pkt;
 	unsigned short num_trc_els;
@@ -3918,7 +3924,7 @@
  * Send Inverse ARP Request
  */
 
-int send_inarp_request(sdla_t *card, netdevice_t *dev)
+int send_inarp_request(sdla_t *card, struct net_device *dev)
 {
 	int err=0;
 
@@ -3995,7 +4001,7 @@
  * Process ARP Packet Type
  */
 
-int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, netdevice_t* dev)
+int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, struct net_device* dev)
 {
 
 
@@ -4152,7 +4158,7 @@
  *      at a later date.
  */	
 
-static void trigger_fr_arp (netdevice_t *dev)
+static void trigger_fr_arp(struct net_device *dev)
 {
 	fr_channel_t* chan = dev->priv;
 
@@ -4173,7 +4179,7 @@
 
 static void fr_arp (unsigned long data)
 {
-	netdevice_t *dev = (netdevice_t *)data;
+	struct net_device *dev = (struct net_device *)data;
 	fr_channel_t *chan = dev->priv;
 	volatile sdla_t *card = chan->card;
 	fr508_flags_t* flags = card->flags;
@@ -4365,7 +4371,7 @@
  *
  */
 
-static int bh_enqueue (netdevice_t *dev, struct sk_buff *skb)
+static int bh_enqueue(struct net_device *dev, struct sk_buff *skb)
 {
 	/* Check for full */
 	fr_channel_t* chan = dev->priv;
@@ -4438,7 +4444,7 @@
  *
  */	
 
-static void fr_bh (netdevice_t * dev)
+static void fr_bh(struct net_device * dev)
 {
 	fr_channel_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -4485,7 +4491,7 @@
 	return;
 }
 
-static int fr_bh_cleanup (netdevice_t *dev)
+static int fr_bh_cleanup(struct net_device *dev)
 {
 	fr_channel_t* chan = dev->priv;
 
@@ -4519,7 +4525,7 @@
  *      a polling routine.
  *
  */	
-static void trigger_fr_poll (netdevice_t *dev)
+static void trigger_fr_poll(struct net_device *dev)
 {
 	fr_channel_t* chan = dev->priv;
 	schedule_task(&chan->fr_poll_task);
@@ -4549,7 +4555,7 @@
  *      the fr_poll routine.  
  */
 
-static void fr_poll (netdevice_t *dev)
+static void fr_poll(struct net_device *dev)
 {
 
 	fr_channel_t* chan;
@@ -4636,7 +4642,7 @@
  *      an interrupt.
  */
 
-static int check_tx_status(sdla_t *card, netdevice_t *dev)
+static int check_tx_status(sdla_t *card, struct net_device *dev)
 {
 
 	if (card->hw.type == SDLA_S514){
@@ -4666,14 +4672,13 @@
  *
  */
 
-netdevice_t * move_dev_to_next (sdla_t *card, netdevice_t *dev)
+struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev)
 {
 	if (card->wandev.new_if_cnt != 1){
-		if (*((netdevice_t **)dev->priv) == NULL){
+		if (!*((struct net_device **)dev->priv))
 			return card->wandev.dev;
-		}else{
-			return *((netdevice_t **)dev->priv);
-		}
+		else
+			return *((struct net_device **)dev->priv);
 	}
 	return dev;
 }
@@ -4723,10 +4728,11 @@
 
 static void config_fr (sdla_t *card)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	fr_channel_t *chan;
 
-	for (dev=card->wandev.dev; dev; dev=*((netdevice_t **)dev->priv)){
+	for (dev = card->wandev.dev; dev;
+	     dev = *((struct net_device **)dev->priv)) {
 	
 		if ((chan=dev->priv) == NULL)
 			continue;
@@ -4795,7 +4801,7 @@
  *
  */
 
-static void trigger_unconfig_fr (netdevice_t *dev)
+static void trigger_unconfig_fr(struct net_device *dev)
 {
 	fr_channel_t *chan = dev->priv;
 	volatile sdla_t *card = chan->card;
@@ -4847,10 +4853,11 @@
 
 static void unconfig_fr (sdla_t *card)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	fr_channel_t *chan;
 
-	for (dev=card->wandev.dev; dev; dev=*((netdevice_t **)dev->priv)){
+	for (dev = card->wandev.dev; dev;
+	     dev = *((struct net_device **)dev->priv)){
 	
 		if ((chan=dev->priv) == NULL)
 			continue;
@@ -4869,7 +4876,8 @@
 	}
 }
 
-static int setup_fr_header(struct sk_buff ** skb_orig, netdevice_t* dev, char op_mode)
+static int setup_fr_header(struct sk_buff **skb_orig, struct net_device* dev,
+			   char op_mode)
 {
 	struct sk_buff *skb = *skb_orig;
 	fr_channel_t *chan=dev->priv;
@@ -4927,7 +4935,7 @@
 	fr_conf_t *conf=NULL;
 	unsigned short dlci_num = chan->dlci;
 	int dlci_offset=0;
-	netdevice_t *dev=NULL;
+	struct net_device *dev = NULL;
 	
 	mbox->cmd.command = FR_READ_CONFIG;
 	mbox->cmd.length = 0;
@@ -4939,9 +4947,9 @@
 		return 0;
 	}
 
-	for (dev=card->wandev.dev; dev; dev=*((netdevice_t**)dev->priv)){
+	for (dev = card->wandev.dev; dev;
+	     dev=*((struct net_device **)dev->priv))
 		set_chan_state(dev,WAN_DISCONNECTED);
-	}
 	
 	printk(KERN_INFO "DLCI %i Not configured, configuring\n",dlci_num);
 	
@@ -4969,7 +4977,8 @@
 	conf = (fr_conf_t *)mbox->data;
 
 	dlci_offset=0;
-	for (dev=card->wandev.dev; dev; dev=*((netdevice_t**)dev->priv)){
+	for (dev = card->wandev.dev; dev;
+	     dev = *((struct net_device **)dev->priv)) {
 		fr_channel_t *chan_tmp = dev->priv;
 		conf->dlci[dlci_offset] = chan_tmp->dlci;		
 		dlci_offset++;
@@ -5003,7 +5012,8 @@
 
 	printk(KERN_INFO "Enabling Communications \n");
 
-	for (dev=card->wandev.dev; dev; dev=*((netdevice_t**)dev->priv)){
+	for (dev = card->wandev.dev; dev;
+	     dev = *((struct net_device **)dev->priv)) {
 		fr_channel_t *chan_tmp = dev->priv;
 		fr_init_dlci(card,chan_tmp);
 		fr_add_dlci(card, chan_tmp->dlci);
diff -urN linux-2.5.69-bk12/drivers/net/wan/sdla_ft1.c linux-2.5.69-bk13/drivers/net/wan/sdla_ft1.c
--- linux-2.5.69-bk12/drivers/net/wan/sdla_ft1.c	2003-05-04 16:53:02.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/sdla_ft1.c	2003-05-18 04:45:50.000000000 -0700
@@ -70,7 +70,7 @@
 
 typedef struct chdlc_private_area
 {
-	netdevice_t 	*slave;
+	struct net_device *slave;
 	sdla_t		*card;
 	int 		TracingEnabled;		/* For enabling Tracing */
 	unsigned long 	curr_trace_addr;	/* Used for Tracing */
diff -urN linux-2.5.69-bk12/drivers/net/wan/sdla_ppp.c linux-2.5.69-bk13/drivers/net/wan/sdla_ppp.c
--- linux-2.5.69-bk12/drivers/net/wan/sdla_ppp.c	2003-05-04 16:53:07.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/sdla_ppp.c	2003-05-18 04:45:50.000000000 -0700
@@ -168,7 +168,7 @@
   
 typedef struct ppp_private_area
 {
-	netdevice_t *slave;
+	struct net_device *slave;
 	sdla_t* card;	
 	unsigned long router_start_time;	/*router start time in sec */
 	unsigned long tick_counter;		/*used for 5 second counter*/
@@ -231,25 +231,27 @@
 /****** Function Prototypes *************************************************/
 
 /* WAN link driver entry points. These are called by the WAN router module. */
-static int update(wan_device_t *wandev);
-static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf);
-static int del_if(wan_device_t *wandev, netdevice_t *dev);
+static int update(struct wan_device *wandev);
+static int new_if(struct wan_device *wandev, struct net_device *dev,
+		  wanif_conf_t *conf);
+static int del_if(struct wan_device *wandev, struct net_device *dev);
 
 /* WANPIPE-specific entry points */
 static int wpp_exec (struct sdla *card, void *u_cmd, void *u_data);
 
 /* Network device interface */
-static int if_init(netdevice_t *dev);
-static int if_open(netdevice_t *dev);
-static int if_close(netdevice_t *dev);
-static int if_header(struct sk_buff *skb, netdevice_t *dev, unsigned short type, 
+static int if_init(struct net_device *dev);
+static int if_open(struct net_device *dev);
+static int if_close(struct net_device *dev);
+static int if_header(struct sk_buff *skb, struct net_device *dev,
+		     unsigned short type, 
 		     void *daddr, void *saddr, unsigned len);
 
-static void if_tx_timeout (netdevice_t *dev);
+static void if_tx_timeout(struct net_device *dev);
 
 static int if_rebuild_hdr(struct sk_buff *skb);
-static struct net_device_stats *if_stats(netdevice_t *dev);
-static int if_send(struct sk_buff *skb, netdevice_t *dev);
+static struct net_device_stats *if_stats(struct net_device *dev);
+static int if_send(struct sk_buff *skb, struct net_device *dev);
 
 
 /* PPP firmware interface functions */
@@ -278,10 +280,10 @@
 static int read_info( sdla_t *card );
 static int read_connection_info (sdla_t *card);
 static void remove_route( sdla_t *card );
-static int config508(netdevice_t *dev, sdla_t *card);
+static int config508(struct net_device *dev, sdla_t *card);
 static void show_disc_cause(sdla_t * card, unsigned cause);
 static int reply_udp( unsigned char *data, unsigned int mbox_len );
-static void process_udp_mgmt_pkt(sdla_t *card, netdevice_t *dev, 
+static void process_udp_mgmt_pkt(sdla_t *card, struct net_device *dev, 
 				ppp_private_area_t *ppp_priv_area);
 static void init_ppp_tx_rx_buff( sdla_t *card );
 static int intr_test( sdla_t *card );
@@ -290,12 +292,12 @@
 static void init_global_statistics( sdla_t *card );
 static int tokenize(char *str, char **tokens);
 static char* strstrip(char *str, char *s);
-static int chk_bcast_mcast_addr(sdla_t* card, netdevice_t* dev,
+static int chk_bcast_mcast_addr(sdla_t* card, struct net_device* dev,
 				struct sk_buff *skb);
 
 static int config_ppp (sdla_t *);
-static void ppp_poll(netdevice_t *);
-static void trigger_ppp_poll(netdevice_t *);
+static void ppp_poll(struct net_device *dev);
+static void trigger_ppp_poll(struct net_device *dev);
 static void ppp_poll_delay (unsigned long dev_ptr);
 
 
@@ -315,7 +317,7 @@
 static void s508_unlock (sdla_t *card, unsigned long *smp_flags);
 
 static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
-                                struct sk_buff *skb, netdevice_t* dev,
+                                struct sk_buff *skb, struct net_device* dev,
                                 ppp_private_area_t* ppp_priv_area );
 static unsigned short calc_checksum (char *data, int len);
 static void disable_comm (sdla_t *card);
@@ -444,10 +446,10 @@
 /*============================================================================
  * Update device status & statistics.
  */
-static int update(wan_device_t *wandev)
+static int update(struct wan_device *wandev)
 {
 	sdla_t* card = wandev->private;
- 	netdevice_t* dev;
+ 	struct net_device* dev;
         volatile ppp_private_area_t *ppp_priv_area;
 	ppp_flags_t *flags = card->flags;
 	unsigned long timeout;
@@ -504,7 +506,8 @@
  * Return:	0	o.k.
  *		< 0	failure (channel will not be created)
  */
-static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf)
+static int new_if(struct wan_device *wandev, struct net_device *dev,
+		  wanif_conf_t *conf)
 {
 	sdla_t *card = wandev->private;
 	ppp_private_area_t *ppp_priv_area;
@@ -622,7 +625,7 @@
 /*============================================================================
  * Delete logical channel.
  */
-static int del_if(wan_device_t *wandev, netdevice_t *dev)
+static int del_if(struct wan_device *wandev, struct net_device *dev)
 {
 	return 0;
 }
@@ -681,11 +684,11 @@
  * interface registration.  Returning anything but zero will fail interface
  * registration.
  */
-static int if_init(netdevice_t *dev)
+static int if_init(struct net_device *dev)
 {
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 	sdla_t *card = ppp_priv_area->card;
-	wan_device_t *wandev = &card->wandev;
+	struct wan_device *wandev = &card->wandev;
 
 	/* Initialize device driver entry points */
 	dev->open		= &if_open;
@@ -730,7 +733,7 @@
  *
  * Return 0 if O.k. or errno.
  */
-static int if_open (netdevice_t *dev)
+static int if_open(struct net_device *dev)
 {
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 	sdla_t *card = ppp_priv_area->card;
@@ -769,7 +772,7 @@
  * o if this is the last open, then disable communications and interrupts.
  * o reset flags.
  */
-static int if_close(netdevice_t *dev)
+static int if_close(struct net_device *dev)
 {
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 	sdla_t *card = ppp_priv_area->card;
@@ -790,7 +793,7 @@
  *
  * Return:	media header length.
  */
-static int if_header(struct sk_buff *skb, netdevice_t *dev,
+static int if_header(struct sk_buff *skb, struct net_device *dev,
 	unsigned short type, void *daddr, void *saddr, unsigned len)
 {
 	switch (type)
@@ -815,7 +818,7 @@
  */
 static int if_rebuild_hdr (struct sk_buff *skb)
 {
-	netdevice_t *dev = skb->dev;
+	struct net_device *dev = skb->dev;
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 	sdla_t *card = ppp_priv_area->card;
 
@@ -827,7 +830,7 @@
 /*============================================================================
  * Handle transmit timeout event from netif watchdog
  */
-static void if_tx_timeout (netdevice_t *dev)
+static void if_tx_timeout(struct net_device *dev)
 {
     	ppp_private_area_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -865,7 +868,7 @@
  * 2. Setting tbusy flag will inhibit further transmit requests from the
  *    protocol stack and can be used for flow control with protocol layer.
  */
-static int if_send (struct sk_buff *skb, netdevice_t *dev)
+static int if_send (struct sk_buff *skb, struct net_device *dev)
 {
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 	sdla_t *card = ppp_priv_area->card;
@@ -995,7 +998,7 @@
  */
 
 static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
-                                struct sk_buff *skb, netdevice_t* dev,
+                                struct sk_buff *skb, struct net_device* dev,
                                 ppp_private_area_t* ppp_priv_area )
 {
 	int udp_pkt_stored = 0;
@@ -1189,7 +1192,7 @@
  * Get ethernet-style interface statistics.
  * Return a pointer to struct net_device_stats.
  */
-static struct net_device_stats *if_stats(netdevice_t *dev)
+static struct net_device_stats *if_stats(struct net_device *dev)
 {
 
 	ppp_private_area_t *ppp_priv_area = dev->priv;
@@ -1569,7 +1572,7 @@
 {
 	ppp_flags_t *flags = card->flags;
 	char *ptr = &flags->iflag;
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	int i;
 
 	card->in_isr = 1;
@@ -1649,7 +1652,7 @@
 static void rx_intr(sdla_t *card)
 {
 	ppp_buf_ctl_t *rxbuf = card->rxmb;
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	ppp_private_area_t *ppp_priv_area;
 	struct sk_buff *skb;
 	unsigned len;
@@ -1789,7 +1792,7 @@
 void event_intr (sdla_t *card)
 {
 
- 	netdevice_t* dev = card->wandev.dev;
+ 	struct net_device* dev = card->wandev.dev;
         ppp_private_area_t* ppp_priv_area = dev->priv;
 	volatile ppp_flags_t *flags = card->flags;
 
@@ -1908,7 +1911,7 @@
 void timer_intr (sdla_t *card)
 {
 
-        netdevice_t* dev = card->wandev.dev;
+        struct net_device* dev = card->wandev.dev;
         ppp_private_area_t* ppp_priv_area = dev->priv;
 	ppp_flags_t *flags = card->flags;
 
@@ -2105,7 +2108,7 @@
 static void process_route (sdla_t *card)
 {
 	ppp_flags_t *flags = card->flags;
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 	
 	if ((card->u.p.ip_mode == WANOPT_PPP_PEER) &&
@@ -2147,7 +2150,7 @@
  */
 static void retrigger_comm(sdla_t *card)
 {
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 
 	if (dev && ((jiffies - card->state_tick) > HOLD_DOWN_TIME)) {
 
@@ -2164,7 +2167,7 @@
 /*============================================================================
  * Configure S508 adapter.
  */
-static int config508(netdevice_t *dev, sdla_t *card)
+static int config508(struct net_device *dev, sdla_t *card)
 {
 	ppp508_conf_t cfg;
 	struct in_device *in_dev = dev->ip_ptr;
@@ -2336,7 +2339,7 @@
 /*=============================================================================
  * Process UDP call of type PTPIPEAB.
  */
-static void process_udp_mgmt_pkt(sdla_t *card, netdevice_t *dev, 
+static void process_udp_mgmt_pkt(sdla_t *card, struct net_device *dev, 
 				 ppp_private_area_t *ppp_priv_area ) 
 {
 	unsigned char buf2[5];
@@ -2847,7 +2850,7 @@
  */
 static int read_info( sdla_t *card )
 {
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 	int err;
 
@@ -2896,7 +2899,7 @@
 static void remove_route( sdla_t *card )
 {
 
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	long ip_addr;
 	int err;
 
@@ -3022,7 +3025,7 @@
  * multicast source IP address.
  */
 
-static int chk_bcast_mcast_addr(sdla_t *card, netdevice_t* dev,
+static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
 				struct sk_buff *skb)
 {
 	u32 src_ip_addr;
@@ -3073,7 +3076,7 @@
 static int read_connection_info (sdla_t *card)
 {
 	ppp_mbox_t *mb = card->mbox;
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 	ppp508_connect_info_t *ppp508_connect_info;
 	int err;
@@ -3122,7 +3125,7 @@
 static int config_ppp (sdla_t *card)
 {
 
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	ppp_flags_t *flags = card->flags;
 	ppp_private_area_t *ppp_priv_area = dev->priv;
 
@@ -3230,7 +3233,7 @@
  *      trigger_ppp_poll() function is used to kick
  *      the ppp_poll routine.  
  */
-static void ppp_poll (netdevice_t *dev)
+static void ppp_poll(struct net_device *dev)
 {
 	ppp_private_area_t *ppp_priv_area; 	
 	sdla_t *card;
@@ -3375,7 +3378,7 @@
  *
  */	
 
-static void trigger_ppp_poll (netdevice_t *dev)
+static void trigger_ppp_poll(struct net_device *dev)
 {
 	ppp_private_area_t *ppp_priv_area;
 	if ((ppp_priv_area=dev->priv) != NULL){ 	
@@ -3397,7 +3400,7 @@
 
 static void ppp_poll_delay (unsigned long dev_ptr)
 {
-	netdevice_t *dev = (netdevice_t *)dev_ptr;
+	struct net_device *dev = (struct net_device *)dev_ptr;
 	trigger_ppp_poll(dev);
 }
 
diff -urN linux-2.5.69-bk12/drivers/net/wan/sdla_x25.c linux-2.5.69-bk13/drivers/net/wan/sdla_x25.c
--- linux-2.5.69-bk12/drivers/net/wan/sdla_x25.c	2003-05-04 16:53:35.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/sdla_x25.c	2003-05-18 04:45:50.000000000 -0700
@@ -241,7 +241,7 @@
  *	
  * Assumptions:
  *
- * Description:	This is an extention of the 'netdevice_t' 
+ * Description:	This is an extention of the struct net_device
  *              we create for each network interface to keep 
  *              the rest of X.25 channel-specific data. 
  *
@@ -271,7 +271,7 @@
 	atomic_t  bh_buff_used;
 
 	sdla_t* card;			/* -> owner */
-	netdevice_t *dev;		/* -> bound devce */
+	struct net_device *dev;		/* -> bound devce */
 
 	int ch_idx;
 	unsigned char enable_IPX;
@@ -330,10 +330,10 @@
  * WAN link driver entry points. These are 
  * called by the WAN router module.
  */
-static int update (wan_device_t* wandev);
-static int new_if (wan_device_t* wandev, netdevice_t* dev,
-	wanif_conf_t* conf);
-static int del_if (wan_device_t* wandev, netdevice_t* dev);
+static int update(struct wan_device* wandev);
+static int new_if(struct wan_device* wandev, struct net_device* dev,
+		  wanif_conf_t* conf);
+static int del_if(struct wan_device* wandev, struct net_device* dev);
 static void disable_comm (sdla_t* card);
 static void disable_comm_shutdown(sdla_t *card);
 
@@ -343,24 +343,24 @@
  *	WANPIPE-specific entry points 
  */
 static int wpx_exec (struct sdla* card, void* u_cmd, void* u_data);
-static void x25api_bh (netdevice_t *);
-static int x25api_bh_cleanup (netdevice_t *);
-static int bh_enqueue (netdevice_t *, struct sk_buff *);
+static void x25api_bh(struct net_device *dev);
+static int x25api_bh_cleanup(struct net_device *dev);
+static int bh_enqueue(struct net_device *dev, struct sk_buff *skb);
 
 
 /*=================================================  
  * 	Network device interface 
  */
-static int if_init   (netdevice_t* dev);
-static int if_open   (netdevice_t* dev);
-static int if_close  (netdevice_t* dev);
-static int if_header (struct sk_buff* skb, netdevice_t* dev,
+static int if_init(struct net_device* dev);
+static int if_open(struct net_device* dev);
+static int if_close(struct net_device* dev);
+static int if_header(struct sk_buff* skb, struct net_device* dev,
 	unsigned short type, void* daddr, void* saddr, unsigned len);
 static int if_rebuild_hdr (struct sk_buff* skb);
-static int if_send (struct sk_buff* skb, netdevice_t* dev);
-static struct net_device_stats *if_stats (netdevice_t* dev);
+static int if_send(struct sk_buff* skb, struct net_device* dev);
+static struct net_device_stats *if_stats(struct net_device* dev);
 
-static void if_tx_timeout (netdevice_t *dev);
+static void if_tx_timeout(struct net_device *dev);
 
 /*=================================================  
  * 	Interrupt handlers 
@@ -373,8 +373,9 @@
 static void spur_intr	(sdla_t *);
 static void timer_intr  (sdla_t *);
 
-static int tx_intr_send(sdla_t *, netdevice_t *);
-static netdevice_t * move_dev_to_next (sdla_t *, netdevice_t *);
+static int tx_intr_send(sdla_t *card, struct net_device *dev);
+static struct net_device *move_dev_to_next(sdla_t *card,
+					   struct net_device *dev);
 
 /*=================================================  
  *	Background polling routines 
@@ -425,35 +426,41 @@
  */
 static int connect (sdla_t* card);
 static int disconnect (sdla_t* card);
-static netdevice_t* get_dev_by_lcn(wan_device_t* wandev, unsigned lcn);
-static int chan_connect (netdevice_t* dev);
-static int chan_disc (netdevice_t* dev);
-static void set_chan_state (netdevice_t* dev, int state);
-static int chan_send (netdevice_t* , void* , unsigned, unsigned char);
+static struct net_device* get_dev_by_lcn(struct wan_device* wandev,
+					 unsigned lcn);
+static int chan_connect(struct net_device* dev);
+static int chan_disc(struct net_device* dev);
+static void set_chan_state(struct net_device* dev, int state);
+static int chan_send(struct net_device *dev, void* buff, unsigned data_len,
+		     unsigned char tx_intr);
 static unsigned char bps_to_speed_code (unsigned long bps);
 static unsigned int dec_to_uint (unsigned char* str, int len);
 static unsigned int hex_to_uint (unsigned char*, int);
 static void parse_call_info (unsigned char*, x25_call_info_t*);
-static netdevice_t * find_channel(sdla_t *, unsigned);
-static void bind_lcn_to_dev (sdla_t *, netdevice_t *,unsigned);
-static void setup_for_delayed_transmit (netdevice_t*, void*, unsigned);
+static struct net_device *find_channel(sdla_t *card, unsigned lcn);
+static void bind_lcn_to_dev(sdla_t *card, struct net_device *dev, unsigned lcn);
+static void setup_for_delayed_transmit(struct net_device *dev,
+				       void *buf, unsigned len);
 
 
 /*=================================================  
  *      X25 API Functions 
  */
-static int wanpipe_pull_data_in_skb (sdla_t *, netdevice_t *, struct sk_buff **);
+static int wanpipe_pull_data_in_skb(sdla_t *card, struct net_device *dev,
+				    struct sk_buff **);
 static void timer_intr_exec(sdla_t *, unsigned char);
-static int execute_delayed_cmd (sdla_t*, netdevice_t *, mbox_cmd_t *,char);
+static int execute_delayed_cmd(sdla_t *card, struct net_device *dev,
+			       mbox_cmd_t *usr_cmd, char bad_cmd);
 static int api_incoming_call (sdla_t*, TX25Mbox *, int);
 static int alloc_and_init_skb_buf (sdla_t *,struct sk_buff **, int);
-static void send_delayed_cmd_result(sdla_t *, netdevice_t *dev, TX25Mbox*);
+static void send_delayed_cmd_result(sdla_t *card, struct net_device *dev,
+				    TX25Mbox* mbox);
 static int clear_confirm_event (sdla_t *, TX25Mbox*);
-static void send_oob_msg (sdla_t *, netdevice_t *, TX25Mbox *);
+static void send_oob_msg (sdla_t *card, struct net_device *dev, TX25Mbox *mbox);
 static int timer_intr_cmd_exec(sdla_t *card);
 static void api_oob_event (sdla_t *card,TX25Mbox *mbox);
-static int check_bad_command (sdla_t *, netdevice_t *);
-static int channel_disconnect (sdla_t*, netdevice_t *);
+static int check_bad_command(sdla_t *card, struct net_device *dev);
+static int channel_disconnect(sdla_t* card, struct net_device *dev);
 static void hdlc_link_down (sdla_t*);
 
 /*=================================================
@@ -464,7 +471,9 @@
 static int reply_udp( unsigned char *, unsigned int); 
 static void init_x25_channel_struct( x25_channel_t *);
 static void init_global_statistics( sdla_t *);
-static int store_udp_mgmt_pkt(int, char, sdla_t*, netdevice_t *, struct sk_buff *, int);
+static int store_udp_mgmt_pkt(int udp_type, char udp_pkt_src, sdla_t *card,
+			      struct net_device *dev,
+			      struct sk_buff *skb, int lcn);
 static unsigned short calc_checksum (char *, int);
 
 
@@ -830,7 +839,7 @@
  * 		<0	Failed (or busy).
  */
 
-static int update (wan_device_t* wandev)
+static int update(struct wan_device* wandev)
 {
 	volatile sdla_t* card;
 	TX25Status* status;
@@ -895,7 +904,8 @@
  * Return: 	0 	Ok
  *		<0 	Failed (channel will not be created)
  */
-static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf)
+static int new_if(struct wan_device* wandev, struct net_device* dev,
+		  wanif_conf_t* conf)
 {
 	sdla_t* card = wandev->private;
 	x25_channel_t* chan;
@@ -1029,7 +1039,7 @@
 
 //FIXME Del IF Should be taken out now.
 
-static int del_if (wan_device_t* wandev, netdevice_t* dev)
+static int del_if(struct wan_device* wandev, struct net_device* dev)
 {
 	return 0;
 }
@@ -1095,11 +1105,11 @@
  *
  * Return: 	0 	Ok : Void function.
  */
-static int if_init (netdevice_t* dev)
+static int if_init(struct net_device* dev)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
-	wan_device_t* wandev = &card->wandev;
+	struct wan_device* wandev = &card->wandev;
 
 	/* Initialize device driver entry points */
 	dev->open		= &if_open;
@@ -1167,7 +1177,7 @@
  * 		<0 	Failur: Interface will not come up.
  */
 
-static int if_open (netdevice_t* dev)
+static int if_open(struct net_device* dev)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -1260,7 +1270,7 @@
  * Return: 	0 	Ok
  * 		<0 	Failure: Interface will not exit properly.
  */
-static int if_close (netdevice_t* dev)
+static int if_close(struct net_device* dev)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -1318,8 +1328,9 @@
  * 	Return:		media header length.
  *======================================================================*/
 
-static int if_header (struct sk_buff* skb, netdevice_t* dev,
-	unsigned short type, void* daddr, void* saddr, unsigned len)
+static int if_header(struct sk_buff* skb, struct net_device* dev,
+		     unsigned short type, void* daddr, void* saddr,
+		     unsigned len)
 {
 	x25_channel_t* chan = dev->priv;
 	int hdr_len = dev->hard_header_len;
@@ -1344,7 +1355,7 @@
 
 static int if_rebuild_hdr (struct sk_buff* skb)
 {
-	netdevice_t *dev = skb->dev; 
+	struct net_device *dev = skb->dev; 
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
 
@@ -1357,7 +1368,7 @@
 /*============================================================================
  * Handle transmit timeout event from netif watchdog
  */
-static void if_tx_timeout (netdevice_t *dev)
+static void if_tx_timeout(struct net_device *dev)
 {
     	x25_channel_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -1394,7 +1405,7 @@
  *
  *========================================================================*/
 
-static int if_send (struct sk_buff* skb, netdevice_t* dev)
+static int if_send(struct sk_buff* skb, struct net_device* dev)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -1527,8 +1538,8 @@
  * interrupt.
  *===========================================================================*/
 
-static void setup_for_delayed_transmit (netdevice_t* dev, void* buf,
-	unsigned len)
+static void setup_for_delayed_transmit(struct net_device* dev, void* buf,
+				       unsigned len)
 {
         x25_channel_t* chan = dev->priv;
         sdla_t* card = chan->card;
@@ -1579,7 +1590,7 @@
  * 	Return a pointer to struct enet_statistics.
  *
  *==============================================================*/
-static struct net_device_stats *if_stats (netdevice_t* dev)
+static struct net_device_stats *if_stats(struct net_device* dev)
 {
 	x25_channel_t *chan = dev->priv;
 
@@ -1675,7 +1686,7 @@
 {
 	TX25Mbox* rxmb = card->rxmb;
 	unsigned lcn = rxmb->cmd.lcn;
-	netdevice_t* dev = find_channel(card,lcn);
+	struct net_device* dev = find_channel(card,lcn);
 	x25_channel_t* chan;
 	struct sk_buff* skb=NULL;
 
@@ -1773,7 +1784,8 @@
 }
 
 
-static int wanpipe_pull_data_in_skb (sdla_t *card, netdevice_t *dev, struct sk_buff **skb)
+static int wanpipe_pull_data_in_skb(sdla_t *card, struct net_device *dev,
+				    struct sk_buff **skb)
 {
 	void *bufptr;
 	TX25Mbox* rxmb = card->rxmb;
@@ -1883,7 +1895,7 @@
 
 static void tx_intr (sdla_t* card)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	TX25Status* status = card->flags;
 	unsigned char more_to_tx=0;
 	x25_channel_t *chan=NULL;
@@ -1977,14 +1989,13 @@
  *===============================================================*/
 
 
-netdevice_t * move_dev_to_next (sdla_t *card, netdevice_t *dev)
+struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev)
 {
 	if (card->u.x.no_dev != 1){
-		if (*((netdevice_t**)dev->priv) == NULL){
+		if (!*((struct net_device **)dev->priv))
 			return card->wandev.dev;
-		}else{
-			return *((netdevice_t**)dev->priv);
-		}
+		else
+			return *((struct net_device **)dev->priv);
 	}
 	return dev;
 }
@@ -1995,7 +2006,7 @@
  *
  *===============================================================*/
 
-static int tx_intr_send(sdla_t *card, netdevice_t *dev)
+static int tx_intr_send(sdla_t *card, struct net_device *dev)
 {
 	x25_channel_t* chan = dev->priv; 
 
@@ -2058,7 +2069,7 @@
 
 	}else if (card->u.x.timer_int_enabled & TMR_INT_ENABLED_POLL_ACTIVE) {
 
-		netdevice_t *dev = card->u.x.poll_device;
+		struct net_device *dev = card->u.x.poll_device;
 		x25_channel_t *chan = NULL;
 
 		if (!dev){
@@ -2079,7 +2090,7 @@
 
 		wanpipe_set_state(card, WAN_CONNECTED);
 		if (card->u.x.LAPB_hdlc){
-			netdevice_t *dev = card->wandev.dev;
+			struct net_device *dev = card->wandev.dev;
 			set_chan_state(dev,WAN_CONNECTED);
 			send_delayed_cmd_result(card,dev,card->mbox);	
 		}
@@ -2135,7 +2146,7 @@
 
 	TX25Mbox* mbox = card->mbox;
 	TX25ModemStatus *modem_status;
-	netdevice_t *dev;
+	struct net_device *dev;
 	x25_channel_t *chan;
 	int err;
 
@@ -2164,7 +2175,8 @@
 				mbox->cmd.result = 0x08;
 
 				/* Send a OOB to all connected sockets */
-				for (dev = card->wandev.dev; dev; dev = *((netdevice_t**)dev->priv)){
+				for (dev = card->wandev.dev; dev;
+				     dev = *((struct net_device**)dev->priv)) {
 					chan=dev->priv;
 					if (chan->common.usedby == API){
 						send_oob_msg(card,dev,mbox);				
@@ -2294,7 +2306,7 @@
 
 static void poll_disconnected (sdla_t* card)
 {
-	netdevice_t *dev; 
+	struct net_device *dev; 
 	x25_channel_t *chan;
 	TX25Status* status = card->flags;
 
@@ -2331,10 +2343,11 @@
 
 static void poll_active (sdla_t* card)
 {
-	netdevice_t* dev;
+	struct net_device* dev;
 	TX25Status* status = card->flags;
 
-	for (dev = card->wandev.dev; dev; dev = *((netdevice_t**)dev->priv)){
+	for (dev = card->wandev.dev; dev;
+	     dev = *((struct net_device **)dev->priv)){
 		x25_channel_t* chan = dev->priv;
 
 		/* If SVC has been idle long enough, close virtual circuit */
@@ -3101,9 +3114,9 @@
 
 static int incoming_call (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
 {
-	wan_device_t* wandev = &card->wandev;
+	struct wan_device* wandev = &card->wandev;
 	int new_lcn = mb->cmd.lcn;
-	netdevice_t* dev = get_dev_by_lcn(wandev, new_lcn);
+	struct net_device* dev = get_dev_by_lcn(wandev, new_lcn);
 	x25_channel_t* chan = NULL;
 	int accept = 0;		/* set to '1' if o.k. to accept call */
 	unsigned int user_data;
@@ -3155,7 +3168,7 @@
 	user_data = hex_to_uint(info->user,2);
 
 	/* Find available channel */
-	for (dev = wandev->dev; dev; dev = *((netdevice_t**)dev->priv)){
+	for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv)) {
 		chan = dev->priv;
 
 		if (chan->common.usedby == API)
@@ -3252,7 +3265,7 @@
 static int call_accepted (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
 {
 	unsigned new_lcn = mb->cmd.lcn;
-	netdevice_t* dev = find_channel(card, new_lcn);
+	struct net_device* dev = find_channel(card, new_lcn);
 	x25_channel_t* chan;
 
 	if (dev == NULL){
@@ -3292,7 +3305,7 @@
 static int call_cleared (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
 {
 	unsigned new_lcn = mb->cmd.lcn;
-	netdevice_t* dev = find_channel(card, new_lcn);
+	struct net_device* dev = find_channel(card, new_lcn);
 	x25_channel_t *chan;
 	unsigned char old_state;
 
@@ -3336,8 +3349,8 @@
 
 static int restart_event (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
 {
-	wan_device_t* wandev = &card->wandev;
-	netdevice_t* dev;
+	struct wan_device* wandev = &card->wandev;
+	struct net_device* dev;
 	x25_channel_t *chan;
 	unsigned char old_state;
 
@@ -3346,7 +3359,7 @@
 		card->devname, mb->cmd.cause, mb->cmd.diagn);
 
 	/* down all logical channels */
-	for (dev = wandev->dev; dev; dev = *((netdevice_t**)dev->priv)){
+	for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv)) {
 		chan=dev->priv;
 		old_state = chan->common.state;
 
@@ -3377,7 +3390,7 @@
 
 	if (mb->cmd.pktType == 0x05)	/* call request time out */
 	{
-		netdevice_t* dev = find_channel(card,new_lcn);
+		struct net_device* dev = find_channel(card,new_lcn);
 
 		printk(KERN_INFO "%s: X.25 call timed timeout on LCN %d!\n",
 			card->devname, new_lcn);
@@ -3447,11 +3460,12 @@
  * Find network device by its channel number.
  */
 
-static netdevice_t* get_dev_by_lcn (wan_device_t* wandev, unsigned lcn)
+static struct net_device* get_dev_by_lcn(struct wan_device* wandev,
+					 unsigned lcn)
 {
-	netdevice_t* dev;
+	struct net_device* dev;
 
-	for (dev = wandev->dev; dev; dev = *((netdevice_t**)dev->priv))
+	for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv))
 		if (((x25_channel_t*)dev->priv)->common.lcn == lcn) 
 			break;
 	return dev;
@@ -3467,7 +3481,7 @@
  *			<0	failure
  */
 
-static int chan_connect (netdevice_t* dev)
+static int chan_connect(struct net_device* dev)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -3500,7 +3514,7 @@
  * 	o if SVC then clear X.25 call
  */
 
-static int chan_disc (netdevice_t* dev)
+static int chan_disc(struct net_device* dev)
 {
 	x25_channel_t* chan = dev->priv;
 
@@ -3523,7 +3537,7 @@
  * 	Set logical channel state.
  */
 
-static void set_chan_state (netdevice_t* dev, int state)
+static void set_chan_state(struct net_device* dev, int state)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -3613,7 +3627,8 @@
  *    	to the router.
  */
 
-static int chan_send (netdevice_t* dev, void* buff, unsigned data_len, unsigned char tx_intr)
+static int chan_send(struct net_device* dev, void* buff, unsigned data_len,
+		     unsigned char tx_intr)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -4080,7 +4095,7 @@
  *===============================================================*/
 
 
-netdevice_t * find_channel(sdla_t *card, unsigned lcn)
+struct net_device *find_channel(sdla_t *card, unsigned lcn)
 {
 	if (card->u.x.LAPB_hdlc){
 
@@ -4127,7 +4142,7 @@
 	}
 }
 
-void bind_lcn_to_dev (sdla_t *card, netdevice_t *dev,unsigned lcn)
+void bind_lcn_to_dev(sdla_t *card, struct net_device *dev, unsigned lcn)
 {
 	x25_channel_t *chan = dev->priv;
 
@@ -4154,7 +4169,7 @@
  *
  *==============================================================*/
 
-static void x25api_bh (netdevice_t * dev)
+static void x25api_bh(struct net_device* dev)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t* card = chan->card;
@@ -4230,7 +4245,7 @@
  *
  *==============================================================*/
 
-static int x25api_bh_cleanup (netdevice_t *dev)
+static int x25api_bh_cleanup(struct net_device *dev)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -4269,7 +4284,7 @@
  *
  *==============================================================*/
 
-static int bh_enqueue (netdevice_t *dev, struct sk_buff *skb)
+static int bh_enqueue(struct net_device *dev, struct sk_buff *skb)
 {
 	x25_channel_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -4309,7 +4324,7 @@
 
 static int timer_intr_cmd_exec (sdla_t* card)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	unsigned char more_to_exec=0;
 	volatile x25_channel_t *chan=NULL;
 	int i=0,bad_cmd=0,err=0;	
@@ -4436,7 +4451,8 @@
  *
  *===============================================================*/
 
-static int execute_delayed_cmd (sdla_t* card, netdevice_t *dev, mbox_cmd_t *usr_cmd,char bad_cmd)
+static int execute_delayed_cmd(sdla_t* card, struct net_device *dev,
+			       mbox_cmd_t *usr_cmd, char bad_cmd)
 {
 	TX25Mbox* mbox = card->mbox;
 	int err;
@@ -4669,7 +4685,8 @@
  *      the result to a waiting sock. 
  *
  *===============================================================*/
-static void send_delayed_cmd_result(sdla_t *card, netdevice_t *dev, TX25Mbox* mbox)
+static void send_delayed_cmd_result(sdla_t *card, struct net_device *dev,
+				    TX25Mbox* mbox)
 {
 	x25_channel_t *chan = dev->priv;
 	mbox_cmd_t *usr_cmd = (mbox_cmd_t *)chan->common.mbox;
@@ -4724,7 +4741,7 @@
 
 static int clear_confirm_event (sdla_t *card, TX25Mbox* mb)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	x25_channel_t *chan;
 	unsigned char old_state;	
 
@@ -4772,7 +4789,7 @@
  *
  *===============================================================*/
 
-static void send_oob_msg (sdla_t *card, netdevice_t *dev, TX25Mbox *mbox)
+static void send_oob_msg(sdla_t *card, struct net_device *dev, TX25Mbox *mbox)
 {
 	x25_channel_t *chan = dev->priv;
 	mbox_cmd_t *usr_cmd = (mbox_cmd_t *)chan->common.mbox;
@@ -4870,7 +4887,7 @@
 
 static void api_oob_event (sdla_t *card,TX25Mbox *mbox)
 {
-	netdevice_t *dev = find_channel(card,mbox->cmd.lcn);
+	struct net_device *dev = find_channel(card, mbox->cmd.lcn);
 	x25_channel_t *chan;
 
 	if (!dev)
@@ -4886,7 +4903,7 @@
 
 
 
-static int channel_disconnect (sdla_t* card, netdevice_t *dev)
+static int channel_disconnect(sdla_t* card, struct net_device *dev)
 {
 
 	int err;
@@ -4960,7 +4977,7 @@
 	
 }
 
-static int check_bad_command (sdla_t* card, netdevice_t *dev)
+static int check_bad_command(sdla_t* card, struct net_device *dev)
 {
 	x25_channel_t *chan = dev->priv;
 	int bad_cmd = 0;
@@ -5013,7 +5030,7 @@
 	TX25Mbox       *mbox = card->mbox;
 	int            err;
 	int            udp_mgmt_req_valid = 1;
-	netdevice_t  *dev;
+	struct net_device *dev;
         x25_channel_t  *chan;
 	unsigned short lcn;
 	struct timeval tv;
@@ -5337,7 +5354,8 @@
  */
 
 static int store_udp_mgmt_pkt(int udp_type, char udp_pkt_src, sdla_t* card,
-                                netdevice_t *dev, struct sk_buff *skb, int lcn)
+			      struct net_device *dev, struct sk_buff *skb,
+			      int lcn)
 {
         int udp_pkt_stored = 0;
 
diff -urN linux-2.5.69-bk12/drivers/net/wan/sdlamain.c linux-2.5.69-bk13/drivers/net/wan/sdlamain.c
--- linux-2.5.69-bk12/drivers/net/wan/sdlamain.c	2003-05-04 16:53:36.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/sdlamain.c	2003-05-18 04:45:50.000000000 -0700
@@ -64,8 +64,6 @@
 #include <linux/sdlapci.h>
 #include <linux/if_wanpipe_common.h>
 
-#define netdevice_t struct net_device
-
 #include <asm/uaccess.h>	/* kernel <-> user copy */
 #include <linux/inetdevice.h>
 
@@ -184,9 +182,9 @@
 void cleanup_module (void);
 
 /* WAN link driver entry points */
-static int setup    (wan_device_t* wandev, wandev_conf_t* conf);
-static int shutdown (wan_device_t* wandev);
-static int ioctl    (wan_device_t* wandev, unsigned cmd, unsigned long arg);
+static int setup(struct wan_device* wandev, wandev_conf_t* conf);
+static int shutdown(struct wan_device* wandev);
+static int ioctl(struct wan_device* wandev, unsigned cmd, unsigned long arg);
 
 /* IOCTL handlers */
 static int ioctl_dump	(sdla_t* card, sdla_dump_t* u_dump);
@@ -279,7 +277,7 @@
 	/* Register adapters with WAN router */
 	for (cnt = 0; cnt < ncards; ++ cnt) {
 		sdla_t* card = &card_array[cnt];
-		wan_device_t* wandev = &card->wandev;
+		struct wan_device* wandev = &card->wandev;
 
 		card->next = NULL;
 		sprintf(card->devname, "%s%d", drvname, cnt + 1);
@@ -352,7 +350,7 @@
  * any).
  */
  
-static int setup (wan_device_t* wandev, wandev_conf_t* conf)
+static int setup(struct wan_device* wandev, wandev_conf_t* conf)
 {
 	sdla_t* card;
 	int err = 0;
@@ -779,7 +777,7 @@
  * This function is called by the router when device is being unregistered or
  * when it handles ROUTER_DOWN IOCTL.
  */
-static int shutdown (wan_device_t* wandev)
+static int shutdown(struct wan_device* wandev)
 {
 	sdla_t *card;
 	int err=0;
@@ -888,7 +886,7 @@
  * This function is called when router handles one of the reserved user
  * IOCTLs.  Note that 'arg' stil points to user address space.
  */
-static int ioctl (wan_device_t* wandev, unsigned cmd, unsigned long arg)
+static int ioctl(struct wan_device* wandev, unsigned cmd, unsigned long arg)
 {
 	sdla_t* card;
 	int err;
@@ -1255,7 +1253,7 @@
 	}
 } 
 
-void wakeup_sk_bh (netdevice_t *dev)
+void wakeup_sk_bh(struct net_device *dev)
 {
 	wanpipe_common_t *chan = dev->priv;
 
@@ -1268,7 +1266,7 @@
 	}
 }
 
-int change_dev_flags (netdevice_t *dev, unsigned flags)
+int change_dev_flags(struct net_device *dev, unsigned flags)
 {
 	struct ifreq if_info;
 	mm_segment_t fs = get_fs();
@@ -1285,7 +1283,7 @@
 	return err;
 }
 
-unsigned long get_ip_address (netdevice_t *dev, int option)
+unsigned long get_ip_address(struct net_device *dev, int option)
 {
 	
 	struct in_ifaddr *ifaddr;
@@ -1323,7 +1321,7 @@
 	return 0;
 }	
 
-void add_gateway(sdla_t *card, netdevice_t *dev)
+void add_gateway(sdla_t *card, struct net_device *dev)
 {
 	mm_segment_t oldfs;
 	struct rtentry route;
diff -urN linux-2.5.69-bk12/drivers/net/wan/wanpipe_multppp.c linux-2.5.69-bk13/drivers/net/wan/wanpipe_multppp.c
--- linux-2.5.69-bk12/drivers/net/wan/wanpipe_multppp.c	2003-05-04 16:53:57.000000000 -0700
+++ linux-2.5.69-bk13/drivers/net/wan/wanpipe_multppp.c	2003-05-18 04:45:50.000000000 -0700
@@ -130,19 +130,19 @@
 
 /****** Function Prototypes *************************************************/
 /* WAN link driver entry points. These are called by the WAN router module. */
-static int update (wan_device_t* wandev);
-static int new_if (wan_device_t* wandev, netdevice_t* dev,
-	wanif_conf_t* conf);
-static int del_if (wan_device_t* wandev, netdevice_t* dev);
+static int update(struct wan_device* wandev);
+static int new_if(struct wan_device* wandev, struct net_device* dev,
+		  wanif_conf_t* conf);
+static int del_if(struct wan_device* wandev, struct net_device* dev);
 
 /* Network device interface */
-static int if_init   (netdevice_t* dev);
-static int if_open   (netdevice_t* dev);
-static int if_close  (netdevice_t* dev);
-static int if_send (struct sk_buff* skb, netdevice_t* dev);
-static struct net_device_stats* if_stats (netdevice_t* dev);
+static int if_init(struct net_device* dev);
+static int if_open(struct net_device* dev);
+static int if_close(struct net_device* dev);
+static int if_send(struct sk_buff* skb, struct net_device* dev);
+static struct net_device_stats* if_stats(struct net_device* dev);
 
-static void if_tx_timeout (netdevice_t *dev);
+static void if_tx_timeout(struct net_device *dev);
 
 /* CHDLC Firmware interface functions */
 static int chdlc_configure 	(sdla_t* card, void* data);
@@ -158,7 +158,7 @@
 
 /* Miscellaneous CHDLC Functions */
 static int set_chdlc_config (sdla_t* card);
-static void init_chdlc_tx_rx_buff( sdla_t* card, netdevice_t *dev );
+static void init_chdlc_tx_rx_buff(sdla_t* card, struct net_device *dev);
 static int chdlc_error (sdla_t *card, int err, CHDLC_MAILBOX_STRUCT *mb);
 static int process_chdlc_exception(sdla_t *card);
 static int process_global_exception(sdla_t *card);
@@ -176,14 +176,14 @@
 static int intr_test( sdla_t* card);
 static int udp_pkt_type( struct sk_buff *skb , sdla_t* card);
 static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
-                                struct sk_buff *skb, netdevice_t* dev,
-                                chdlc_private_area_t* chdlc_priv_area);
-static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev,  
+			      struct sk_buff *skb, struct net_device* dev,
+			      chdlc_private_area_t* chdlc_priv_area);
+static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev,  
 				chdlc_private_area_t* chdlc_priv_area);
 static unsigned short calc_checksum (char *, int);
 static void s508_lock (sdla_t *card, unsigned long *smp_flags);
 static void s508_unlock (sdla_t *card, unsigned long *smp_flags);
-static void send_ppp_term_request (netdevice_t*);
+static void send_ppp_term_request(struct net_device *dev);
 
 
 static int  Intr_test_counter;
@@ -456,10 +456,10 @@
  * as to minimize the time that we are inside the interrupt handler.
  *
  */
-static int update (wan_device_t* wandev)
+static int update(struct wan_device* wandev)
 {
 	sdla_t* card = wandev->private;
- 	netdevice_t* dev;
+ 	struct net_device* dev;
         volatile chdlc_private_area_t* chdlc_priv_area;
         SHARED_MEMORY_INFO_STRUCT *flags;
 	unsigned long timeout;
@@ -522,11 +522,12 @@
  * Return:	0	o.k.
  *		< 0	failure (channel will not be created)
  */
-static int new_if (wan_device_t* wandev, netdevice_t* pdev, wanif_conf_t* conf)
+static int new_if(struct wan_device* wandev, struct net_device* pdev,
+		  wanif_conf_t* conf)
 {
 
 	struct ppp_device *pppdev = (struct ppp_device *)pdev;
-	netdevice_t *dev=NULL;
+	struct net_device *dev = NULL;
 	struct sppp *sp;
 	sdla_t* card = wandev->private;
 	chdlc_private_area_t* chdlc_priv_area;
@@ -616,7 +617,7 @@
 /*============================================================================
  * Delete logical channel.
  */
-static int del_if (wan_device_t* wandev, netdevice_t* dev)
+static int del_if(struct wan_device* wandev, struct net_device* dev)
 {
 	chdlc_private_area_t *chdlc_priv_area = dev->priv;
 	sdla_t *card = chdlc_priv_area->card;
@@ -651,11 +652,11 @@
  * interface registration.  Returning anything but zero will fail interface
  * registration.
  */
-static int if_init (netdevice_t* dev)
-	{
+static int if_init(struct net_device* dev)
+{
 	chdlc_private_area_t* chdlc_priv_area = dev->priv;
 	sdla_t* card = chdlc_priv_area->card;
-	wan_device_t* wandev = &card->wandev;
+	struct wan_device* wandev = &card->wandev;
 	
 	/* NOTE: Most of the dev initialization was
          *       done in sppp_attach(), called by new_if() 
@@ -694,7 +695,7 @@
 /*============================================================================
  * Handle transmit timeout event from netif watchdog
  */
-static void if_tx_timeout (netdevice_t *dev)
+static void if_tx_timeout(struct net_device *dev)
 {
     	chdlc_private_area_t* chan = dev->priv;
 	sdla_t *card = chan->card;
@@ -719,7 +720,7 @@
  *
  * Return 0 if O.k. or errno.
  */
-static int if_open (netdevice_t* dev)
+static int if_open(struct net_device* dev)
 {
 	chdlc_private_area_t* chdlc_priv_area = dev->priv;
 	sdla_t* card = chdlc_priv_area->card;
@@ -752,7 +753,7 @@
  * o if this is the last close, then disable communications and interrupts.
  * o reset flags.
  */
-static int if_close (netdevice_t* dev)
+static int if_close(struct net_device* dev)
 {
 	chdlc_private_area_t* chdlc_priv_area = dev->priv;
 	sdla_t* card = chdlc_priv_area->card;
@@ -783,7 +784,7 @@
  * 2. Setting tbusy flag will inhibit further transmit requests from the
  *    protocol stack and can be used for flow control with protocol layer.
  */
-static int if_send (struct sk_buff* skb, netdevice_t* dev)
+static int if_send(struct sk_buff* skb, struct net_device* dev)
 {
 	chdlc_private_area_t *chdlc_priv_area = dev->priv;
 	sdla_t *card = chdlc_priv_area->card;
@@ -973,7 +974,7 @@
  * Get ethernet-style interface statistics.
  * Return a pointer to struct enet_statistics.
  */
-static struct net_device_stats* if_stats (netdevice_t* dev)
+static struct net_device_stats* if_stats(struct net_device* dev)
 {
 	sdla_t *my_card;
 	chdlc_private_area_t* chdlc_priv_area;
@@ -1242,7 +1243,7 @@
  */
 STATIC void wsppp_isr (sdla_t* card)
 {
-	netdevice_t* dev;
+	struct net_device* dev;
 	SHARED_MEMORY_INFO_STRUCT* flags = NULL;
 	int i;
 	sdla_t *my_card;
@@ -1355,7 +1356,7 @@
  */
 static void rx_intr (sdla_t* card)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	chdlc_private_area_t *chdlc_priv_area;
 	SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
 	CHDLC_DATA_RX_STATUS_EL_STRUCT *rxbuf = card->u.c.rxmb;
@@ -1477,7 +1478,7 @@
  */
 void timer_intr(sdla_t *card)
 {
-        netdevice_t* dev;
+        struct net_device* dev;
         chdlc_private_area_t* chdlc_priv_area = NULL;
         SHARED_MEMORY_INFO_STRUCT* flags = NULL;
 
@@ -1665,8 +1666,8 @@
  */
 
 static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
-                                struct sk_buff *skb, netdevice_t* dev,
-                                chdlc_private_area_t* chdlc_priv_area )
+			      struct sk_buff *skb, struct net_device* dev,
+			      chdlc_private_area_t* chdlc_priv_area )
 {
 	int udp_pkt_stored = 0;
 
@@ -1692,7 +1693,7 @@
  * Process UDP management packet.
  */
 
-static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev,
+static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev,
 				chdlc_private_area_t* chdlc_priv_area ) 
 {
 	unsigned char *buf;
@@ -2076,7 +2077,7 @@
  * Initialize Receive and Transmit Buffers.
  */
 
-static void init_chdlc_tx_rx_buff( sdla_t* card, netdevice_t *dev )
+static void init_chdlc_tx_rx_buff(sdla_t* card, struct net_device *dev)
 {
 	CHDLC_MAILBOX_STRUCT* mb = card->mbox;
 	CHDLC_TX_STATUS_EL_CFG_STRUCT *tx_config;
@@ -2213,7 +2214,7 @@
  */
 static void port_set_state (sdla_t *card, int state)
 {
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	chdlc_private_area_t *chdlc_priv_area = dev->priv;
 
         if (card->u.c.state != state)
@@ -2284,7 +2285,7 @@
 
 static int config_chdlc (sdla_t *card)
 {
-	netdevice_t *dev = card->wandev.dev;
+	struct net_device *dev = card->wandev.dev;
 	SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
 
 	if (card->u.c.comm_enabled){
@@ -2330,7 +2331,7 @@
 }
 
 
-static void send_ppp_term_request (netdevice_t *dev)
+static void send_ppp_term_request(struct net_device *dev)
 {
 	struct sk_buff *new_skb;
 	unsigned char *buf;
diff -urN linux-2.5.69-bk12/drivers/telephony/phonedev.c linux-2.5.69-bk13/drivers/telephony/phonedev.c
--- linux-2.5.69-bk12/drivers/telephony/phonedev.c	2003-05-04 16:53:32.000000000 -0700
+++ linux-2.5.69-bk13/drivers/telephony/phonedev.c	2003-05-18 04:45:52.000000000 -0700
@@ -59,11 +59,8 @@
 	if (p)
 		new_fops = fops_get(p->f_op);
 	if (!new_fops) {
-		char modname[32];
-
 		up(&phone_lock);
-		sprintf(modname, "char-major-%d-%d", PHONE_MAJOR, minor);
-		request_module(modname);
+		request_module("char-major-%d-%d", PHONE_MAJOR, minor);
 		down(&phone_lock);
 		p = phone_device[minor];
 		if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL)
diff -urN linux-2.5.69-bk12/drivers/usb/misc/speedtch.c linux-2.5.69-bk13/drivers/usb/misc/speedtch.c
--- linux-2.5.69-bk12/drivers/usb/misc/speedtch.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/drivers/usb/misc/speedtch.c	2003-05-18 04:45:53.000000000 -0700
@@ -952,19 +952,15 @@
 		return -EAGAIN;
 	}
 
-	MOD_INC_USE_COUNT;
-
 	down (&instance->serialize); /* vs self, udsl_atm_close */
 
 	if (udsl_find_vcc (instance, vpi, vci)) {
 		up (&instance->serialize);
-		MOD_DEC_USE_COUNT;
 		return -EADDRINUSE;
 	}
 
 	if (!(new = kmalloc (sizeof (struct udsl_vcc_data), GFP_KERNEL))) {
 		up (&instance->serialize);
-		MOD_DEC_USE_COUNT;
 		return -ENOMEM;
 	}
 
@@ -1034,8 +1030,6 @@
 
 	up (&instance->serialize);
 
-	MOD_DEC_USE_COUNT;
-
 	dbg ("udsl_atm_close successful");
 }
 
diff -urN linux-2.5.69-bk12/drivers/video/fbmem.c linux-2.5.69-bk13/drivers/video/fbmem.c
--- linux-2.5.69-bk12/drivers/video/fbmem.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/drivers/video/fbmem.c	2003-05-18 04:45:53.000000000 -0700
@@ -839,10 +839,7 @@
 #ifdef CONFIG_KMOD
 static void try_to_load(int fb)
 {
-	char modname[16];
-
-	sprintf(modname, "fb%d", fb);
-	request_module(modname);
+	request_module("fb%d", fb);
 }
 #endif /* CONFIG_KMOD */
 
diff -urN linux-2.5.69-bk12/fs/char_dev.c linux-2.5.69-bk13/fs/char_dev.c
--- linux-2.5.69-bk12/fs/char_dev.c	2003-05-04 16:53:09.000000000 -0700
+++ linux-2.5.69-bk13/fs/char_dev.c	2003-05-18 04:45:53.000000000 -0700
@@ -102,9 +102,7 @@
 
 #ifdef CONFIG_KMOD
 	if (!ret) {
-		char name[32];
-		sprintf(name, "char-major-%d", major);
-		request_module(name);
+		request_module("char-major-%d", major);
 
 		read_lock(&chrdevs_lock);
 		ret = lookup_chrfops(major, minor);
diff -urN linux-2.5.69-bk12/fs/exec.c linux-2.5.69-bk13/fs/exec.c
--- linux-2.5.69-bk12/fs/exec.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/fs/exec.c	2003-05-18 04:45:53.000000000 -0700
@@ -1034,14 +1034,12 @@
 #ifdef CONFIG_KMOD
 		}else{
 #define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
-			char modname[20];
 			if (printable(bprm->buf[0]) &&
 			    printable(bprm->buf[1]) &&
 			    printable(bprm->buf[2]) &&
 			    printable(bprm->buf[3]))
 				break; /* -ENOEXEC */
-			sprintf(modname, "binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
-			request_module(modname);
+			request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
 #endif
 		}
 	}
diff -urN linux-2.5.69-bk12/fs/filesystems.c linux-2.5.69-bk13/fs/filesystems.c
--- linux-2.5.69-bk12/fs/filesystems.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/fs/filesystems.c	2003-05-18 04:45:53.000000000 -0700
@@ -279,7 +279,7 @@
 	if (fs && !try_module_get(fs->owner))
 		fs = NULL;
 	read_unlock(&file_systems_lock);
-	if (!fs && (request_module(name) == 0)) {
+	if (!fs && (request_module("%s", name) == 0)) {
 		read_lock(&file_systems_lock);
 		fs = *(find_filesystem(name));
 		if (fs && !try_module_get(fs->owner))
diff -urN linux-2.5.69-bk12/fs/nls/nls_base.c linux-2.5.69-bk13/fs/nls/nls_base.c
--- linux-2.5.69-bk12/fs/nls/nls_base.c	2003-05-04 16:53:32.000000000 -0700
+++ linux-2.5.69-bk13/fs/nls/nls_base.c	2003-05-18 04:45:53.000000000 -0700
@@ -217,7 +217,6 @@
 {
 	struct nls_table *nls;
 #ifdef CONFIG_KMOD
-	char buf[40];
 	int ret;
 #endif
 
@@ -226,14 +225,7 @@
 		return nls;
 
 #ifdef CONFIG_KMOD
-	if (strlen(charset) > sizeof(buf) - sizeof("nls_")) {
-		printk("Unable to load NLS charset %s: name too long\n",
-			charset);
-		return NULL;
-	}
-		
-	sprintf(buf, "nls_%s", charset);
-	ret = request_module(buf);
+	ret = request_module("nls_%s", charset);
 	if (ret != 0) {
 		printk("Unable to load NLS charset %s\n", charset);
 		return NULL;
diff -urN linux-2.5.69-bk12/fs/reiserfs/prints.c linux-2.5.69-bk13/fs/reiserfs/prints.c
--- linux-2.5.69-bk12/fs/reiserfs/prints.c	2003-05-04 16:53:32.000000000 -0700
+++ linux-2.5.69-bk13/fs/reiserfs/prints.c	2003-05-18 04:45:53.000000000 -0700
@@ -164,7 +164,7 @@
 
   *skip = 0;
   
-  while ((k = strstr (k, "%")) != NULL)
+  while ((k = strchr (k, '%')) != NULL)
   {
     if (k[1] == 'k' || k[1] == 'K' || k[1] == 'h' || k[1] == 't' ||
 	      k[1] == 'z' || k[1] == 'b' || k[1] == 'y' || k[1] == 'a' ) {
diff -urN linux-2.5.69-bk12/include/linux/atmdev.h linux-2.5.69-bk13/include/linux/atmdev.h
--- linux-2.5.69-bk12/include/linux/atmdev.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/atmdev.h	2003-05-18 04:45:54.000000000 -0700
@@ -331,6 +331,8 @@
 	struct k_atm_dev_stats stats;	/* statistics */
 	char		signal;		/* signal status (ATM_PHY_SIG_*) */
 	int		link_rate;	/* link rate (default: OC3) */
+	atomic_t	refcnt;		/* reference count */
+	spinlock_t	lock;		/* protect internal members */
 #ifdef CONFIG_PROC_FS
 	struct proc_dir_entry *proc_entry; /* proc entry */
 	char *proc_name;		/* proc entry name */
@@ -392,7 +394,7 @@
 
 struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
     int number,unsigned long *flags); /* number == -1: pick first available */
-struct atm_dev *atm_find_dev(int number);
+struct atm_dev *atm_dev_lookup(int number);
 void atm_dev_deregister(struct atm_dev *dev);
 void shutdown_atm_dev(struct atm_dev *dev);
 void bind_vcc(struct atm_vcc *vcc,struct atm_dev *dev);
@@ -403,30 +405,46 @@
  *
  */
 
-static __inline__ int atm_guess_pdu2truesize(int pdu_size)
+static inline int atm_guess_pdu2truesize(int pdu_size)
 {
 	return ((pdu_size+15) & ~15) + sizeof(struct sk_buff);
 }
 
 
-static __inline__ void atm_force_charge(struct atm_vcc *vcc,int truesize)
+static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
 {
 	atomic_add(truesize, &vcc->sk->rmem_alloc);
 }
 
 
-static __inline__ void atm_return(struct atm_vcc *vcc,int truesize)
+static inline void atm_return(struct atm_vcc *vcc,int truesize)
 {
 	atomic_sub(truesize, &vcc->sk->rmem_alloc);
 }
 
 
-static __inline__ int atm_may_send(struct atm_vcc *vcc,unsigned int size)
+static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size)
 {
 	return (size + atomic_read(&vcc->sk->wmem_alloc)) < vcc->sk->sndbuf;
 }
 
 
+static inline void atm_dev_hold(struct atm_dev *dev)
+{
+	atomic_inc(&dev->refcnt);
+}
+
+
+static inline void atm_dev_release(struct atm_dev *dev)
+{
+	atomic_dec(&dev->refcnt);
+
+	if ((atomic_read(&dev->refcnt) == 1) &&
+	    test_bit(ATM_DF_CLOSE,&dev->flags))
+		shutdown_atm_dev(dev);
+}
+
+
 int atm_charge(struct atm_vcc *vcc,int truesize);
 struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
     int gfp_flags);
diff -urN linux-2.5.69-bk12/include/linux/cyclomx.h linux-2.5.69-bk13/include/linux/cyclomx.h
--- linux-2.5.69-bk12/include/linux/cyclomx.h	2003-05-04 16:53:29.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/cyclomx.h	2003-05-18 04:45:54.000000000 -0700
@@ -1,10 +1,12 @@
+#ifndef	_CYCLOMX_H
+#define	_CYCLOMX_H
 /*
 * cyclomx.h	Cyclom 2X WAN Link Driver.
 *		User-level API definitions.
 *
 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
 *
-* Copyright:	(c) 1998-2000 Arnaldo Carvalho de Melo
+* Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
 *
 * Based on wanpipe.h by Gene Kozin <genek@compuserve.com>
 *
@@ -21,8 +23,6 @@
 * 1998/12/27	acme		cleanup: PACKED not needed
 * 1998/08/08	acme		Version 0.0.1
 */
-#ifndef	_CYCLOMX_H
-#define	_CYCLOMX_H
 
 #include <linux/config.h>
 #include <linux/wanrouter.h>
@@ -43,19 +43,18 @@
  * This structure is needed because we handle multiple cards, otherwise
  * static data would do it.
  */
-typedef struct cycx {
-	char devname[WAN_DRVNAME_SZ+1];	/* card name */
-	cycxhw_t hw;			/* hardware configuration */
-	wan_device_t wandev;		/* WAN device data space */
-	u32 open_cnt;			/* number of open interfaces */
+struct cycx_device {
+	char devname[WAN_DRVNAME_SZ + 1];/* card name */
+	struct cycx_hw hw;		/* hardware configuration */
+	struct wan_device wandev;	/* WAN device data space */
 	u32 state_tick;			/* link state timestamp */
 	spinlock_t lock;
 	char in_isr;			/* interrupt-in-service flag */
 	char buff_int_mode_unbusy;      /* flag for carrying out dev_tint */
 	wait_queue_head_t wait_stats;  /* to wait for the STATS indication */
 	u32 mbox;			/* -> mailbox */
-	void (*isr)(struct cycx* card);	/* interrupt service routine */
-	int (*exec)(struct cycx* card, void* u_cmd, void* u_data);
+	void (*isr)(struct cycx_device* card);	/* interrupt service routine */
+	int (*exec)(struct cycx_device* card, void* u_cmd, void* u_data);
 	union {
 #ifdef CONFIG_CYCLOMX_X25
 		struct { /* X.25 specific data */
@@ -63,21 +62,19 @@
 			u32 hi_pvc;
 			u32 lo_svc;
 			u32 hi_svc;
-			TX25Stats stats;
+			struct cycx_x25_stats stats;
 			spinlock_t lock;
 			u32 connection_keys;
 		} x;
 #endif
 	} u;
-} cycx_t;
+};
 
 /* Public Functions */
-void cyclomx_mod_inc_use_count (cycx_t *card);		/* cycx_main.c */
-void cyclomx_mod_dec_use_count (cycx_t *card);		/* cycx_main.c */
-void cyclomx_set_state (cycx_t *card, int state);	/* cycx_main.c */
+void cyclomx_set_state(struct cycx_device *card, int state);
 
 #ifdef CONFIG_CYCLOMX_X25
-int cyx_init (cycx_t *card, wandev_conf_t *conf);	/* cycx_x25.c */
+int cyx_init(struct cycx_device *card, wandev_conf_t *conf);
 #endif
 #endif	/* __KERNEL__ */
 #endif	/* _CYCLOMX_H */
diff -urN linux-2.5.69-bk12/include/linux/cycx_cfm.h linux-2.5.69-bk13/include/linux/cycx_cfm.h
--- linux-2.5.69-bk12/include/linux/cycx_cfm.h	2003-05-04 16:53:00.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/cycx_cfm.h	2003-05-18 04:45:54.000000000 -0700
@@ -4,7 +4,7 @@
 *
 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
 *
-* Copyright:	(c) 1998-2000 Arnaldo Carvalho de Melo
+* Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
 *
 * Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com>
 *
@@ -45,38 +45,57 @@
 
 #define	CFID_X25_2X	5200
 
-/* Data Types */
+/**
+ *	struct cycx_fw_info - firmware module information.
+ *	@codeid - firmware ID
+ *	@version - firmware version number
+ *	@adapter - compatible adapter types
+ *	@memsize - minimum memory size
+ *	@reserved - reserved
+ *	@startoffs - entry point offset
+ *	@winoffs - dual-port memory window offset
+ *	@codeoffs - code load offset
+ *	@codesize - code size
+ *	@dataoffs - configuration data load offset
+ *	@datasize - configuration data size
+ */
+struct cycx_fw_info {
+	unsigned short	codeid;
+	unsigned short	version;
+	unsigned short	adapter[CFM_MAX_CYCX];
+	unsigned long	memsize;
+	unsigned short	reserved[2];
+	unsigned short	startoffs;
+	unsigned short	winoffs;
+	unsigned short	codeoffs;
+	unsigned long	codesize;
+	unsigned short	dataoffs;
+	unsigned long	datasize;
+};
+
+/**
+ *	struct cycx_firmware - CYCX firmware file structure
+ *	@signature - CFM file signature
+ *	@version - file format version
+ *	@checksum - info + image
+ *	@reserved - reserved
+ *	@descr - description string
+ *	@info - firmware module info
+ *	@image - code image (variable size)
+ */
+struct cycx_firmware {
+	char		    signature[80];
+	unsigned short	    version;
+	unsigned short	    checksum;
+	unsigned short	    reserved[6];
+	char		    descr[CFM_DESCR_LEN];
+	struct cycx_fw_info info;
+	unsigned char	    image[1];
+};
 
-typedef struct	cfm_info		/* firmware module information */
-{
-	unsigned short	codeid;		/* firmware ID */
-	unsigned short	version;	/* firmware version number */
-	unsigned short	adapter[CFM_MAX_CYCX]; /* compatible adapter types */
-	unsigned long	memsize;	/* minimum memory size */
-	unsigned short	reserved[2];	/* reserved */
-	unsigned short	startoffs;	/* entry point offset */
-	unsigned short	winoffs;	/* dual-port memory window offset */
-	unsigned short	codeoffs;	/* code load offset */
-	unsigned long	codesize;	/* code size */
-	unsigned short	dataoffs;	/* configuration data load offset */
-	unsigned long	datasize;	/* configuration data size */
-} cfm_info_t;
-
-typedef struct cfm			/* CYCX firmware file structure */
-{
-	char		signature[80];	/* CFM file signature */
-	unsigned short	version;	/* file format version */
-	unsigned short	checksum;	/* info + image */
-	unsigned short	reserved[6];	/* reserved */
-	char		descr[CFM_DESCR_LEN]; /* description string */
-	cfm_info_t	info;		/* firmware module info */
-	unsigned char	image[1];	/* code image (variable size) */
-} cfm_t;
-
-typedef struct cycx_header_s {
+struct cycx_fw_header {
 	unsigned long  reset_size;
 	unsigned long  data_size;
 	unsigned long  code_size;
-} cycx_header_t;
-
+};
 #endif	/* _CYCX_CFM_H */
diff -urN linux-2.5.69-bk12/include/linux/cycx_drv.h linux-2.5.69-bk13/include/linux/cycx_drv.h
--- linux-2.5.69-bk12/include/linux/cycx_drv.h	2003-05-04 16:53:09.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/cycx_drv.h	2003-05-18 04:45:54.000000000 -0700
@@ -3,7 +3,7 @@
 *
 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
 *
-* Copyright:	(c) 1998-2000 Arnaldo Carvalho de Melo
+* Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
 *
 * Based on sdladrv.h by Gene Kozin <genek@compuserve.com>
 *
@@ -37,28 +37,29 @@
 #define	DATA_OFFSET	0x0100	/* For code and data files load */
 #define	START_OFFSET	0x3ff0	/* 80186 starts here */
 
-#ifndef MIN
-#define MIN(a,b)	((a) < (b) ? (a) : (b))
-#endif
-
-/* Data Structures */
-/* Adapter hardware configuration. Pointer to this structure is passed to all
- * APIs.  */
-typedef struct cycxhw {
-	u32 fwid;		/* firmware ID */
-	int irq;		/* interrupt request level */
-	u32 dpmbase;		/* dual-port memory base */
-	u32 dpmsize;		/* dual-port memory size */
+/**
+ *	struct cycx_hw - Adapter hardware configuration
+ *	@fwid - firmware ID
+ *	@irq - interrupt request level
+ *	@dpmbase - dual-port memory base
+ *	@dpmsize - dual-port memory size
+ *	@reserved - reserved for future use
+ */
+struct cycx_hw {
+	u32 fwid;
+	int irq;
+	u32 dpmbase;
+	u32 dpmsize;
 	u32 reserved[5];
-} cycxhw_t;
+};
 
 /* Function Prototypes */
-extern int cycx_setup (cycxhw_t *hw, void *sfm, u32 len);
-extern int cycx_down (cycxhw_t *hw);
-extern int cycx_peek (cycxhw_t *hw, u32 addr, void *buf, u32 len);
-extern int cycx_poke (cycxhw_t *hw, u32 addr, void *buf, u32 len);
-extern int cycx_exec (u32 addr);
+extern int cycx_setup(struct cycx_hw *hw, void *sfm, u32 len);
+extern int cycx_down(struct cycx_hw *hw);
+extern int cycx_peek(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
+extern int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
+extern int cycx_exec(u32 addr);
 
-extern void cycx_inten (cycxhw_t *hw);
-extern void cycx_intr (cycxhw_t *hw);
+extern void cycx_inten(struct cycx_hw *hw);
+extern void cycx_intr(struct cycx_hw *hw);
 #endif	/* _CYCX_DRV_H */
diff -urN linux-2.5.69-bk12/include/linux/cycx_x25.h linux-2.5.69-bk13/include/linux/cycx_x25.h
--- linux-2.5.69-bk12/include/linux/cycx_x25.h	2003-05-04 16:53:36.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/cycx_x25.h	2003-05-18 04:45:54.000000000 -0700
@@ -1,9 +1,11 @@
+#ifndef	_CYCX_X25_H
+#define	_CYCX_X25_H
 /*
 * cycx_x25.h	Cyclom X.25 firmware API definitions.
 *
 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
 *
-* Copyright:	(c) 1998-2000 Arnaldo Carvalho de Melo
+* Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
 *
 * Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com>
 *
@@ -20,9 +22,6 @@
 *					 TX25Cmd & TX25Config structs
 *					 typedef'ed
 */
-#ifndef	_CYCX_X25_H
-#define	_CYCX_X25_H
-
 #ifndef PACKED
 #define PACKED __attribute__((packed))
 #endif 
@@ -38,13 +37,12 @@
 
 /* Data Structures */
 /* X.25 Command Block. */
-typedef struct X25Cmd
-{
+struct cycx_x25_cmd {
 	u16 command PACKED;
 	u16 link    PACKED; /* values: 0 or 1 */
 	u16 len     PACKED; /* values: 0 thru 0x205 (517) */
 	u32 buf     PACKED;
-} TX25Cmd;
+};
 
 /* Defines for the 'command' field. */
 #define X25_CONNECT_REQUEST             0x4401
@@ -74,26 +72,45 @@
 #define X25_N2TRACEXC                   0x4702
 #define X25_N3TRACEXC                   0x4703
 
-typedef struct X25Config {
-	u8  link	PACKED; /* link number */
-	u8  speed	PACKED; /* line speed */
-	u8  clock	PACKED; /* internal/external */
-	u8  n2		PACKED; /* # of level 2 retransm.(values: 1 thru FF) */
-	u8  n2win	PACKED; /* level 2 window (values: 1 thru 7) */
-	u8  n3win	PACKED; /* level 3 window (values: 1 thru 7) */
-	u8  nvc		PACKED; /* # of logical channels (values: 1 thru 64) */
-	u8  pktlen	PACKED; /* level 3 packet lenght - log base 2 of size */
-	u8  locaddr	PACKED; /* my address */
-	u8  remaddr	PACKED; /* remote address */
-	u16 t1		PACKED;	/* time, in seconds */
-	u16 t2		PACKED;	/* time, in seconds */
-	u8  t21		PACKED;	/* time, in seconds */
-	u8  npvc	PACKED;	/* # of permanent virt. circuits (1 thru nvc) */
-	u8  t23		PACKED;	/* time, in seconds */
-	u8  flags	PACKED;	/* see dosx25.doc, in portuguese, for details */
-} TX25Config;
+/**
+ *	struct cycx_x25_config - cyclom2x x25 firmware configuration
+ *	@link - link number
+ *	@speed - line speed
+ *	@clock - internal/external
+ *	@n2 - # of level 2 retransm.(values: 1 thru FF)
+ *	@n2win - level 2 window (values: 1 thru 7)
+ *	@n3win - level 3 window (values: 1 thru 7)
+ *	@nvc - # of logical channels (values: 1 thru 64)
+ *	@pktlen - level 3 packet lenght - log base 2 of size
+ *	@locaddr - my address
+ *	@remaddr - remote address
+ *	@t1 - time, in seconds
+ *	@t2 - time, in seconds
+ *	@t21 - time, in seconds
+ *	@npvc - # of permanent virt. circuits (1 thru nvc)
+ *	@t23 - time, in seconds
+ *	@flags - see dosx25.doc, in portuguese, for details
+ */
+struct cycx_x25_config {
+	u8  link	PACKED;
+	u8  speed	PACKED;
+	u8  clock	PACKED;
+	u8  n2		PACKED;
+	u8  n2win	PACKED;
+	u8  n3win	PACKED;
+	u8  nvc		PACKED;
+	u8  pktlen	PACKED;
+	u8  locaddr	PACKED;
+	u8  remaddr	PACKED;
+	u16 t1		PACKED;
+	u16 t2		PACKED;
+	u8  t21		PACKED;
+	u8  npvc	PACKED;
+	u8  t23		PACKED;
+	u8  flags	PACKED;
+};
 
-typedef struct X25Stats {
+struct cycx_x25_stats {
 	u16 rx_crc_errors	PACKED;
 	u16 rx_over_errors	PACKED;
 	u16 n2_tx_frames 	PACKED;
@@ -104,5 +121,5 @@
 	u16 n3_rx_packets 	PACKED;
 	u16 tx_aborts	 	PACKED;
 	u16 rx_aborts	 	PACKED;
-} TX25Stats;
+};
 #endif	/* _CYCX_X25_H */
diff -urN linux-2.5.69-bk12/include/linux/if_arcnet.h linux-2.5.69-bk13/include/linux/if_arcnet.h
--- linux-2.5.69-bk12/include/linux/if_arcnet.h	2003-05-04 16:53:02.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/if_arcnet.h	2003-05-18 04:45:54.000000000 -0700
@@ -25,6 +25,7 @@
 
 /* RFC1201 Protocol ID's */
 #define ARC_P_IP		212	/* 0xD4 */
+#define ARC_P_IPV6		196	/* 0xC4: RFC2497 */
 #define ARC_P_ARP		213	/* 0xD5 */
 #define ARC_P_RARP		214	/* 0xD6 */
 #define ARC_P_IPX		250	/* 0xFA */
@@ -45,6 +46,9 @@
 #define ARC_P_LANSOFT		251	/* 0xFB - what is this? */
 #define ARC_P_ATALK		0xDD
 
+/* Hardware address length */
+#define ARCNET_ALEN	1
+
 /*
  * The RFC1201-specific components of an arcnet packet header.
  */
diff -urN linux-2.5.69-bk12/include/linux/if_wanpipe.h linux-2.5.69-bk13/include/linux/if_wanpipe.h
--- linux-2.5.69-bk12/include/linux/if_wanpipe.h	2003-05-04 16:53:55.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/if_wanpipe.h	2003-05-18 04:45:54.000000000 -0700
@@ -101,16 +101,12 @@
 
 #ifdef __KERNEL__
 
-#ifndef netdevice_t
-#define netdevice_t struct net_device
-#endif
-
 /* Private wanpipe socket structures. */
 struct wanpipe_opt
 {
 	void   *mbox;		/* Mail box  */
 	void   *card; 		/* Card bouded to */
-	netdevice_t *dev;	/* Bounded device */
+	struct net_device *dev;	/* Bounded device */
 	unsigned short lcn;	/* Binded LCN */
 	unsigned char  svc;	/* 0=pvc, 1=svc */
 	unsigned char  timer;   /* flag for delayed transmit*/	
diff -urN linux-2.5.69-bk12/include/linux/if_wanpipe_common.h linux-2.5.69-bk13/include/linux/if_wanpipe_common.h
--- linux-2.5.69-bk12/include/linux/if_wanpipe_common.h	2003-05-04 16:53:33.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/if_wanpipe_common.h	2003-05-18 04:45:54.000000000 -0700
@@ -19,11 +19,8 @@
 
 #include <linux/version.h>
 
-#define netdevice_t struct net_device
-
-
 typedef struct {
-	netdevice_t *slave;
+	struct net_device *slave;
 	atomic_t packet_sent;
 	atomic_t receive_block;
 	atomic_t command;
@@ -32,8 +29,8 @@
 	long common_critical;
 	struct timer_list *tx_timer;
 	struct sock *sk;		/* Wanpipe Sock bind's here */ 
-	int   (*func) (struct sk_buff *, netdevice_t *, 
-                       struct sock *);
+	int (*func)(struct sk_buff *skb, struct net_device *dev, 
+		    struct sock *sk);
 
 	struct work_struct wanpipe_work;    /* deferred keventd work */
 	unsigned char rw_bind;			  /* Sock bind state */
diff -urN linux-2.5.69-bk12/include/linux/ip.h linux-2.5.69-bk13/include/linux/ip.h
--- linux-2.5.69-bk12/include/linux/ip.h	2003-05-04 16:53:08.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/ip.h	2003-05-18 04:45:54.000000000 -0700
@@ -113,7 +113,7 @@
 	__u16			dport;		/* Destination port */
 	__u16			num;		/* Local port */
 	__u32			saddr;		/* Sending source */
-	int			ttl;		/* TTL setting */
+	int			uc_ttl;		/* Unicast TTL */
 	int			tos;		/* TOS */
 	unsigned	   	cmsg_flags;
 	struct ip_options	*opt;
@@ -198,4 +198,10 @@
 	__u8  enc_data[0];	/* Variable len but >=8. Mind the 64 bit alignment! */
 };
 
+struct ip_comp_hdr {
+	__u8 nexthdr;
+	__u8 flags;
+	__u16 cpi;
+};
+
 #endif	/* _LINUX_IP_H */
diff -urN linux-2.5.69-bk12/include/linux/ipv6.h linux-2.5.69-bk13/include/linux/ipv6.h
--- linux-2.5.69-bk12/include/linux/ipv6.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/ipv6.h	2003-05-18 04:45:54.000000000 -0700
@@ -89,6 +89,12 @@
 	__u8  enc_data[0];      /* Length variable but >=8. Mind the 64 bit alignment! */
 };
 
+struct ipv6_comp_hdr {
+	__u8 nexthdr;
+	__u8 flags;
+	__u16 cpi;
+};
+
 /*
  *	IPv6 fixed header
  *
diff -urN linux-2.5.69-bk12/include/linux/ipv6_route.h linux-2.5.69-bk13/include/linux/ipv6_route.h
--- linux-2.5.69-bk12/include/linux/ipv6_route.h	2003-05-04 16:53:07.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/ipv6_route.h	2003-05-18 04:45:54.000000000 -0700
@@ -13,15 +13,6 @@
 #ifndef _LINUX_IPV6_ROUTE_H
 #define _LINUX_IPV6_ROUTE_H
 
-enum
-{
-	RTA_IPV6_UNSPEC,
-	RTA_IPV6_HOPLIMIT,
-};
-
-#define	RTA_IPV6_MAX RTA_IPV6_HOPLIMIT
-
-
 #define RTF_DEFAULT	0x00010000	/* default - learned via ND	*/
 #define RTF_ALLONLINK	0x00020000	/* fallback, no routers on link	*/
 #define RTF_ADDRCONF	0x00040000	/* addrconf route - RA		*/
diff -urN linux-2.5.69-bk12/include/linux/kmod.h linux-2.5.69-bk13/include/linux/kmod.h
--- linux-2.5.69-bk12/include/linux/kmod.h	2003-05-04 16:53:07.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/kmod.h	2003-05-18 04:45:54.000000000 -0700
@@ -24,12 +24,12 @@
 #include <linux/compiler.h>
 
 #ifdef CONFIG_KMOD
-extern int request_module(const char * name);
+extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2)));
 #else
-static inline int request_module(const char * name) { return -ENOSYS; }
+static inline int request_module(const char * name, ...) { return -ENOSYS; }
 #endif
 
-#define try_then_request_module(x, mod) ((x) ?: request_module(mod), (x))
+#define try_then_request_module(x, mod...) ((x) ?: request_module(mod), (x))
 extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait);
 
 #ifdef CONFIG_HOTPLUG
diff -urN linux-2.5.69-bk12/include/linux/rtnetlink.h linux-2.5.69-bk13/include/linux/rtnetlink.h
--- linux-2.5.69-bk12/include/linux/rtnetlink.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/rtnetlink.h	2003-05-18 04:45:54.000000000 -0700
@@ -201,10 +201,9 @@
 	RTA_FLOW,
 	RTA_CACHEINFO,
 	RTA_SESSION,
-	RTA_HOPLIMIT,
 };
 
-#define RTA_MAX RTA_HOPLIMIT
+#define RTA_MAX RTA_SESSION
 
 #define RTM_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
 #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
@@ -283,9 +282,11 @@
 #define RTAX_ADVMSS RTAX_ADVMSS
 	RTAX_REORDERING,
 #define RTAX_REORDERING RTAX_REORDERING
+	RTAX_HOPLIMIT,
+#define RTAX_HOPLIMIT RTAX_HOPLIMIT
 };
 
-#define RTAX_MAX RTAX_REORDERING
+#define RTAX_MAX RTAX_HOPLIMIT
 
 struct rta_session
 {
diff -urN linux-2.5.69-bk12/include/linux/wanpipe.h linux-2.5.69-bk13/include/linux/wanpipe.h
--- linux-2.5.69-bk12/include/linux/wanpipe.h	2003-05-04 16:53:33.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/wanpipe.h	2003-05-18 04:45:54.000000000 -0700
@@ -39,8 +39,6 @@
 #ifndef	_WANPIPE_H
 #define	_WANPIPE_H
 
-#define netdevice_t struct net_device
-
 #include <linux/wanrouter.h>
 
 /* Defines */
@@ -286,7 +284,7 @@
 {
 	char devname[WAN_DRVNAME_SZ+1];	/* card name */
 	sdlahw_t hw;			/* hardware configuration */
-	wan_device_t wandev;		/* WAN device data space */
+	struct wan_device wandev;	/* WAN device data space */
 	
 	unsigned open_cnt;		/* number of open interfaces */
 	unsigned long state_tick;	/* link state timestamp */
@@ -335,22 +333,22 @@
 			u32 hi_pvc;
 			u32 lo_svc;
 			u32 hi_svc;
-			netdevice_t *svc_to_dev_map[MAX_X25_LCN];
-			netdevice_t *pvc_to_dev_map[MAX_X25_LCN];
-			netdevice_t *tx_dev;
-			netdevice_t *cmd_dev;
+			struct net_device *svc_to_dev_map[MAX_X25_LCN];
+			struct net_device *pvc_to_dev_map[MAX_X25_LCN];
+			struct net_device *tx_dev;
+			struct net_device *cmd_dev;
 			u32 no_dev;
 			volatile u8 *hdlc_buf_status;
 			u32 tx_interrupts_pending;
                         u16 timer_int_enabled;
-			netdevice_t *poll_device;
+			struct net_device *poll_device;
 			atomic_t command_busy;
 
 			u16 udp_pkt_lgth;
                         u32 udp_type;
                         u8  udp_pkt_src;
 			u32 udp_lcn;
-                        netdevice_t * udp_dev;
+                        struct net_device *udp_dev;
                         s8 udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
 
 		 	u8 LAPB_hdlc;		/* Option to turn off X25 and run only LAPB */
@@ -369,7 +367,7 @@
 			unsigned rx_top;	/* S508 receive buffer end */
 			unsigned short node_dlci[100];
 			unsigned short dlci_num;
-                        netdevice_t *dlci_to_dev_map[991 + 1];
+                        struct net_device *dlci_to_dev_map[991 + 1];
                         unsigned tx_interrupts_pending;
                         unsigned short timer_int_enabled;
                         unsigned short udp_pkt_lgth;
@@ -382,7 +380,7 @@
                         void *curr_trc_el;      		/* current trace element */
                         unsigned short trc_bfr_space; 		/* trace buffer space */
 			unsigned char  update_comms_stats;
-			netdevice_t *arp_dev;
+			struct net_device *arp_dev;
 			spinlock_t if_send_lock;
 		} f;
 		struct			/****** PPP-specific data ***********/
@@ -483,10 +481,10 @@
 
 extern void wanpipe_queue_work (struct work_struct *);
 extern void wanpipe_mark_bh (void);
-extern void wakeup_sk_bh (netdevice_t *);
-extern int change_dev_flags (netdevice_t *, unsigned); 
-extern unsigned long get_ip_address (netdevice_t *dev, int option);
-extern void add_gateway(sdla_t *, netdevice_t *);
+extern void wakeup_sk_bh(struct net_device *dev);
+extern int change_dev_flags(struct net_device *dev, unsigned flags);
+extern unsigned long get_ip_address(struct net_device *dev, int option);
+extern void add_gateway(sdla_t *card, struct net_device *dev);
 
 
 #endif	/* __KERNEL__ */
diff -urN linux-2.5.69-bk12/include/linux/wanrouter.h linux-2.5.69-bk13/include/linux/wanrouter.h
--- linux-2.5.69-bk12/include/linux/wanrouter.h	2003-05-04 16:53:09.000000000 -0700
+++ linux-2.5.69-bk13/include/linux/wanrouter.h	2003-05-18 04:45:54.000000000 -0700
@@ -44,8 +44,6 @@
 * Jan 02, 1997	Gene Kozin	Initial version (based on wanpipe.h).
 *****************************************************************************/
 
-#define netdevice_t struct net_device
-
 #include <linux/spinlock.h>       /* Support for SMP Locking */
 
 #ifndef	_ROUTER_H
@@ -462,8 +460,7 @@
 /*----------------------------------------------------------------------------
  * WAN device data space.
  */
-typedef struct wan_device
-{
+struct wan_device {
 	unsigned magic;			/* magic number */
 	char* name;			/* -> WAN device name (ASCIIZ) */
 	void* private;			/* -> driver private data */
@@ -506,27 +503,29 @@
 	int (*update) (struct wan_device *wandev);
 	int (*ioctl) (struct wan_device *wandev, unsigned cmd,
 		unsigned long arg);
-	int (*new_if) (struct wan_device *wandev, netdevice_t *dev,
-		wanif_conf_t *conf);
-	int (*del_if) (struct wan_device *wandev, netdevice_t *dev);
+	int (*new_if)(struct wan_device *wandev, struct net_device *dev,
+		      wanif_conf_t *conf);
+	int (*del_if)(struct wan_device *wandev, struct net_device *dev);
 					/****** maintained by the router ****/
 	struct wan_device* next;	/* -> next device */
-	netdevice_t* dev;		/* list of network interfaces */
+	struct net_device* dev;		/* list of network interfaces */
 	unsigned ndev;			/* number of interfaces */
 	struct proc_dir_entry *dent;	/* proc filesystem entry */
-} wan_device_t;
+};
 
 /* Public functions available for device drivers */
-extern int register_wan_device(wan_device_t *wandev);
+extern int register_wan_device(struct wan_device *wandev);
 extern int unregister_wan_device(char *name);
-unsigned short wanrouter_type_trans(struct sk_buff *skb, netdevice_t *dev);
-int wanrouter_encapsulate(struct sk_buff *skb, netdevice_t *dev,unsigned short type);
+unsigned short wanrouter_type_trans(struct sk_buff *skb,
+				    struct net_device *dev);
+int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev,
+			  unsigned short type);
 
 /* Proc interface functions. These must not be called by the drivers! */
 extern int wanrouter_proc_init(void);
 extern void wanrouter_proc_cleanup(void);
-extern int wanrouter_proc_add(wan_device_t *wandev);
-extern int wanrouter_proc_delete(wan_device_t *wandev);
+extern int wanrouter_proc_add(struct wan_device *wandev);
+extern int wanrouter_proc_delete(struct wan_device *wandev);
 extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
 
 extern void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
@@ -535,7 +534,7 @@
 
 
 /* Public Data */
-extern wan_device_t *router_devlist;	/* list of registered devices */
+extern struct wan_device *router_devlist;	/* list of registered devices */
 
 #endif	/* __KERNEL__ */
 #endif	/* _ROUTER_H */
diff -urN linux-2.5.69-bk12/include/net/dn_fib.h linux-2.5.69-bk13/include/net/dn_fib.h
--- linux-2.5.69-bk12/include/net/dn_fib.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/net/dn_fib.h	2003-05-18 04:45:54.000000000 -0700
@@ -19,7 +19,6 @@
         u32             *rta_flow;
         struct rta_cacheinfo *rta_ci;
 	struct rta_session *rta_sess;
-	u8		*rta_hoplimit;
 };
 
 struct dn_fib_res {
diff -urN linux-2.5.69-bk12/include/net/flow.h linux-2.5.69-bk13/include/net/flow.h
--- linux-2.5.69-bk12/include/net/flow.h	2003-05-04 16:53:41.000000000 -0700
+++ linux-2.5.69-bk13/include/net/flow.h	2003-05-18 04:45:54.000000000 -0700
@@ -75,4 +75,16 @@
 #define fl_icmp_code	uli_u.icmpt.code
 #define fl_ipsec_spi	uli_u.spi
 };
+
+#define FLOW_DIR_IN	0
+#define FLOW_DIR_OUT	1
+#define FLOW_DIR_FWD	2
+
+typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir,
+			       void **objp, atomic_t **obj_refp);
+
+extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir,
+			       flow_resolve_t resolver);
+extern atomic_t flow_cache_genid;
+
 #endif
diff -urN linux-2.5.69-bk12/include/net/if_inet6.h linux-2.5.69-bk13/include/net/if_inet6.h
--- linux-2.5.69-bk12/include/net/if_inet6.h	2003-05-04 16:53:42.000000000 -0700
+++ linux-2.5.69-bk13/include/net/if_inet6.h	2003-05-18 04:45:54.000000000 -0700
@@ -264,5 +264,10 @@
 		buf[5]=0x00;
 	}
 }
+
+static inline void ipv6_arcnet_mc_map(const struct in6_addr *addr, char *buf)
+{
+	buf[0] = 0x00;
+}
 #endif
 #endif
diff -urN linux-2.5.69-bk12/include/net/ip6_fib.h linux-2.5.69-bk13/include/net/ip6_fib.h
--- linux-2.5.69-bk12/include/net/ip6_fib.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/net/ip6_fib.h	2003-05-18 04:45:54.000000000 -0700
@@ -67,7 +67,6 @@
 	
 	u32				rt6i_flags;
 	u32				rt6i_metric;
-	u8				rt6i_hoplimit;
 	atomic_t			rt6i_ref;
 
 	struct rt6key			rt6i_dst;
diff -urN linux-2.5.69-bk12/include/net/ip_fib.h linux-2.5.69-bk13/include/net/ip_fib.h
--- linux-2.5.69-bk12/include/net/ip_fib.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/net/ip_fib.h	2003-05-18 04:45:54.000000000 -0700
@@ -38,7 +38,6 @@
 	u32		*rta_flow;
 	struct rta_cacheinfo *rta_ci;
 	struct rta_session *rta_sess;
-	u8		*rta_hoplimit;
 };
 
 struct fib_nh
diff -urN linux-2.5.69-bk12/include/net/ipcomp.h linux-2.5.69-bk13/include/net/ipcomp.h
--- linux-2.5.69-bk12/include/net/ipcomp.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.69-bk13/include/net/ipcomp.h	2003-05-18 04:45:54.000000000 -0700
@@ -0,0 +1,12 @@
+#ifndef _NET_IPCOMP_H
+#define _NET_IPCOMP_H
+
+#define IPCOMP_SCRATCH_SIZE     65400
+
+struct ipcomp_data {
+	u16 threshold;
+	u8 *scratch;
+	struct crypto_tfm *tfm;
+};
+
+#endif
diff -urN linux-2.5.69-bk12/include/net/ipv6.h linux-2.5.69-bk13/include/net/ipv6.h
--- linux-2.5.69-bk12/include/net/ipv6.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/net/ipv6.h	2003-05-18 04:45:54.000000000 -0700
@@ -315,6 +315,7 @@
 					       unsigned length,
 					       struct ipv6_txoptions *opt,
 					       int hlimit, int flags);
+extern int			ip6_found_nexthdr(struct sk_buff *skb, u8 **nexthdr);
 
 extern int			ip6_append_data(struct sock *sk,
 						int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb),
diff -urN linux-2.5.69-bk12/include/net/ipx.h linux-2.5.69-bk13/include/net/ipx.h
--- linux-2.5.69-bk12/include/net/ipx.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/net/ipx.h	2003-05-18 04:45:54.000000000 -0700
@@ -125,4 +125,36 @@
 
 extern const char *ipx_frame_name(unsigned short);
 extern const char *ipx_device_name(struct ipx_interface *intrfc);
+
+static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
+{
+	atomic_inc(&intrfc->refcnt);
+}
+
+extern void ipxitf_down(struct ipx_interface *intrfc);
+
+static __inline__ void ipxitf_put(struct ipx_interface *intrfc)
+{
+	if (atomic_dec_and_test(&intrfc->refcnt))
+		ipxitf_down(intrfc);
+}
+
+extern void __ipxitf_down(struct ipx_interface *intrfc);
+
+static __inline__ void __ipxitf_put(struct ipx_interface *intrfc)
+{
+	if (atomic_dec_and_test(&intrfc->refcnt))
+		__ipxitf_down(intrfc);
+}
+
+static __inline__ void ipxrtr_hold(struct ipx_route *rt)
+{
+	        atomic_inc(&rt->refcnt);
+}
+
+static __inline__ void ipxrtr_put(struct ipx_route *rt)
+{
+	        if (atomic_dec_and_test(&rt->refcnt))
+			                kfree(rt);
+}
 #endif /* _NET_INET_IPX_H_ */
diff -urN linux-2.5.69-bk12/include/net/xfrm.h linux-2.5.69-bk13/include/net/xfrm.h
--- linux-2.5.69-bk12/include/net/xfrm.h	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/include/net/xfrm.h	2003-05-18 04:45:54.000000000 -0700
@@ -788,7 +788,6 @@
 void xfrm6_policy_init(void);
 struct xfrm_policy *xfrm_policy_alloc(int gfp);
 extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *);
-struct xfrm_policy *xfrm_policy_lookup(int dir, struct flowi *fl, unsigned short family);
 int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
 struct xfrm_policy *xfrm_policy_delete(int dir, struct xfrm_selector *sel);
 struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete);
diff -urN linux-2.5.69-bk12/kernel/exec_domain.c linux-2.5.69-bk13/kernel/exec_domain.c
--- linux-2.5.69-bk12/kernel/exec_domain.c	2003-05-04 16:53:32.000000000 -0700
+++ linux-2.5.69-bk13/kernel/exec_domain.c	2003-05-18 04:45:54.000000000 -0700
@@ -88,11 +88,7 @@
 
 #ifdef CONFIG_KMOD
 	read_unlock(&exec_domains_lock);
-	{
-		char buffer[30];
-		sprintf(buffer, "personality-%ld", pers);
-		request_module(buffer);
-	}
+	request_module("personality-%ld", pers);
 	read_lock(&exec_domains_lock);
 
 	for (ep = exec_domains; ep; ep = ep->next) {
diff -urN linux-2.5.69-bk12/kernel/intermodule.c linux-2.5.69-bk13/kernel/intermodule.c
--- linux-2.5.69-bk12/kernel/intermodule.c	2003-05-04 16:52:48.000000000 -0700
+++ linux-2.5.69-bk13/kernel/intermodule.c	2003-05-18 04:45:54.000000000 -0700
@@ -143,7 +143,7 @@
 {
 	const void *result = inter_module_get(im_name);
 	if (!result) {
-		request_module(modname);
+		request_module("%s", modname);
 		result = inter_module_get(im_name);
 	}
 	return(result);
diff -urN linux-2.5.69-bk12/kernel/kmod.c linux-2.5.69-bk13/kernel/kmod.c
--- linux-2.5.69-bk12/kernel/kmod.c	2003-05-04 16:53:09.000000000 -0700
+++ linux-2.5.69-bk13/kernel/kmod.c	2003-05-18 04:45:54.000000000 -0700
@@ -58,11 +58,14 @@
  * If module auto-loading support is disabled then this function
  * becomes a no-operation.
  */
-int request_module(const char *module_name)
+#define MODULENAME_SIZE 32
+int request_module(const char *fmt, ...)
 {
+	va_list args;
+	char module_name[MODULENAME_SIZE];
 	unsigned int max_modprobes;
 	int ret;
-	char *argv[] = { modprobe_path, "--", (char*)module_name, NULL };
+	char *argv[] = { modprobe_path, "--", module_name, NULL };
 	static char *envp[] = { "HOME=/",
 				"TERM=linux",
 				"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
@@ -71,6 +74,12 @@
 #define MAX_KMOD_CONCURRENT 50	/* Completely arbitrary value - KAO */
 	static int kmod_loop_msg;
 
+	va_start(args, fmt);
+	ret = vsnprintf(module_name, MODULENAME_SIZE, fmt, args);
+	va_end(args);
+	if (ret >= MODULENAME_SIZE)
+		return -ENAMETOOLONG;
+
 	/* If modprobe needs a service that is in a module, we get a recursive
 	 * loop.  Limit the number of running kmod threads to max_threads/2 or
 	 * MAX_KMOD_CONCURRENT, whichever is the smaller.  A cleaner method
@@ -80,7 +89,6 @@
 	 * and it is not worth changing the proc code just to handle this case. 
 	 * KAO.
 	 *
-
 	 * "trace the ppid" is simple, but will fail if someone's
 	 * parent exits.  I think this is as good as it gets. --RR
 	 */
diff -urN linux-2.5.69-bk12/net/Kconfig linux-2.5.69-bk13/net/Kconfig
--- linux-2.5.69-bk12/net/Kconfig	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/Kconfig	2003-05-18 04:45:54.000000000 -0700
@@ -213,7 +213,7 @@
 source "net/sctp/Kconfig"
 
 config ATM
-	bool "Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)"
+	tristate "Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
 	---help---
 	  ATM is a high-speed networking technology for Local Area Networks
diff -urN linux-2.5.69-bk12/net/atm/Makefile linux-2.5.69-bk13/net/atm/Makefile
--- linux-2.5.69-bk12/net/atm/Makefile	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/Makefile	2003-05-18 04:45:54.000000000 -0700
@@ -11,7 +11,7 @@
 obj-$(CONFIG_ATM_BR2684) += br2684.o
 atm-$(subst m,y,$(CONFIG_ATM_BR2684)) += ipcommon.o
 atm-$(subst m,y,$CONFIG_NET_SCH_ATM)) += ipcommon.o
-obj-$(CONFIG_PROC_FS) += proc.o
+atm-$(CONFIG_PROC_FS) += proc.o
 
 obj-$(CONFIG_ATM_LANE) += lec.o
 obj-$(CONFIG_ATM_MPOA) += mpoa.o
diff -urN linux-2.5.69-bk12/net/atm/addr.c linux-2.5.69-bk13/net/atm/addr.c
--- linux-2.5.69-bk12/net/atm/addr.c	2003-05-04 16:53:00.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/addr.c	2003-05-18 04:45:54.000000000 -0700
@@ -36,14 +36,6 @@
 }
 
 
-/*
- * Avoid modification of any list of local interfaces while reading it
- * (which may involve page faults and therefore rescheduling)
- */
-
-static DECLARE_MUTEX(local_lock);
-extern  spinlock_t atm_dev_lock;
-
 static void notify_sigd(struct atm_dev *dev)
 {
 	struct sockaddr_atmpvc pvc;
@@ -52,46 +44,46 @@
 	sigd_enq(NULL,as_itf_notify,NULL,&pvc,NULL);
 }
 
-/*
- *	This is called from atm_ioctl only. You must hold the lock as a caller
- */
 
 void atm_reset_addr(struct atm_dev *dev)
 {
+	unsigned long flags;
 	struct atm_dev_addr *this;
 
-	down(&local_lock);
+	spin_lock_irqsave(&dev->lock, flags);
 	while (dev->local) {
 		this = dev->local;
 		dev->local = this->next;
 		kfree(this);
 	}
-	up(&local_lock);
+	spin_unlock_irqrestore(&dev->lock, flags);
 	notify_sigd(dev);
 }
 
 
 int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr)
 {
+	unsigned long flags;
 	struct atm_dev_addr **walk;
 	int error;
 
 	error = check_addr(addr);
-	if (error) return error;
-	down(&local_lock);
+	if (error)
+		return error;
+	spin_lock_irqsave(&dev->lock, flags);
 	for (walk = &dev->local; *walk; walk = &(*walk)->next)
 		if (identical(&(*walk)->addr,addr)) {
-			up(&local_lock);
+			spin_unlock_irqrestore(&dev->lock, flags);
 			return -EEXIST;
 		}
-	*walk = kmalloc(sizeof(struct atm_dev_addr),GFP_KERNEL);
+	*walk = kmalloc(sizeof(struct atm_dev_addr), GFP_ATOMIC);
 	if (!*walk) {
-		up(&local_lock);
+		spin_unlock_irqrestore(&dev->lock, flags);
 		return -ENOMEM;
 	}
 	(*walk)->addr = *addr;
 	(*walk)->next = NULL;
-	up(&local_lock);
+	spin_unlock_irqrestore(&dev->lock, flags);
 	notify_sigd(dev);
 	return 0;
 }
@@ -99,22 +91,24 @@
 
 int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr)
 {
+	unsigned long flags;
 	struct atm_dev_addr **walk,*this;
 	int error;
 
 	error = check_addr(addr);
-	if (error) return error;
-	down(&local_lock);
+	if (error)
+		return error;
+	spin_lock_irqsave(&dev->lock, flags);
 	for (walk = &dev->local; *walk; walk = &(*walk)->next)
 		if (identical(&(*walk)->addr,addr)) break;
 	if (!*walk) {
-		up(&local_lock);
+		spin_unlock_irqrestore(&dev->lock, flags);
 		return -ENOENT;
 	}
 	this = *walk;
 	*walk = this->next;
 	kfree(this);
-	up(&local_lock);
+	spin_unlock_irqrestore(&dev->lock, flags);
 	notify_sigd(dev);
 	return 0;
 }
@@ -122,24 +116,25 @@
 
 int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size)
 {
+	unsigned long flags;
 	struct atm_dev_addr *walk;
 	int total;
 
-	down(&local_lock);
+	spin_lock_irqsave(&dev->lock, flags);
 	total = 0;
 	for (walk = dev->local; walk; walk = walk->next) {
 		total += sizeof(struct sockaddr_atmsvc);
 		if (total > size) {
-			up(&local_lock);
+			spin_unlock_irqrestore(&dev->lock, flags);
 			return -E2BIG;
 		}
 		if (copy_to_user(u_buf,&walk->addr,
 		    sizeof(struct sockaddr_atmsvc))) {
-			up(&local_lock);
+			spin_unlock_irqrestore(&dev->lock, flags);
 			return -EFAULT;
 		}
 		u_buf++;
 	}
-	up(&local_lock);
+	spin_unlock_irqrestore(&dev->lock, flags);
 	return total;
 }
diff -urN linux-2.5.69-bk12/net/atm/atm_misc.c linux-2.5.69-bk13/net/atm/atm_misc.c
--- linux-2.5.69-bk12/net/atm/atm_misc.c	2003-05-04 16:53:07.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/atm_misc.c	2003-05-18 04:45:54.000000000 -0700
@@ -63,13 +63,19 @@
 
 int atm_find_ci(struct atm_vcc *vcc,short *vpi,int *vci)
 {
+	unsigned long flags;
 	static short p = 0; /* poor man's per-device cache */
 	static int c = 0;
 	short old_p;
 	int old_c;
+	int err;
 
-	if (*vpi != ATM_VPI_ANY && *vci != ATM_VCI_ANY)
-		return check_ci(vcc,*vpi,*vci);
+	spin_lock_irqsave(&vcc->dev->lock, flags);
+	if (*vpi != ATM_VPI_ANY && *vci != ATM_VCI_ANY) {
+		err = check_ci(vcc,*vpi,*vci);
+		spin_unlock_irqrestore(&vcc->dev->lock, flags);
+		return err;
+	}
 	/* last scan may have left values out of bounds for current device */
 	if (*vpi != ATM_VPI_ANY) p = *vpi;
 	else if (p >= 1 << vcc->dev->ci_range.vpi_bits) p = 0;
@@ -82,6 +88,7 @@
 		if (!check_ci(vcc,p,c)) {
 			*vpi = p;
 			*vci = c;
+			spin_unlock_irqrestore(&vcc->dev->lock, flags);
 			return 0;
 		}
 		if (*vci == ATM_VCI_ANY) {
@@ -96,6 +103,7 @@
 		}
 	}
 	while (old_p != p || old_c != c);
+	spin_unlock_irqrestore(&vcc->dev->lock, flags);
 	return -EADDRINUSE;
 }
 
diff -urN linux-2.5.69-bk12/net/atm/clip.c linux-2.5.69-bk13/net/atm/clip.c
--- linux-2.5.69-bk12/net/atm/clip.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/clip.c	2003-05-18 04:45:54.000000000 -0700
@@ -717,6 +717,7 @@
 	.ops =			&atmarpd_dev_ops,
 	.type =			"arpd",
 	.number = 		999,
+	.lock =			SPIN_LOCK_UNLOCKED
 };
 
 
diff -urN linux-2.5.69-bk12/net/atm/common.c linux-2.5.69-bk13/net/atm/common.c
--- linux-2.5.69-bk12/net/atm/common.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/common.c	2003-05-18 04:45:54.000000000 -0700
@@ -20,6 +20,7 @@
 #include <linux/time.h>		/* struct timeval */
 #include <linux/skbuff.h>
 #include <linux/bitops.h>
+#include <linux/init.h>
 #include <net/sock.h>		/* struct sock */
 
 #include <asm/uaccess.h>
@@ -82,7 +83,7 @@
 
 #ifdef CONFIG_ATM_CLIP_MODULE
 EXPORT_SYMBOL(atm_clip_ops);
-EXPORT_SYMBOL(atm_clip_ops_mutex);
+EXPORT_SYMBOL(try_atm_clip_ops);
 EXPORT_SYMBOL(atm_clip_ops_set);
 #endif
 #endif
@@ -115,7 +116,6 @@
 #define DPRINTK(format,args...)
 #endif
 
-spinlock_t atm_dev_lock = SPIN_LOCK_UNLOCKED;
 
 static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size)
 {
@@ -175,19 +175,17 @@
 			atm_return(vcc,skb->truesize);
 			kfree_skb(skb);
 		}
-		spin_lock (&atm_dev_lock);	
-		fops_put (vcc->dev->ops);
+
+		module_put(vcc->dev->ops->owner);
+		atm_dev_release(vcc->dev);
 		if (atomic_read(&vcc->sk->rmem_alloc))
 			printk(KERN_WARNING "atm_release_vcc: strange ... "
 			    "rmem_alloc == %d after closing\n",
 			    atomic_read(&vcc->sk->rmem_alloc));
 		bind_vcc(vcc,NULL);
-	} else
-		spin_lock (&atm_dev_lock);	
+	}
 
 	if (free_sk) free_atm_vcc_sk(sk);
-
-	spin_unlock (&atm_dev_lock);
 }
 
 
@@ -280,11 +278,11 @@
 	    vcc->qos.txtp.min_pcr,vcc->qos.txtp.max_pcr,vcc->qos.txtp.max_sdu);
 	DPRINTK("  RX: %d, PCR %d..%d, SDU %d\n",vcc->qos.rxtp.traffic_class,
 	    vcc->qos.rxtp.min_pcr,vcc->qos.rxtp.max_pcr,vcc->qos.rxtp.max_sdu);
-	fops_get (dev->ops);
+	__module_get(dev->ops->owner);
 	if (dev->ops->open) {
 		error = dev->ops->open(vcc,vpi,vci);
 		if (error) {
-			fops_put (dev->ops);
+			module_put(dev->ops->owner);
 			bind_vcc(vcc,NULL);
 			return error;
 		}
@@ -298,14 +296,13 @@
 	struct atm_dev *dev;
 	int return_val;
 
-	spin_lock (&atm_dev_lock);
-	dev = atm_find_dev(itf);
+	dev = atm_dev_lookup(itf);
 	if (!dev)
 		return_val =  -ENODEV;
-	else
+	else {
 		return_val = atm_do_connect_dev(vcc,dev,vpi,vci);
-
-	spin_unlock (&atm_dev_lock);
+		if (return_val) atm_dev_release(dev);
+	}
 
 	return return_val;
 }
@@ -336,15 +333,20 @@
 	}
 	else {
 		struct atm_dev *dev = NULL;
-		struct list_head *p;
+		struct list_head *p, *next;
 
-		spin_lock (&atm_dev_lock);
-		list_for_each(p, &atm_devs) {
+		spin_lock(&atm_dev_lock);
+		list_for_each_safe(p, next, &atm_devs) {
 			dev = list_entry(p, struct atm_dev, dev_list);
-			if (!atm_do_connect_dev(vcc,dev,vpi,vci)) break;
+			atm_dev_hold(dev);
+			spin_unlock(&atm_dev_lock);
+			if (!atm_do_connect_dev(vcc,dev,vpi,vci))
+				break;
+			atm_dev_release(dev);
 			dev = NULL;
+			spin_lock(&atm_dev_lock);
 		}
-		spin_unlock (&atm_dev_lock);
+		spin_unlock(&atm_dev_lock);
 		if (!dev) return -ENODEV;
 	}
 	if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)
@@ -562,7 +564,6 @@
 	int error,len,size,number, ret_val;
 
 	ret_val = 0;
-	spin_lock (&atm_dev_lock);
 	vcc = ATM_SD(sock);
 	switch (cmd) {
 		case SIOCOUTQ:
@@ -600,14 +601,17 @@
 				goto done;
 			}
 			size = 0;
+			spin_lock(&atm_dev_lock);
 			list_for_each(p, &atm_devs)
 				size += sizeof(int);
 			if (size > len) {
+				spin_unlock(&atm_dev_lock);
 				ret_val = -E2BIG;
 				goto done;
 			}
-			tmp_buf = kmalloc(size,GFP_KERNEL);
+			tmp_buf = kmalloc(size, GFP_ATOMIC);
 			if (!tmp_buf) {
+				spin_unlock(&atm_dev_lock);
 				ret_val = -ENOMEM;
 				goto done;
 			}
@@ -616,6 +620,7 @@
 				dev = list_entry(p, struct atm_dev, dev_list);
 				*tmp_p++ = dev->number;
 			}
+			spin_unlock(&atm_dev_lock);
 		        ret_val = ((copy_to_user(buf, tmp_buf, size)) ||
 			    put_user(size, &((struct atm_iobuf *) arg)->length)
 			    ) ? -EFAULT : 0;
@@ -840,7 +845,7 @@
 		ret_val = -EFAULT;
 		goto done;
 	}
-	if (!(dev = atm_find_dev(number))) {
+	if (!(dev = atm_dev_lookup(number))) {
 		ret_val = -ENODEV;
 		goto done;
 	}
@@ -851,14 +856,14 @@
 			size = strlen(dev->type)+1;
 			if (copy_to_user(buf,dev->type,size)) {
 				ret_val = -EFAULT;
-				goto done;
+				goto done_release;
 			}
 			break;
 		case ATM_GETESI:
 			size = ESI_LEN;
 			if (copy_to_user(buf,dev->esi,size)) {
 				ret_val = -EFAULT;
-				goto done;
+				goto done_release;
 			}
 			break;
 		case ATM_SETESI:
@@ -868,7 +873,7 @@
 				for (i = 0; i < ESI_LEN; i++)
 					if (dev->esi[i]) {
 						ret_val = -EEXIST;
-						goto done;
+						goto done_release;
 					}
 			}
 			/* fall through */
@@ -878,20 +883,20 @@
 
 				if (!capable(CAP_NET_ADMIN)) {
 					ret_val = -EPERM;
-					goto done;
+					goto done_release;
 				}
 				if (copy_from_user(esi,buf,ESI_LEN)) {
 					ret_val = -EFAULT;
-					goto done;
+					goto done_release;
 				}
 				memcpy(dev->esi,esi,ESI_LEN);
 				ret_val =  ESI_LEN;
-				goto done;
+				goto done_release;
 			}
 		case ATM_GETSTATZ:
 			if (!capable(CAP_NET_ADMIN)) {
 				ret_val = -EPERM;
-				goto done;
+				goto done_release;
 			}
 			/* fall through */
 		case ATM_GETSTAT:
@@ -899,27 +904,27 @@
 			error = fetch_stats(dev,buf,cmd == ATM_GETSTATZ);
 			if (error) {
 				ret_val = error;
-				goto done;
+				goto done_release;
 			}
 			break;
 		case ATM_GETCIRANGE:
 			size = sizeof(struct atm_cirange);
 			if (copy_to_user(buf,&dev->ci_range,size)) {
 				ret_val = -EFAULT;
-				goto done;
+				goto done_release;
 			}
 			break;
 		case ATM_GETLINKRATE:
 			size = sizeof(int);
 			if (copy_to_user(buf,&dev->link_rate,size)) {
 				ret_val = -EFAULT;
-				goto done;
+				goto done_release;
 			}
 			break;
 		case ATM_RSTADDR:
 			if (!capable(CAP_NET_ADMIN)) {
 				ret_val = -EPERM;
-				goto done;
+				goto done_release;
 			}
 			atm_reset_addr(dev);
 			break;
@@ -927,20 +932,20 @@
 		case ATM_DELADDR:
 			if (!capable(CAP_NET_ADMIN)) {
 				ret_val = -EPERM;
-				goto done;
+				goto done_release;
 			}
 			{
 				struct sockaddr_atmsvc addr;
 
 				if (copy_from_user(&addr,buf,sizeof(addr))) {
 					ret_val = -EFAULT;
-					goto done;
+					goto done_release;
 				}
 				if (cmd == ATM_ADDADDR)
 					ret_val = atm_add_addr(dev,&addr);
 				else
 					ret_val = atm_del_addr(dev,&addr);
-				goto done;
+				goto done_release;
 			}
 		case ATM_GETADDR:
 			size = atm_get_addr(dev,buf,len);
@@ -951,13 +956,13 @@
 			   write the length" */
 				ret_val = put_user(size,
 						   &((struct atmif_sioc *) arg)->length) ? -EFAULT : 0;
-			goto done;
+			goto done_release;
 		case ATM_SETLOOP:
 			if (__ATM_LM_XTRMT((int) (long) buf) &&
 			    __ATM_LM_XTLOC((int) (long) buf) >
 			    __ATM_LM_XTRMT((int) (long) buf)) {
 				ret_val = -EINVAL;
-				goto done;
+				goto done_release;
 			}
 			/* fall through */
 		case ATM_SETCIRANGE:
@@ -967,18 +972,18 @@
 		case SONET_SETFRAMING:
 			if (!capable(CAP_NET_ADMIN)) {
 				ret_val = -EPERM;
-				goto done;
+				goto done_release;
 			}
 			/* fall through */
 		default:
 			if (!dev->ops->ioctl) {
 				ret_val = -EINVAL;
-				goto done;
+				goto done_release;
 			}
 			size = dev->ops->ioctl(dev,cmd,buf);
 			if (size < 0) {
 				ret_val = (size == -ENOIOCTLCMD ? -EINVAL : size);
-				goto done;
+				goto done_release;
 			}
 	}
 	
@@ -987,9 +992,10 @@
 			-EFAULT : 0;
 	else
 		ret_val = 0;
+done_release:
+	atm_dev_release(dev);
 
- done:
-	spin_unlock (&atm_dev_lock); 
+done:
 	return ret_val;
 }
 
@@ -1204,3 +1210,43 @@
         return;
 }        
 #endif
+
+static int __init atm_init(void)
+{
+	int error;
+
+	if ((error = atmpvc_init()) < 0) {
+		printk(KERN_ERR "atmpvc_init() failed with %d\n", error);
+		goto failure;
+	}
+	if ((error = atmsvc_init()) < 0) {
+		printk(KERN_ERR "atmsvc_init() failed with %d\n", error);
+		goto failure;
+	}
+#ifdef CONFIG_PROC_FS
+        if ((error = atm_proc_init()) < 0) {
+		printk(KERN_ERR "atm_proc_init() failed with %d\n",error);
+		goto failure;
+	}
+#endif
+	return 0;
+
+failure:
+	atmsvc_exit();
+	atmpvc_exit();
+	return error;
+}
+
+static void __exit atm_exit(void)
+{
+#ifdef CONFIG_PROC_FS
+	atm_proc_exit();
+#endif
+	atmsvc_exit();
+	atmpvc_exit();
+}
+
+module_init(atm_init);
+module_exit(atm_exit);
+
+MODULE_LICENSE("GPL");
diff -urN linux-2.5.69-bk12/net/atm/common.h linux-2.5.69-bk13/net/atm/common.h
--- linux-2.5.69-bk12/net/atm/common.h	2003-05-04 16:53:36.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/common.h	2003-05-18 04:45:54.000000000 -0700
@@ -28,7 +28,12 @@
 void atm_release_vcc_sk(struct sock *sk,int free_sk);
 void atm_shutdown_dev(struct atm_dev *dev);
 
+int atmpvc_init(void);
+void atmpvc_exit(void);
+int atmsvc_init(void);
+void atmsvc_exit(void);
 int atm_proc_init(void);
+void atm_proc_exit(void);
 
 /* SVC */
 
diff -urN linux-2.5.69-bk12/net/atm/lec.c linux-2.5.69-bk13/net/atm/lec.c
--- linux-2.5.69-bk12/net/atm/lec.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/lec.c	2003-05-18 04:45:54.000000000 -0700
@@ -554,6 +554,7 @@
 	.ops	= &lecdev_ops,
 	.type	= "lec",
 	.number	= 999,	/* dummy device number */
+	.lock	= SPIN_LOCK_UNLOCKED
 };
 
 /*
diff -urN linux-2.5.69-bk12/net/atm/mpc.c linux-2.5.69-bk13/net/atm/mpc.c
--- linux-2.5.69-bk12/net/atm/mpc.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/mpc.c	2003-05-18 04:45:54.000000000 -0700
@@ -746,6 +746,7 @@
 	.ops	= &mpc_ops,
 	.type	= "mpc",
 	.number	= 42,
+	.lock	= SPIN_LOCK_UNLOCKED
 	/* members not explicitly initialised will be 0 */
 };
 
diff -urN linux-2.5.69-bk12/net/atm/proc.c linux-2.5.69-bk13/net/atm/proc.c
--- linux-2.5.69-bk12/net/atm/proc.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/proc.c	2003-05-18 04:45:54.000000000 -0700
@@ -86,6 +86,7 @@
 	add_stats(buf,"0",&dev->stats.aal0);
 	strcat(buf,"  ");
 	add_stats(buf,"5",&dev->stats.aal5);
+	sprintf(strchr(buf,0), "\t[%d]", atomic_read(&dev->refcnt));
 	strcat(buf,"\n");
 }
 
@@ -163,7 +164,7 @@
 #endif
 
 
-static void pvc_info(struct atm_vcc *vcc,char *buf)
+static void pvc_info(struct atm_vcc *vcc, char *buf, int clip_info)
 {
 	static const char *class_name[] = { "off","UBR","CBR","VBR","ABR" };
 	static const char *aal_name[] = {
@@ -180,20 +181,17 @@
 	    class_name[vcc->qos.rxtp.traffic_class],vcc->qos.txtp.min_pcr,
 	    class_name[vcc->qos.txtp.traffic_class]);
 #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
-	if (try_atm_clip_ops()) {
-		if (vcc->push == atm_clip_ops->clip_push) {
-			struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
-			struct net_device *dev;
-
-			dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : NULL;
-			off += sprintf(buf+off,"CLIP, Itf:%s, Encap:",
-			    dev ? dev->name : "none?");
-			if (clip_vcc->encap)
-				off += sprintf(buf+off,"LLC/SNAP");
-			else
-				off += sprintf(buf+off,"None");
-		}
-		module_put(atm_clip_ops->owner);
+	if (clip_info && (vcc->push == atm_clip_ops->clip_push)) {
+		struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
+		struct net_device *dev;
+
+		dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : NULL;
+		off += sprintf(buf+off,"CLIP, Itf:%s, Encap:",
+		    dev ? dev->name : "none?");
+		if (clip_vcc->encap)
+			off += sprintf(buf+off,"LLC/SNAP");
+		else
+			off += sprintf(buf+off,"None");
 	}
 #endif
 	strcpy(buf+off,"\n");
@@ -314,16 +312,19 @@
 
 	if (!pos) {
 		return sprintf(buf,"Itf Type    ESI/\"MAC\"addr "
-		    "AAL(TX,err,RX,err,drop) ...\n");
+		    "AAL(TX,err,RX,err,drop) ...               [refcnt]\n");
 	}
 	left = pos-1;
+	spin_lock(&atm_dev_lock);
 	list_for_each(p, &atm_devs) {
 		dev = list_entry(p, struct atm_dev, dev_list);
 		if (left-- == 0) {
 			dev_info(dev,buf);
+			spin_unlock(&atm_dev_lock);
 			return strlen(buf);
 		}
 	}
+	spin_unlock(&atm_dev_lock);
 	return 0;
 }
 
@@ -334,31 +335,50 @@
 
 static int atm_pvc_info(loff_t pos,char *buf)
 {
+	unsigned long flags;
 	struct atm_dev *dev;
 	struct list_head *p;
 	struct atm_vcc *vcc;
-	int left;
+	int left, clip_info = 0;
 
 	if (!pos) {
 		return sprintf(buf,"Itf VPI VCI   AAL RX(PCR,Class) "
 		    "TX(PCR,Class)\n");
 	}
 	left = pos-1;
+#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
+	if (try_atm_clip_ops())
+		clip_info = 1;
+#endif
+	spin_lock(&atm_dev_lock);
 	list_for_each(p, &atm_devs) {
 		dev = list_entry(p, struct atm_dev, dev_list);
+		spin_lock_irqsave(&dev->lock, flags);
 		for (vcc = dev->vccs; vcc; vcc = vcc->next)
-			if (vcc->sk->family == PF_ATMPVC &&
-			    vcc->dev && !left--) {
-				pvc_info(vcc,buf);
+			if (vcc->sk->family == PF_ATMPVC && vcc->dev && !left--) {
+				pvc_info(vcc,buf,clip_info);
+				spin_unlock_irqrestore(&dev->lock, flags);
+				spin_unlock(&atm_dev_lock);
+#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
+				if (clip_info)
+					module_put(atm_clip_ops->owner);
+#endif
 				return strlen(buf);
 			}
+		spin_unlock_irqrestore(&dev->lock, flags);
 	}
+	spin_unlock(&atm_dev_lock);
+#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
+	if (clip_info)
+		module_put(atm_clip_ops->owner);
+#endif
 	return 0;
 }
 
 
 static int atm_vc_info(loff_t pos,char *buf)
 {
+	unsigned long flags;
 	struct atm_dev *dev;
 	struct list_head *p;
 	struct atm_vcc *vcc;
@@ -369,19 +389,20 @@
 		    "Address"," Itf VPI VCI   Fam Flags Reply Send buffer"
 		    "     Recv buffer\n");
 	left = pos-1;
+	spin_lock(&atm_dev_lock);
 	list_for_each(p, &atm_devs) {
 		dev = list_entry(p, struct atm_dev, dev_list);
+		spin_lock_irqsave(&dev->lock, flags);
 		for (vcc = dev->vccs; vcc; vcc = vcc->next)
 			if (!left--) {
 				vc_info(vcc,buf);
+				spin_unlock_irqrestore(&dev->lock, flags);
+				spin_unlock(&atm_dev_lock);
 				return strlen(buf);
 			}
+		spin_unlock_irqrestore(&dev->lock, flags);
 	}
-	for (vcc = nodev_vccs; vcc; vcc = vcc->next)
-		if (!left--) {
-			vc_info(vcc,buf);
-			return strlen(buf);
-		}
+	spin_unlock(&atm_dev_lock);
 
 	return 0;
 }
@@ -389,6 +410,7 @@
 
 static int atm_svc_info(loff_t pos,char *buf)
 {
+	unsigned long flags;
 	struct atm_dev *dev;
 	struct list_head *p;
 	struct atm_vcc *vcc;
@@ -397,19 +419,21 @@
 	if (!pos)
 		return sprintf(buf,"Itf VPI VCI           State      Remote\n");
 	left = pos-1;
+	spin_lock(&atm_dev_lock);
 	list_for_each(p, &atm_devs) {
 		dev = list_entry(p, struct atm_dev, dev_list);
+		spin_lock_irqsave(&dev->lock, flags);
 		for (vcc = dev->vccs; vcc; vcc = vcc->next)
 			if (vcc->sk->family == PF_ATMSVC && !left--) {
 				svc_info(vcc,buf);
+				spin_unlock_irqrestore(&dev->lock, flags);
+				spin_unlock(&atm_dev_lock);
 				return strlen(buf);
 			}
+		spin_unlock_irqrestore(&dev->lock, flags);
 	}
-	for (vcc = nodev_vccs; vcc; vcc = vcc->next)
-		if (vcc->sk->family == PF_ATMSVC && !left--) {
-			svc_info(vcc,buf);
-			return strlen(buf);
-		}
+	spin_unlock(&atm_dev_lock);
+
 	return 0;
 }
 
@@ -608,12 +632,28 @@
     name->proc_fops = &proc_spec_atm_operations; \
     name->owner = THIS_MODULE
 
+static struct proc_dir_entry *devices = NULL, *pvc = NULL,
+		*svc = NULL, *arp = NULL, *lec = NULL, *vc = NULL;
 
-int __init atm_proc_init(void)
+static void atm_proc_cleanup(void)
 {
-	struct proc_dir_entry *devices = NULL,*pvc = NULL,*svc = NULL;
-	struct proc_dir_entry *arp = NULL,*lec = NULL,*vc = NULL;
+	if (devices)
+		remove_proc_entry("devices",atm_proc_root);
+	if (pvc)
+		remove_proc_entry("pvc",atm_proc_root);
+	if (svc)
+		remove_proc_entry("svc",atm_proc_root);
+	if (arp)
+		remove_proc_entry("arp",atm_proc_root);
+	if (lec)
+		remove_proc_entry("lec",atm_proc_root);
+	if (vc)
+		remove_proc_entry("vc",atm_proc_root);
+	remove_proc_entry("net/atm",NULL);
+}
 
+int __init atm_proc_init(void)
+{
 	atm_proc_root = proc_mkdir("net/atm",NULL);
 	if (!atm_proc_root)
 		return -ENOMEM;
@@ -630,12 +670,11 @@
 	return 0;
 
 cleanup:
-	if (devices) remove_proc_entry("devices",atm_proc_root);
-	if (pvc) remove_proc_entry("pvc",atm_proc_root);
-	if (svc) remove_proc_entry("svc",atm_proc_root);
-	if (arp) remove_proc_entry("arp",atm_proc_root);
-	if (lec) remove_proc_entry("lec",atm_proc_root);
-	if (vc) remove_proc_entry("vc",atm_proc_root);
-	remove_proc_entry("net/atm",NULL);
+	atm_proc_cleanup();
 	return -ENOMEM;
 }
+
+void atm_proc_exit(void)
+{
+	atm_proc_cleanup();
+}
diff -urN linux-2.5.69-bk12/net/atm/pvc.c linux-2.5.69-bk13/net/atm/pvc.c
--- linux-2.5.69-bk12/net/atm/pvc.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/pvc.c	2003-05-18 04:45:54.000000000 -0700
@@ -116,20 +116,12 @@
  */
 
 
-static int __init atmpvc_init(void)
+int __init atmpvc_init(void)
 {
-	int error;
-
-	error = sock_register(&pvc_family_ops);
-	if (error < 0) {
-		printk(KERN_ERR "ATMPVC: can't register (%d)",error);
-		return error;
-	}
-#ifdef CONFIG_PROC_FS
-	error = atm_proc_init();
-	if (error) printk("atm_proc_init fails with %d\n",error);
-#endif
-	return 0;
+	return sock_register(&pvc_family_ops);
 }
 
-module_init(atmpvc_init);
+void atmpvc_exit(void)
+{
+	sock_unregister(PF_ATMPVC);
+}
diff -urN linux-2.5.69-bk12/net/atm/resources.c linux-2.5.69-bk13/net/atm/resources.c
--- linux-2.5.69-bk12/net/atm/resources.c	2003-05-04 16:53:41.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/resources.c	2003-05-18 04:45:54.000000000 -0700
@@ -27,10 +27,8 @@
 
 
 LIST_HEAD(atm_devs);
-struct atm_vcc *nodev_vccs = NULL;
-extern spinlock_t atm_dev_lock;
+spinlock_t atm_dev_lock = SPIN_LOCK_UNLOCKED;
 
-/* Caller must hold atm_dev_lock. */
 static struct atm_dev *__alloc_atm_dev(const char *type)
 {
 	struct atm_dev *dev;
@@ -42,67 +40,78 @@
 	dev->type = type;
 	dev->signal = ATM_PHY_SIG_UNKNOWN;
 	dev->link_rate = ATM_OC3_PCR;
-	list_add_tail(&dev->dev_list, &atm_devs);
+	spin_lock_init(&dev->lock);
 
 	return dev;
 }
 
-/* Caller must hold atm_dev_lock. */
 static void __free_atm_dev(struct atm_dev *dev)
 {
-	list_del(&dev->dev_list);
 	kfree(dev);
 }
 
-/* Caller must hold atm_dev_lock. */
-struct atm_dev *atm_find_dev(int number)
+static struct atm_dev *__atm_dev_lookup(int number)
 {
 	struct atm_dev *dev;
 	struct list_head *p;
 
 	list_for_each(p, &atm_devs) {
 		dev = list_entry(p, struct atm_dev, dev_list);
-		if (dev->ops && dev->number == number)
+		if ((dev->ops) && (dev->number == number)) {
+			atm_dev_hold(dev);
 			return dev;
+		}
 	}
 	return NULL;
 }
 
-
-struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
-				 int number, unsigned long *flags)
+struct atm_dev *atm_dev_lookup(int number)
 {
 	struct atm_dev *dev;
 
 	spin_lock(&atm_dev_lock);
+	dev = __atm_dev_lookup(number);
+	spin_unlock(&atm_dev_lock);
+	return dev;
+}
+
+struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
+				 int number, unsigned long *flags)
+{
+	struct atm_dev *dev, *inuse;
 
 	dev = __alloc_atm_dev(type);
 	if (!dev) {
 		printk(KERN_ERR "atm_dev_register: no space for dev %s\n",
 		    type);
-		goto done;
+		return NULL;
 	}
+	spin_lock(&atm_dev_lock);
 	if (number != -1) {
-		if (atm_find_dev(number)) {
+		if ((inuse = __atm_dev_lookup(number))) {
+			atm_dev_release(inuse);
+			spin_unlock(&atm_dev_lock);
 			__free_atm_dev(dev);
-			dev = NULL;
-			goto done;
+			return NULL;
 		}
 		dev->number = number;
 	} else {
 		dev->number = 0;
-		while (atm_find_dev(dev->number))
+		while ((inuse = __atm_dev_lookup(dev->number))) {
+			atm_dev_release(inuse);
 			dev->number++;
+		}
 	}
-	dev->vccs = dev->last = NULL;
-	dev->dev_data = NULL;
-	barrier();
+
 	dev->ops = ops;
 	if (flags)
 		dev->flags = *flags;
 	else
 		memset(&dev->flags, 0, sizeof(dev->flags));
 	memset(&dev->stats, 0, sizeof(dev->stats));
+	atomic_set(&dev->refcnt, 1);
+	list_add_tail(&dev->dev_list, &atm_devs);
+	spin_unlock(&atm_dev_lock);
 
 #ifdef CONFIG_PROC_FS
 	if (ops->proc_read) {
@@ -110,33 +119,50 @@
 			printk(KERN_ERR "atm_dev_register: "
 			       "atm_proc_dev_register failed for dev %s\n",
 			       type);
+			spin_lock(&atm_dev_lock);
+			list_del(&dev->dev_list);
+			spin_unlock(&atm_dev_lock);
 			__free_atm_dev(dev);
-			dev = NULL;
-			goto done;
+			return NULL;
 		}
 	}
 #endif
 
-done:
-	spin_unlock(&atm_dev_lock);
 	return dev;
 }
 
 
 void atm_dev_deregister(struct atm_dev *dev)
 {
+	unsigned long warning_time;
+
 #ifdef CONFIG_PROC_FS
 	if (dev->ops->proc_read)
 		atm_proc_dev_deregister(dev);
 #endif
 	spin_lock(&atm_dev_lock);
-	__free_atm_dev(dev);
+	list_del(&dev->dev_list);
 	spin_unlock(&atm_dev_lock);
+
+        warning_time = jiffies;
+        while (atomic_read(&dev->refcnt) != 1) {
+                current->state = TASK_INTERRUPTIBLE;
+                schedule_timeout(HZ / 4);
+                current->state = TASK_RUNNING;
+                if ((jiffies - warning_time) > 10 * HZ) {
+                        printk(KERN_EMERG "atm_dev_deregister: waiting for "
+                               "dev %d to become free. Usage count = %d\n",
+                               dev->number, atomic_read(&dev->refcnt));
+                        warning_time = jiffies;
+                }
+        }
+
+	__free_atm_dev(dev);
 }
 
 void shutdown_atm_dev(struct atm_dev *dev)
 {
-	if (dev->vccs) {
+	if (atomic_read(&dev->refcnt) > 1) {
 		set_bit(ATM_DF_CLOSE, &dev->flags);
 		return;
 	}
@@ -161,44 +187,44 @@
 	sock_init_data(NULL, sk);
 	memset(vcc, 0, sizeof(*vcc));
 	vcc->sk = sk;
-	if (nodev_vccs)
-		nodev_vccs->prev = vcc;
-	vcc->prev = NULL;
-	vcc->next = nodev_vccs;
-	nodev_vccs = vcc;
+
 	return sk;
 }
 
 
-static void unlink_vcc(struct atm_vcc *vcc,struct atm_dev *hold_dev)
+static void unlink_vcc(struct atm_vcc *vcc)
 {
-	if (vcc->prev)
-		vcc->prev->next = vcc->next;
-	else if (vcc->dev)
-		vcc->dev->vccs = vcc->next;
-	else
-		nodev_vccs = vcc->next;
-	if (vcc->next)
-		vcc->next->prev = vcc->prev;
-	else if (vcc->dev)
-		vcc->dev->last = vcc->prev;
-	if (vcc->dev && vcc->dev != hold_dev && !vcc->dev->vccs &&
-	    test_bit(ATM_DF_CLOSE,&vcc->dev->flags))
-		shutdown_atm_dev(vcc->dev);
+	unsigned long flags;
+	if (vcc->dev) {
+		spin_lock_irqsave(&vcc->dev->lock, flags);
+		if (vcc->prev)
+			vcc->prev->next = vcc->next;
+		else
+			vcc->dev->vccs = vcc->next;
+
+		if (vcc->next)
+			vcc->next->prev = vcc->prev;
+		else
+			vcc->dev->last = vcc->prev;
+		spin_unlock_irqrestore(&vcc->dev->lock, flags);
+	}
 }
 
 
 void free_atm_vcc_sk(struct sock *sk)
 {
-	unlink_vcc(atm_sk(sk), NULL);
+	unlink_vcc(atm_sk(sk));
 	sk_free(sk);
 }
 
 void bind_vcc(struct atm_vcc *vcc,struct atm_dev *dev)
 {
-	unlink_vcc(vcc,dev);
+	unsigned long flags;
+
+	unlink_vcc(vcc);
 	vcc->dev = dev;
 	if (dev) {
+		spin_lock_irqsave(&dev->lock, flags);
 		vcc->next = NULL;
 		vcc->prev = dev->last;
 		if (dev->vccs)
@@ -206,17 +232,12 @@
 		else
 			dev->vccs = vcc;
 		dev->last = vcc;
-	} else {
-		if (nodev_vccs)
-			nodev_vccs->prev = vcc;
-		vcc->next = nodev_vccs;
-		vcc->prev = NULL;
-		nodev_vccs = vcc;
+		spin_unlock_irqrestore(&dev->lock, flags);
 	}
 }
 
 EXPORT_SYMBOL(atm_dev_register);
 EXPORT_SYMBOL(atm_dev_deregister);
-EXPORT_SYMBOL(atm_find_dev);
+EXPORT_SYMBOL(atm_dev_lookup);
 EXPORT_SYMBOL(shutdown_atm_dev);
 EXPORT_SYMBOL(bind_vcc);
diff -urN linux-2.5.69-bk12/net/atm/resources.h linux-2.5.69-bk13/net/atm/resources.h
--- linux-2.5.69-bk12/net/atm/resources.h	2003-05-04 16:53:37.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/resources.h	2003-05-18 04:45:54.000000000 -0700
@@ -11,7 +11,7 @@
 
 
 extern struct list_head atm_devs;
-extern struct atm_vcc *nodev_vccs; /* VCCs not linked to any device */
+extern spinlock_t atm_dev_lock;
 
 
 struct sock *alloc_atm_vcc_sk(int family);
diff -urN linux-2.5.69-bk12/net/atm/signaling.c linux-2.5.69-bk13/net/atm/signaling.c
--- linux-2.5.69-bk12/net/atm/signaling.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/signaling.c	2003-05-18 04:45:54.000000000 -0700
@@ -33,7 +33,6 @@
 struct atm_vcc *sigd = NULL;
 static DECLARE_WAIT_QUEUE_HEAD(sigd_sleep);
 
-extern spinlock_t atm_dev_lock;
 
 static void sigd_put_skb(struct sk_buff *skb)
 {
@@ -211,6 +210,7 @@
 
 static void sigd_close(struct atm_vcc *vcc)
 {
+	unsigned long flags;
 	struct atm_dev *dev;
 	struct list_head *p;
 
@@ -219,33 +219,29 @@
 	if (skb_peek(&vcc->sk->receive_queue))
 		printk(KERN_ERR "sigd_close: closing with requests pending\n");
 	skb_queue_purge(&vcc->sk->receive_queue);
-	purge_vccs(nodev_vccs);
 
-	spin_lock (&atm_dev_lock);
+	spin_lock(&atm_dev_lock);
 	list_for_each(p, &atm_devs) {
 		dev = list_entry(p, struct atm_dev, dev_list);
+		spin_lock_irqsave(&dev->lock, flags);
 		purge_vccs(dev->vccs);
+		spin_unlock_irqrestore(&dev->lock, flags);
 	}
-	spin_unlock (&atm_dev_lock);
+	spin_unlock(&atm_dev_lock);
 }
 
 
 static struct atmdev_ops sigd_dev_ops = {
-	.close =sigd_close,
+	.close = sigd_close,
 	.send =	sigd_send
 };
 
 
 static struct atm_dev sigd_dev = {
-	&sigd_dev_ops,
-	NULL,		/* no PHY */
-    	"sig",		/* type */
-	999,		/* dummy device number */
-	NULL,NULL,	/* pretend not to have any VCCs */
-	NULL,NULL,	/* no data */
-	0,		/* no flags */
-	NULL,		/* no local address */
-	{ 0 }		/* no ESI, no statistics */
+	.ops =		&sigd_dev_ops,
+	.type =		"sig",
+	.number =	999,
+	.lock =		SPIN_LOCK_UNLOCKED
 };
 
 
diff -urN linux-2.5.69-bk12/net/atm/svc.c linux-2.5.69-bk13/net/atm/svc.c
--- linux-2.5.69-bk12/net/atm/svc.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/atm/svc.c	2003-05-18 04:45:54.000000000 -0700
@@ -439,13 +439,12 @@
  *	Initialize the ATM SVC protocol family
  */
 
-static int __init atmsvc_init(void)
+int __init atmsvc_init(void)
 {
-	if (sock_register(&svc_family_ops) < 0) {
-		printk(KERN_ERR "ATMSVC: can't register");
-		return -1;
-	}
-	return 0;
+	return sock_register(&svc_family_ops);
 }
 
-module_init(atmsvc_init);
+void atmsvc_exit(void)
+{
+	sock_unregister(PF_ATMSVC);
+}
diff -urN linux-2.5.69-bk12/net/bluetooth/af_bluetooth.c linux-2.5.69-bk13/net/bluetooth/af_bluetooth.c
--- linux-2.5.69-bk12/net/bluetooth/af_bluetooth.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/bluetooth/af_bluetooth.c	2003-05-18 04:45:54.000000000 -0700
@@ -99,9 +99,7 @@
 
 #if defined(CONFIG_KMOD)
 	if (!bt_proto[proto]) {
-		char module_name[30];
-		sprintf(module_name, "bt-proto-%d", proto);
-		request_module(module_name);
+		request_module("bt-proto-%d", proto);
 	}
 #endif
 	err = -EPROTONOSUPPORT;
diff -urN linux-2.5.69-bk12/net/bridge/netfilter/ebtables.c linux-2.5.69-bk13/net/bridge/netfilter/ebtables.c
--- linux-2.5.69-bk12/net/bridge/netfilter/ebtables.c	2003-05-04 16:53:09.000000000 -0700
+++ linux-2.5.69-bk13/net/bridge/netfilter/ebtables.c	2003-05-18 04:45:54.000000000 -0700
@@ -319,10 +319,7 @@
 
 	ret = find_inlist_lock_noload(head, name, error, mutex);
 	if (!ret) {
-		char modulename[EBT_FUNCTION_MAXNAMELEN + strlen(prefix) + 1];
-		strcpy(modulename, prefix);
-		strcat(modulename, name);
-		request_module(modulename);
+		request_module("%s%s", prefix, name);
 		ret = find_inlist_lock_noload(head, name, error, mutex);
 	}
 	return ret;
diff -urN linux-2.5.69-bk12/net/core/Makefile linux-2.5.69-bk13/net/core/Makefile
--- linux-2.5.69-bk12/net/core/Makefile	2003-05-04 16:53:41.000000000 -0700
+++ linux-2.5.69-bk13/net/core/Makefile	2003-05-18 04:45:54.000000000 -0700
@@ -10,7 +10,7 @@
 endif
 endif
 
-obj-$(CONFIG_NET) += dev.o dev_mcast.o dst.o neighbour.o rtnetlink.o utils.o link_watch.o filter.o
+obj-$(CONFIG_NET) += flow.o dev.o dev_mcast.o dst.o neighbour.o rtnetlink.o utils.o link_watch.o filter.o
 
 obj-$(CONFIG_NETFILTER) += netfilter.o
 obj-$(CONFIG_NET_DIVERT) += dv.o
diff -urN linux-2.5.69-bk12/net/core/dev.c linux-2.5.69-bk13/net/core/dev.c
--- linux-2.5.69-bk12/net/core/dev.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/core/dev.c	2003-05-18 04:45:54.000000000 -0700
@@ -721,7 +721,7 @@
 void dev_load(const char *name)
 {
 	if (!dev_get(name) && capable(CAP_SYS_MODULE))
-		request_module(name);
+		request_module("%s", name);
 }
 
 #else
diff -urN linux-2.5.69-bk12/net/core/flow.c linux-2.5.69-bk13/net/core/flow.c
--- linux-2.5.69-bk12/net/core/flow.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.69-bk13/net/core/flow.c	2003-05-18 04:45:54.000000000 -0700
@@ -0,0 +1,254 @@
+/* flow.c: Generic flow cache.
+ *
+ * Copyright (C) 2003 Alexey N. Kuznetsov (kuznet@ms2.inr.ac.ru)
+ * Copyright (C) 2003 David S. Miller (davem@redhat.com)
+ */
+
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/jhash.h>
+#include <linux/interrupt.h>
+#include <linux/mm.h>
+#include <linux/random.h>
+#include <linux/init.h>
+#include <net/flow.h>
+#include <asm/atomic.h>
+
+struct flow_cache_entry {
+	struct flow_cache_entry	*next;
+	u16			family;
+	u8			dir;
+	struct flowi		key;
+	u32			genid;
+	void			*object;
+	atomic_t		*object_ref;
+};
+
+atomic_t flow_cache_genid = ATOMIC_INIT(0);
+
+static u32 flow_hash_shift;
+#define flow_hash_size	(1 << flow_hash_shift)
+static struct flow_cache_entry **flow_table;
+static kmem_cache_t *flow_cachep;
+
+static int flow_lwm, flow_hwm;
+
+struct flow_percpu_info {
+	int hash_rnd_recalc;
+	u32 hash_rnd;
+	int count;
+} ____cacheline_aligned;
+static struct flow_percpu_info flow_hash_info[NR_CPUS];
+
+#define flow_hash_rnd_recalc(cpu)	(flow_hash_info[cpu].hash_rnd_recalc)
+#define flow_hash_rnd(cpu)		(flow_hash_info[cpu].hash_rnd)
+#define flow_count(cpu)			(flow_hash_info[cpu].count)
+
+static struct timer_list flow_hash_rnd_timer;
+
+#define FLOW_HASH_RND_PERIOD	(10 * 60 * HZ)
+
+static void flow_cache_new_hashrnd(unsigned long arg)
+{
+	int i;
+
+	for (i = 0; i < NR_CPUS; i++)
+		flow_hash_rnd_recalc(i) = 1;
+
+	flow_hash_rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD;
+	add_timer(&flow_hash_rnd_timer);
+}
+
+static void __flow_cache_shrink(int cpu, int shrink_to)
+{
+	struct flow_cache_entry *fle, **flp;
+	int i;
+
+	for (i = 0; i < flow_hash_size; i++) {
+		int k = 0;
+
+		flp = &flow_table[cpu*flow_hash_size+i];
+		while ((fle = *flp) != NULL && k < shrink_to) {
+			k++;
+			flp = &fle->next;
+		}
+		while ((fle = *flp) != NULL) {
+			*flp = fle->next;
+			if (fle->object)
+				atomic_dec(fle->object_ref);
+			kmem_cache_free(flow_cachep, fle);
+			flow_count(cpu)--;
+		}
+	}
+}
+
+static void flow_cache_shrink(int cpu)
+{
+	int shrink_to = flow_lwm / flow_hash_size;
+
+	__flow_cache_shrink(cpu, shrink_to);
+}
+
+static void flow_new_hash_rnd(int cpu)
+{
+	get_random_bytes(&flow_hash_rnd(cpu), sizeof(u32));
+	flow_hash_rnd_recalc(cpu) = 0;
+
+	__flow_cache_shrink(cpu, 0);
+}
+
+static u32 flow_hash_code(struct flowi *key, int cpu)
+{
+	u32 *k = (u32 *) key;
+
+	return (jhash2(k, (sizeof(*key) / sizeof(u32)), flow_hash_rnd(cpu)) &
+		(flow_hash_size - 1));
+}
+
+#if (BITS_PER_LONG == 64)
+typedef u64 flow_compare_t;
+#else
+typedef u32 flow_compare_t;
+#endif
+
+extern void flowi_is_missized(void);
+
+/* I hear what you're saying, use memcmp.  But memcmp cannot make
+ * important assumptions that we can here, such as alignment and
+ * constant size.
+ */
+static int flow_key_compare(struct flowi *key1, struct flowi *key2)
+{
+	flow_compare_t *k1, *k1_lim, *k2;
+	const int n_elem = sizeof(struct flowi) / sizeof(flow_compare_t);
+
+	if (sizeof(struct flowi) % sizeof(flow_compare_t))
+		flowi_is_missized();
+
+	k1 = (flow_compare_t *) key1;
+	k1_lim = k1 + n_elem;
+
+	k2 = (flow_compare_t *) key2;
+
+	do {
+		if (*k1++ != *k2++)
+			return 1;
+	} while (k1 < k1_lim);
+
+	return 0;
+}
+
+void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir,
+			flow_resolve_t resolver)
+{
+	struct flow_cache_entry *fle, **head;
+	unsigned int hash;
+	int cpu;
+
+	local_bh_disable();
+	cpu = smp_processor_id();
+	if (flow_hash_rnd_recalc(cpu))
+		flow_new_hash_rnd(cpu);
+	hash = flow_hash_code(key, cpu);
+
+	head = &flow_table[(cpu << flow_hash_shift) + hash];
+	for (fle = *head; fle; fle = fle->next) {
+		if (fle->family == family &&
+		    fle->dir == dir &&
+		    flow_key_compare(key, &fle->key) == 0) {
+			if (fle->genid == atomic_read(&flow_cache_genid)) {
+				void *ret = fle->object;
+
+				if (ret)
+					atomic_inc(fle->object_ref);
+				local_bh_enable();
+
+				return ret;
+			}
+			break;
+		}
+	}
+
+	{
+		void *obj;
+		atomic_t *obj_ref;
+
+		resolver(key, family, dir, &obj, &obj_ref);
+
+		if (fle) {
+			fle->genid = atomic_read(&flow_cache_genid);
+
+			if (fle->object)
+				atomic_dec(fle->object_ref);
+
+			fle->object = obj;
+			fle->object_ref = obj_ref;
+			if (obj)
+				atomic_inc(fle->object_ref);
+		} else {
+			if (flow_count(cpu) > flow_hwm)
+				flow_cache_shrink(cpu);
+
+			fle = kmem_cache_alloc(flow_cachep, SLAB_ATOMIC);
+			if (fle) {
+				fle->next = *head;
+				*head = fle;
+				fle->family = family;
+				fle->dir = dir;
+				memcpy(&fle->key, key, sizeof(*key));
+				fle->genid = atomic_read(&flow_cache_genid);
+				fle->object = obj;
+				fle->object_ref = obj_ref;
+
+				flow_count(cpu)++;
+			}
+		}
+		local_bh_enable();
+
+		return obj;
+	}
+}
+
+static int __init flow_cache_init(void)
+{
+	unsigned long order;
+	int i;
+
+	flow_cachep = kmem_cache_create("flow_cache",
+					sizeof(struct flow_cache_entry),
+					0, SLAB_HWCACHE_ALIGN,
+					NULL, NULL);
+
+	if (!flow_cachep)
+		panic("NET: failed to allocate flow cache slab\n");
+
+	flow_hash_shift = 10;
+	flow_lwm = 2 * flow_hash_size;
+	flow_hwm = 4 * flow_hash_size;
+
+	for (i = 0; i < NR_CPUS; i++)
+		flow_hash_rnd_recalc(i) = 1;
+
+	init_timer(&flow_hash_rnd_timer);
+	flow_hash_rnd_timer.function = flow_cache_new_hashrnd;
+	flow_hash_rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD;
+	add_timer(&flow_hash_rnd_timer);
+
+	for (order = 0;
+	     (PAGE_SIZE << order) <
+		     (NR_CPUS*sizeof(struct flow_entry *)*flow_hash_size);
+	     order++)
+		/* NOTHING */;
+
+	flow_table = (struct flow_cache_entry **)
+		__get_free_pages(GFP_ATOMIC, order);
+
+	if (!flow_table)
+		panic("Failed to allocate flow cache hash table\n");
+
+	memset(flow_table, 0, PAGE_SIZE << order);
+
+	return 0;
+}
+
+module_init(flow_cache_init);
diff -urN linux-2.5.69-bk12/net/ipv4/af_inet.c linux-2.5.69-bk13/net/ipv4/af_inet.c
--- linux-2.5.69-bk12/net/ipv4/af_inet.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/af_inet.c	2003-05-18 04:45:54.000000000 -0700
@@ -398,7 +398,7 @@
 	sk->protocol	= protocol;
 	sk->backlog_rcv = sk->prot->backlog_rcv;
 
-	inet->ttl	= sysctl_ip_default_ttl;
+	inet->uc_ttl	= -1;
 	inet->mc_loop	= 1;
 	inet->mc_ttl	= 1;
 	inet->mc_index	= 0;
diff -urN linux-2.5.69-bk12/net/ipv4/icmp.c linux-2.5.69-bk13/net/ipv4/icmp.c
--- linux-2.5.69-bk12/net/ipv4/icmp.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/icmp.c	2003-05-18 04:45:54.000000000 -0700
@@ -185,8 +185,6 @@
 	},
 };
 
-extern int sysctl_ip_default_ttl;
-
 /* Control parameters for ECHO replies. */
 int sysctl_icmp_echo_ignore_all;
 int sysctl_icmp_echo_ignore_broadcasts;
@@ -384,7 +382,6 @@
 	icmp_out_count(icmp_param->data.icmph.type);
 
 	inet->tos = skb->nh.iph->tos;
-	inet->ttl = sysctl_ip_default_ttl;
 	daddr = ipc.addr = rt->rt_src;
 	ipc.opt = NULL;
 	if (icmp_param->replyopts.optlen) {
@@ -539,7 +536,6 @@
 	icmp_param.offset = skb_in->nh.raw - skb_in->data;
 	icmp_out_count(icmp_param.data.icmph.type);
 	inet_sk(icmp_socket->sk)->tos = tos;
-	inet_sk(icmp_socket->sk)->ttl = sysctl_ip_default_ttl;
 	ipc.addr = iph->saddr;
 	ipc.opt = &icmp_param.replyopts;
 	if (icmp_param.replyopts.srr) {
@@ -1126,7 +1122,7 @@
 		per_cpu(__icmp_socket, i)->sk->allocation = GFP_ATOMIC;
 		per_cpu(__icmp_socket, i)->sk->sndbuf = SK_WMEM_MAX * 2;
 		inet = inet_sk(per_cpu(__icmp_socket, i)->sk);
-		inet->ttl = MAXTTL;
+		inet->uc_ttl = -1;
 		inet->pmtudisc = IP_PMTUDISC_DONT;
 
 		/* Unhash it so that IP input processing does not even
diff -urN linux-2.5.69-bk12/net/ipv4/ip_gre.c linux-2.5.69-bk13/net/ipv4/ip_gre.c
--- linux-2.5.69-bk12/net/ipv4/ip_gre.c	2003-05-04 16:53:36.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/ip_gre.c	2003-05-18 04:45:54.000000000 -0700
@@ -860,7 +860,7 @@
 			iph->ttl = ((struct ipv6hdr*)old_iph)->hop_limit;
 #endif
 		else
-			iph->ttl = sysctl_ip_default_ttl;
+			iph->ttl = dst_metric(&rt->u.dst, RTAX_HOPLIMIT);
 	}
 
 	((u16*)(iph+1))[0] = tunnel->parms.o_flags;
diff -urN linux-2.5.69-bk12/net/ipv4/ip_output.c linux-2.5.69-bk13/net/ipv4/ip_output.c
--- linux-2.5.69-bk12/net/ipv4/ip_output.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/ip_output.c	2003-05-18 04:45:54.000000000 -0700
@@ -112,6 +112,15 @@
 	return 0;
 }
 
+static inline int ip_select_ttl(struct inet_opt *inet, struct dst_entry *dst)
+{
+	int ttl = inet->uc_ttl;
+
+	if (ttl < 0)
+		ttl = dst_metric(dst, RTAX_HOPLIMIT);
+	return ttl;
+}
+
 /* 
  *		Add an ip header to a skbuff and send it out.
  *
@@ -136,7 +145,7 @@
 		iph->frag_off = htons(IP_DF);
 	else
 		iph->frag_off = 0;
-	iph->ttl      = inet->ttl;
+	iph->ttl      = ip_select_ttl(inet, &rt->u.dst);
 	iph->daddr    = rt->rt_dst;
 	iph->saddr    = rt->rt_src;
 	iph->protocol = sk->protocol;
@@ -341,7 +350,7 @@
 		iph->frag_off = htons(IP_DF);
 	else
 		iph->frag_off = 0;
-	iph->ttl      = inet->ttl;
+	iph->ttl      = ip_select_ttl(inet, &rt->u.dst);
 	iph->protocol = sk->protocol;
 	iph->saddr    = rt->rt_src;
 	iph->daddr    = rt->rt_dst;
@@ -1120,7 +1129,7 @@
 	if (rt->rt_type == RTN_MULTICAST)
 		ttl = inet->mc_ttl;
 	else
-		ttl = inet->ttl;
+		ttl = ip_select_ttl(inet, &rt->u.dst);
 
 	iph = (struct iphdr *)skb->data;
 	iph->version = 4;
diff -urN linux-2.5.69-bk12/net/ipv4/ip_sockglue.c linux-2.5.69-bk13/net/ipv4/ip_sockglue.c
--- linux-2.5.69-bk12/net/ipv4/ip_sockglue.c	2003-05-04 16:53:08.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/ip_sockglue.c	2003-05-18 04:45:54.000000000 -0700
@@ -501,11 +501,9 @@
 		case IP_TTL:
 			if (optlen<1)
 				goto e_inval;
-			if(val==-1)
-				val = sysctl_ip_default_ttl;
-			if(val<1||val>255)
+			if (val != -1 && (val < 1 || val>255))
 				goto e_inval;
-			inet->ttl = val;
+			inet->uc_ttl = val;
 			break;
 		case IP_HDRINCL:
 			if(sk->type!=SOCK_RAW) {
@@ -911,7 +909,9 @@
 			val = inet->tos;
 			break;
 		case IP_TTL:
-			val = inet->ttl;
+			val = (inet->uc_ttl == -1 ?
+			       sysctl_ip_default_ttl :
+			       inet->uc_ttl);
 			break;
 		case IP_HDRINCL:
 			val = inet->hdrincl;
diff -urN linux-2.5.69-bk12/net/ipv4/ipcomp.c linux-2.5.69-bk13/net/ipv4/ipcomp.c
--- linux-2.5.69-bk12/net/ipv4/ipcomp.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/ipcomp.c	2003-05-18 04:45:54.000000000 -0700
@@ -1,5 +1,5 @@
 /*
- * IP Payload Compression Protocol (IPComp) - RFC3713.
+ * IP Payload Compression Protocol (IPComp) - RFC3173.
  *
  * Copyright (c) 2003 James Morris <jmorris@intercode.com.au>
  *
@@ -22,20 +22,7 @@
 #include <net/xfrm.h>
 #include <net/icmp.h>
 #include <net/esp.h>
-
-#define IPCOMP_SCRATCH_SIZE	65400
-
-struct ipcomp_hdr {
-	u8 nexthdr;
-	u8 flags;
-	u16 cpi;
-};
-
-struct ipcomp_data {
-	u16 threshold;
-	u8 *scratch;
-	struct crypto_tfm *tfm;
-};
+#include <net/ipcomp.h>
 
 static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb)
 {
@@ -52,7 +39,7 @@
 	if (err)
 		goto out;
 
-	if (dlen < (plen + sizeof(struct ipcomp_hdr))) {
+	if (dlen < (plen + sizeof(struct ip_comp_hdr))) {
 		err = -EINVAL;
 		goto out;
 	}
@@ -93,11 +80,11 @@
 	iph = skb->nh.iph;
 	memcpy(&tmp_iph, iph, iph->ihl * 4);
 	nexthdr = *(u8 *)skb->data;
-	skb_pull(skb, sizeof(struct ipcomp_hdr));
-	skb->nh.raw += sizeof(struct ipcomp_hdr);
+	skb_pull(skb, sizeof(struct ip_comp_hdr));
+	skb->nh.raw += sizeof(struct ip_comp_hdr);
 	memcpy(skb->nh.raw, &tmp_iph, tmp_iph.iph.ihl * 4);
 	iph = skb->nh.iph;
-	iph->tot_len = htons(ntohs(iph->tot_len) - sizeof(struct ipcomp_hdr));
+	iph->tot_len = htons(ntohs(iph->tot_len) - sizeof(struct ip_comp_hdr));
 	iph->protocol = nexthdr;
 	skb->h.raw = skb->data;
 	err = ipcomp_decompress(x, skb);
@@ -122,7 +109,7 @@
 	if (err)
 		goto out;
 
-	if ((dlen + sizeof(struct ipcomp_hdr)) >= plen) {
+	if ((dlen + sizeof(struct ip_comp_hdr)) >= plen) {
 		err = -EMSGSIZE;
 		goto out;
 	}
@@ -162,7 +149,7 @@
 	struct dst_entry *dst = skb->dst;
 	struct xfrm_state *x = dst->xfrm;
 	struct iphdr *iph, *top_iph;
-	struct ipcomp_hdr *ipch;
+	struct ip_comp_hdr *ipch;
 	struct ipcomp_data *ipcd = x->data;
 	union {
 		struct iphdr	iph;
@@ -215,13 +202,13 @@
 	/* Install ipcomp header, convert into ipcomp datagram. */
 	iph = skb->nh.iph;
 	memcpy(&tmp_iph, iph, iph->ihl * 4);
-	top_iph = (struct iphdr *)skb_push(skb, sizeof(struct ipcomp_hdr));
+	top_iph = (struct iphdr *)skb_push(skb, sizeof(struct ip_comp_hdr));
 	memcpy(top_iph, &tmp_iph, iph->ihl * 4);
 	iph = top_iph;
 	iph->tot_len = htons(skb->len);
 	iph->protocol = IPPROTO_COMP;
 	iph->check = 0;
-	ipch = (struct ipcomp_hdr *)((char *)iph + iph->ihl * 4);
+	ipch = (struct ip_comp_hdr *)((char *)iph + iph->ihl * 4);
 	ipch->nexthdr = x->props.mode ? IPPROTO_IPIP : tmp_iph.iph.protocol;
 	ipch->flags = 0;
 	ipch->cpi = htons((u16 )ntohl(x->id.spi));
@@ -252,7 +239,7 @@
 {
 	u32 spi;
 	struct iphdr *iph = (struct iphdr *)skb->data;
-	struct ipcomp_hdr *ipch = (struct ipcomp_hdr *)(skb->data+(iph->ihl<<2));
+	struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2));
 	struct xfrm_state *x;
 
 	if (skb->h.icmph->type != ICMP_DEST_UNREACH ||
@@ -356,7 +343,7 @@
 		goto error;
 
 	memset(ipcd, 0, sizeof(*ipcd));
-	x->props.header_len = sizeof(struct ipcomp_hdr);
+	x->props.header_len = sizeof(struct ip_comp_hdr);
 	if (x->props.mode)
 		x->props.header_len += sizeof(struct iphdr);
 	x->data = ipcd;
@@ -433,6 +420,6 @@
 module_exit(ipcomp4_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("IP Payload Compression Protocol (IPComp) - RFC3713");
+MODULE_DESCRIPTION("IP Payload Compression Protocol (IPComp) - RFC3173");
 MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>");
 
diff -urN linux-2.5.69-bk12/net/ipv4/netfilter/arp_tables.c linux-2.5.69-bk13/net/ipv4/netfilter/arp_tables.c
--- linux-2.5.69-bk12/net/ipv4/netfilter/arp_tables.c	2003-05-04 16:53:36.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/netfilter/arp_tables.c	2003-05-18 04:45:54.000000000 -0700
@@ -371,11 +371,8 @@
 
 	ret = find_inlist_lock_noload(head, name, error, mutex);
 	if (!ret) {
-		char modulename[ARPT_FUNCTION_MAXNAMELEN + strlen(prefix) + 1];
-		strcpy(modulename, prefix);
-		strcat(modulename, name);
-		duprintf("find_inlist: loading `%s'.\n", modulename);
-		request_module(modulename);
+		duprintf("find_inlist: loading `%s%s'.\n", prefix, name);
+		request_module("%s%s", prefix, name);
 		ret = find_inlist_lock_noload(head, name, error, mutex);
 	}
 
diff -urN linux-2.5.69-bk12/net/ipv4/netfilter/ip_nat_helper.c linux-2.5.69-bk13/net/ipv4/netfilter/ip_nat_helper.c
--- linux-2.5.69-bk12/net/ipv4/netfilter/ip_nat_helper.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/netfilter/ip_nat_helper.c	2003-05-18 04:45:54.000000000 -0700
@@ -426,7 +426,7 @@
 			tmp += 6;
 			sprintf(name, "ip_conntrack%s", tmp);
 #ifdef CONFIG_KMOD
-			if (!request_module(name)
+			if (!request_module("ip_conntrack%s", tmp)
 			    && (ct_helper = ip_ct_find_helper(&me->tuple))) {
 				if (!try_module_get(ct_helper->me))
 					return -EBUSY;
diff -urN linux-2.5.69-bk12/net/ipv4/netfilter/ip_tables.c linux-2.5.69-bk13/net/ipv4/netfilter/ip_tables.c
--- linux-2.5.69-bk12/net/ipv4/netfilter/ip_tables.c	2003-05-04 16:53:08.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/netfilter/ip_tables.c	2003-05-18 04:45:54.000000000 -0700
@@ -454,11 +454,8 @@
 
 	ret = find_inlist_lock_noload(head, name, error, mutex);
 	if (!ret) {
-		char modulename[IPT_FUNCTION_MAXNAMELEN + strlen(prefix) + 1];
-		strcpy(modulename, prefix);
-		strcat(modulename, name);
-		duprintf("find_inlist: loading `%s'.\n", modulename);
-		request_module(modulename);
+		duprintf("find_inlist: loading `%s%s'.\n", prefix, name);
+		request_module("%s%s", prefix, name);
 		ret = find_inlist_lock_noload(head, name, error, mutex);
 	}
 
diff -urN linux-2.5.69-bk12/net/ipv4/proc.c linux-2.5.69-bk13/net/ipv4/proc.c
--- linux-2.5.69-bk12/net/ipv4/proc.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/proc.c	2003-05-18 04:45:54.000000000 -0700
@@ -111,7 +111,6 @@
  */
 static int snmp_seq_show(struct seq_file *seq, void *v)
 {
-	extern int sysctl_ip_default_ttl;
 	int i;
 
 	seq_printf(seq, "Ip: Forwarding DefaultTTL InReceives InHdrErrors "
diff -urN linux-2.5.69-bk12/net/ipv4/route.c linux-2.5.69-bk13/net/ipv4/route.c
--- linux-2.5.69-bk12/net/ipv4/route.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/route.c	2003-05-18 04:45:54.000000000 -0700
@@ -1317,6 +1317,9 @@
 			rt->rt_gateway = FIB_RES_GW(*res);
 		memcpy(rt->u.dst.metrics, fi->fib_metrics,
 		       sizeof(rt->u.dst.metrics));
+		if (rt->u.dst.metrics[RTAX_HOPLIMIT-1] == 0)
+			rt->u.dst.metrics[RTAX_HOPLIMIT-1] =
+				sysctl_ip_default_ttl;
 		if (fi->fib_mtu == 0) {
 			rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu;
 			if (rt->u.dst.metrics[RTAX_LOCK-1] & (1 << RTAX_MTU) &&
diff -urN linux-2.5.69-bk12/net/ipv4/tcp_ipv4.c linux-2.5.69-bk13/net/ipv4/tcp_ipv4.c
--- linux-2.5.69-bk12/net/ipv4/tcp_ipv4.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv4/tcp_ipv4.c	2003-05-18 04:45:54.000000000 -0700
@@ -74,7 +74,6 @@
 #include <linux/seq_file.h>
 
 extern int sysctl_ip_dynaddr;
-extern int sysctl_ip_default_ttl;
 int sysctl_tcp_tw_reuse;
 int sysctl_tcp_low_latency;
 
@@ -1213,7 +1212,6 @@
 				      sizeof(struct tcphdr), IPPROTO_TCP, 0);
 	arg.csumoffset = offsetof(struct tcphdr, check) / 2;
 
-	inet_sk(tcp_socket->sk)->ttl = sysctl_ip_default_ttl;
 	ip_send_reply(tcp_socket->sk, skb, &arg, sizeof rth);
 
 	TCP_INC_STATS_BH(TcpOutSegs);
@@ -2619,7 +2617,7 @@
 	if (err < 0)
 		panic("Failed to create the TCP control socket.\n");
 	tcp_socket->sk->allocation   = GFP_ATOMIC;
-	inet_sk(tcp_socket->sk)->ttl = MAXTTL;
+	inet_sk(tcp_socket->sk)->uc_ttl = -1;
 
 	/* Unhash it so that IP input processing does not even
 	 * see it, we do not wish this socket to see incoming
diff -urN linux-2.5.69-bk12/net/ipv6/Kconfig linux-2.5.69-bk13/net/ipv6/Kconfig
--- linux-2.5.69-bk12/net/ipv6/Kconfig	2003-05-04 16:53:29.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/Kconfig	2003-05-18 04:45:55.000000000 -0700
@@ -33,4 +33,13 @@
 
 	  If unsure, say Y.
 
+config INET6_IPCOMP
+	tristate "IPv6: IPComp transformation"
+	depends on IPV6
+	---help---
+	  Support for IP Paylod Compression (RFC3173), typically needed
+	  for IPsec.
+
+	  If unsure, say Y.
+
 source "net/ipv6/netfilter/Kconfig"
diff -urN linux-2.5.69-bk12/net/ipv6/Makefile linux-2.5.69-bk13/net/ipv6/Makefile
--- linux-2.5.69-bk12/net/ipv6/Makefile	2003-05-04 16:53:36.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/Makefile	2003-05-18 04:45:55.000000000 -0700
@@ -13,4 +13,5 @@
 
 obj-$(CONFIG_INET6_AH) += ah6.o
 obj-$(CONFIG_INET6_ESP) += esp6.o
+obj-$(CONFIG_INET6_IPCOMP) += ipcomp6.o
 obj-$(CONFIG_NETFILTER)	+= netfilter/
diff -urN linux-2.5.69-bk12/net/ipv6/addrconf.c linux-2.5.69-bk13/net/ipv6/addrconf.c
--- linux-2.5.69-bk12/net/ipv6/addrconf.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/addrconf.c	2003-05-18 04:45:55.000000000 -0700
@@ -32,6 +32,7 @@
  *						support.
  *	Yuji SEKIYA @USAGI		:	Don't assign a same IPv6
  *						address on a same interface.
+ *	YOSHIFUJI Hideaki @USAGI	:	ARCnet support
  */
 
 #include <linux/config.h>
@@ -44,6 +45,7 @@
 #include <linux/in6.h>
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
+#include <linux/if_arcnet.h>
 #include <linux/route.h>
 #include <linux/inetdevice.h>
 #include <linux/init.h>
@@ -1061,6 +1063,13 @@
 		eui[4] = 0xFE;
 		eui[0] ^= 2;
 		return 0;
+	case ARPHRD_ARCNET:
+		/* XXX: inherit EUI-64 fro mother interface -- yoshfuji */
+		if (dev->addr_len != ARCNET_ALEN)
+			return -1;
+		memset(eui, 0, 7);
+		eui[7] = *(u8*)dev->dev_addr;
+		return 0;
 	}
 	return -1;
 }
@@ -1732,7 +1741,8 @@
 
 	if ((dev->type != ARPHRD_ETHER) && 
 	    (dev->type != ARPHRD_FDDI) &&
-	    (dev->type != ARPHRD_IEEE802_TR)) {
+	    (dev->type != ARPHRD_IEEE802_TR) &&
+	    (dev->type != ARPHRD_ARCNET)) {
 		/* Alas, we support only Ethernet autoconfiguration. */
 		return;
 	}
@@ -2715,6 +2725,7 @@
 		case ARPHRD_ETHER:
 		case ARPHRD_FDDI:
 		case ARPHRD_IEEE802_TR:	
+		case ARPHRD_ARCNET:
 			addrconf_dev_config(dev);
 			break;
 		default:;
diff -urN linux-2.5.69-bk12/net/ipv6/af_inet6.c linux-2.5.69-bk13/net/ipv6/af_inet6.c
--- linux-2.5.69-bk12/net/ipv6/af_inet6.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/af_inet6.c	2003-05-18 04:45:55.000000000 -0700
@@ -227,7 +227,7 @@
 	/* Init the ipv4 part of the socket since we can have sockets
 	 * using v6 API for ipv4.
 	 */
-	inet->ttl	= 64;
+	inet->uc_ttl	= -1;
 
 	inet->mc_loop	= 1;
 	inet->mc_ttl	= 1;
diff -urN linux-2.5.69-bk12/net/ipv6/icmp.c linux-2.5.69-bk13/net/ipv6/icmp.c
--- linux-2.5.69-bk12/net/ipv6/icmp.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/icmp.c	2003-05-18 04:45:55.000000000 -0700
@@ -362,7 +362,7 @@
 		else
 			hlimit = np->hop_limit;
 		if (hlimit < 0)
-			hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit;
+			hlimit = dst_metric(dst, RTAX_HOPLIMIT);
 	}
 
 	plen = skb->nh.raw - skb->data;
@@ -443,7 +443,7 @@
 		else
 			hlimit = np->hop_limit;
 		if (hlimit < 0)
-			hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit;
+			hlimit = dst_metric(dst, RTAX_HOPLIMIT);
 	}
 
 	idev = in6_dev_get(skb->dev);
diff -urN linux-2.5.69-bk12/net/ipv6/ip6_output.c linux-2.5.69-bk13/net/ipv6/ip6_output.c
--- linux-2.5.69-bk12/net/ipv6/ip6_output.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/ip6_output.c	2003-05-18 04:45:55.000000000 -0700
@@ -249,7 +249,7 @@
 	if (np)
 		hlimit = np->hop_limit;
 	if (hlimit < 0)
-		hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit;
+		hlimit = dst_metric(dst, RTAX_HOPLIMIT);
 
 	hdr->payload_len = htons(seg_len);
 	hdr->nexthdr = proto;
@@ -609,7 +609,7 @@
 		else
 			hlimit = np->hop_limit;
 		if (hlimit < 0)
-			hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit;
+			hlimit = dst_metric(dst, RTAX_HOPLIMIT);
 	}
 
 	jumbolen = 0;
@@ -887,7 +887,7 @@
 #endif
 }
 
-static int ip6_found_nexthdr(struct sk_buff *skb, u8 **nexthdr)
+int ip6_found_nexthdr(struct sk_buff *skb, u8 **nexthdr)
 {
 	u16 offset = sizeof(struct ipv6hdr);
 	struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1);
diff -urN linux-2.5.69-bk12/net/ipv6/ipcomp6.c linux-2.5.69-bk13/net/ipv6/ipcomp6.c
--- linux-2.5.69-bk12/net/ipv6/ipcomp6.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.69-bk13/net/ipv6/ipcomp6.c	2003-05-18 04:45:55.000000000 -0700
@@ -0,0 +1,368 @@
+/*
+ * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3173
+ *
+ * Copyright (C)2003 USAGI/WIDE Project
+ *
+ * Author	Mitsuru KANDA  <mk@linux-ipv6.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* 
+ * [Memo]
+ *
+ * Outbound:
+ *  The compression of IP datagram MUST be done before AH/ESP processing, 
+ *  fragmentation, and the addition of Hop-by-Hop/Routing header. 
+ *
+ * Inbound:
+ *  The decompression of IP datagram MUST be done after the reassembly, 
+ *  AH/ESP processing.
+ */
+#include <linux/config.h>
+#include <linux/module.h>
+#include <net/ip.h>
+#include <net/xfrm.h>
+#include <net/ipcomp.h>
+#include <asm/scatterlist.h>
+#include <linux/crypto.h>
+#include <linux/pfkeyv2.h>
+#include <linux/random.h>
+#include <net/icmp.h>
+#include <net/ipv6.h>
+#include <linux/ipv6.h>
+#include <linux/icmpv6.h>
+
+/* XXX no ipv6 ipcomp specific */
+#define NIP6(addr) \
+	ntohs((addr).s6_addr16[0]),\
+	ntohs((addr).s6_addr16[1]),\
+	ntohs((addr).s6_addr16[2]),\
+	ntohs((addr).s6_addr16[3]),\
+	ntohs((addr).s6_addr16[4]),\
+	ntohs((addr).s6_addr16[5]),\
+	ntohs((addr).s6_addr16[6]),\
+	ntohs((addr).s6_addr16[7])
+
+static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb)
+{
+	int err = 0;
+	u8 nexthdr = 0;
+	u8 *prevhdr;
+	int hdr_len = skb->h.raw - skb->nh.raw;
+	unsigned char *tmp_hdr = NULL;
+	struct ipv6hdr *iph;
+	int plen, dlen;
+	struct ipcomp_data *ipcd = x->data;
+	u8 *start, *scratch = ipcd->scratch;
+
+	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
+		skb_linearize(skb, GFP_ATOMIC) != 0) {
+		err = -ENOMEM;
+		goto out;
+	}
+
+	skb->ip_summed = CHECKSUM_NONE;
+
+	/* Remove ipcomp header and decompress original payload */
+	iph = skb->nh.ipv6h;
+	tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC);
+	if (!tmp_hdr)
+		goto out;
+	memcpy(tmp_hdr, iph, hdr_len);
+	nexthdr = *(u8 *)skb->data;
+	skb_pull(skb, sizeof(struct ipv6_comp_hdr)); 
+	skb->nh.raw += sizeof(struct ipv6_comp_hdr);
+	memcpy(skb->nh.raw, tmp_hdr, hdr_len);
+	iph = skb->nh.ipv6h;
+	iph->payload_len = htons(ntohs(iph->payload_len) - sizeof(struct ipv6_comp_hdr));
+	skb->h.raw = skb->data;
+
+	/* decompression */
+	plen = skb->len;
+	dlen = IPCOMP_SCRATCH_SIZE;
+	start = skb->data;
+
+	err = crypto_comp_decompress(ipcd->tfm, start, plen, scratch, &dlen);
+	if (err) {
+		err = -EINVAL;
+		goto out;
+	}
+
+	if (dlen < (plen + sizeof(struct ipv6_comp_hdr))) {
+		err = -EINVAL;
+		goto out;
+	}
+
+	err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC);
+	if (err) {
+		goto out;
+	}
+
+	skb_put(skb, dlen - plen);
+	memcpy(skb->data, scratch, dlen);
+
+	iph = skb->nh.ipv6h;
+	iph->payload_len = htons(skb->len);
+	
+	ip6_found_nexthdr(skb, &prevhdr);
+	*prevhdr = nexthdr;
+out:
+	if (tmp_hdr)
+		kfree(tmp_hdr);
+	if (err)
+		goto error_out;
+	return nexthdr;
+error_out:
+	return err;
+}
+
+static int ipcomp6_output(struct sk_buff *skb)
+{
+	int err;
+	struct dst_entry *dst = skb->dst;
+	struct xfrm_state *x = dst->xfrm;
+	struct ipv6hdr *tmp_iph = NULL, *iph, *top_iph;
+	int hdr_len = 0;
+	struct ipv6_comp_hdr *ipch;
+	struct ipcomp_data *ipcd = x->data;
+	u8 *prevhdr;
+	u8 nexthdr = 0;
+	int plen, dlen;
+	u8 *start, *scratch = ipcd->scratch;
+
+	if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) {
+		err = -EINVAL;
+		goto error_nolock;
+	}
+
+	spin_lock_bh(&x->lock);
+
+	err = xfrm_check_output(x, skb, AF_INET6);
+	if (err)
+		goto error;
+
+	if (x->props.mode) {
+		hdr_len = sizeof(struct ipv6hdr);
+		nexthdr = IPPROTO_IPV6;
+		iph = skb->nh.ipv6h;
+		top_iph = (struct ipv6hdr *)skb_push(skb, sizeof(struct ipv6hdr));
+		top_iph->version = 6;
+		top_iph->priority = iph->priority;
+		top_iph->flow_lbl[0] = iph->flow_lbl[0];
+		top_iph->flow_lbl[1] = iph->flow_lbl[1];
+		top_iph->flow_lbl[2] = iph->flow_lbl[2];
+		top_iph->nexthdr = IPPROTO_IPV6; /* initial */
+		top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
+		top_iph->hop_limit = iph->hop_limit;
+		memcpy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr, sizeof(struct in6_addr));
+		memcpy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr, sizeof(struct in6_addr));
+		skb->nh.raw = skb->data; /* == top_iph */
+		skb->h.raw = skb->nh.raw + hdr_len;
+	} else {
+		hdr_len = ip6_found_nexthdr(skb, &prevhdr);
+		nexthdr = *prevhdr;
+	}
+
+	/* check whether datagram len is larger than threshold */
+	if ((skb->len - hdr_len) < ipcd->threshold) {
+		goto out_ok;
+	}
+
+	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
+		skb_linearize(skb, GFP_ATOMIC) != 0) {
+		err = -ENOMEM;
+		goto error;
+	}
+
+	/* compression */
+	plen = skb->len - hdr_len;
+	dlen = IPCOMP_SCRATCH_SIZE;
+	start = skb->data + hdr_len;
+
+	err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen);
+	if (err) {
+		goto error;
+	}
+	if ((dlen + sizeof(struct ipv6_comp_hdr)) >= plen) {
+		goto out_ok;
+	}
+	memcpy(start, scratch, dlen);
+	pskb_trim(skb, hdr_len+dlen);
+
+	/* insert ipcomp header and replace datagram */
+	tmp_iph = kmalloc(hdr_len, GFP_ATOMIC);
+	if (!tmp_iph) {
+		err = -ENOMEM;
+		goto error;
+	}
+	memcpy(tmp_iph, skb->nh.raw, hdr_len);
+	top_iph = (struct ipv6hdr*)skb_push(skb, sizeof(struct ipv6_comp_hdr));
+	memcpy(top_iph, tmp_iph, hdr_len);
+	kfree(tmp_iph);
+
+	top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
+	skb->nh.raw = skb->data; /* top_iph */
+	ip6_found_nexthdr(skb, &prevhdr); 
+	*prevhdr = IPPROTO_COMP;
+
+	ipch = (struct ipv6_comp_hdr *)((unsigned char *)top_iph + hdr_len);
+	ipch->nexthdr = nexthdr;
+	ipch->flags = 0;
+	ipch->cpi = htons((u16 )ntohl(x->id.spi));
+
+	skb->h.raw = (unsigned char*)ipch;
+out_ok:
+	x->curlft.bytes += skb->len;
+	x->curlft.packets++;
+	spin_unlock_bh(&x->lock);
+
+	if ((skb->dst = dst_pop(dst)) == NULL) {
+		err = -EHOSTUNREACH;
+		goto error_nolock;
+	}
+	err = NET_XMIT_BYPASS;
+
+out_exit:
+	return err;
+error:
+	spin_unlock_bh(&x->lock);
+error_nolock:
+	kfree_skb(skb);
+	goto out_exit;
+}
+
+static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+		                int type, int code, int offset, __u32 info)
+{
+	u32 spi;
+	struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
+	struct ipv6_comp_hdr *ipcomph = (struct ipv6_comp_hdr*)(skb->data+offset);
+	struct xfrm_state *x;
+
+	if (type != ICMPV6_DEST_UNREACH || type != ICMPV6_PKT_TOOBIG)
+		return;
+
+	spi = ntohl(ntohs(ipcomph->cpi));
+	x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6);
+	if (!x)
+		return;
+
+	printk(KERN_DEBUG "pmtu discvovery on SA IPCOMP/%08x/"
+			"%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
+			spi, NIP6(iph->daddr));
+	xfrm_state_put(x);
+}
+
+static void ipcomp6_free_data(struct ipcomp_data *ipcd)
+{
+	if (ipcd->tfm)
+		crypto_free_tfm(ipcd->tfm);
+	if (ipcd->scratch)
+		kfree(ipcd->scratch);
+}
+
+static void ipcomp6_destroy(struct xfrm_state *x)
+{
+	struct ipcomp_data *ipcd = x->data;
+	ipcomp6_free_data(ipcd);
+	kfree(ipcd);
+}
+
+static int ipcomp6_init_state(struct xfrm_state *x, void *args)
+{
+	int err = -ENOMEM;
+	struct ipcomp_data *ipcd;
+	struct xfrm_algo_desc *calg_desc;
+
+	ipcd = kmalloc(sizeof(*ipcd), GFP_KERNEL);
+	if (!ipcd)
+		goto error;
+
+	memset(ipcd, 0, sizeof(*ipcd));
+	x->props.header_len = sizeof(struct ipv6_comp_hdr);
+	if (x->props.mode)
+		x->props.header_len += sizeof(struct ipv6hdr);
+	x->data = ipcd;
+	
+	ipcd->scratch = kmalloc(IPCOMP_SCRATCH_SIZE, GFP_KERNEL);
+	if (!ipcd->scratch)
+		goto error;
+
+	ipcd->tfm = crypto_alloc_tfm(x->calg->alg_name, 0);
+	if (!ipcd->tfm)
+		goto error;
+
+	calg_desc = xfrm_calg_get_byname(x->calg->alg_name);
+	BUG_ON(!calg_desc);
+	ipcd->threshold = calg_desc->uinfo.comp.threshold;
+	err = 0;
+out:
+	return err;
+error:
+	if (ipcd) {
+		ipcomp6_free_data(ipcd);
+		kfree(ipcd);
+	}
+
+	goto out;
+}
+
+static struct xfrm_type ipcomp6_type = 
+{
+	.description	= "IPCOMP6",
+	.owner		= THIS_MODULE,
+	.proto		= IPPROTO_COMP,
+	.init_state	= ipcomp6_init_state,
+	.destructor	= ipcomp6_destroy,
+	.input		= ipcomp6_input,
+	.output		= ipcomp6_output,
+};
+
+static struct inet6_protocol ipcomp6_protocol = 
+{
+	.handler	= xfrm6_rcv,
+	.err_handler	= ipcomp6_err,
+	.flags		= INET6_PROTO_NOPOLICY,
+};
+
+static int __init ipcomp6_init(void)
+{
+	if (xfrm_register_type(&ipcomp6_type, AF_INET6) < 0) {
+		printk(KERN_INFO "ipcomp6 init: can't add xfrm type\n");
+		return -EAGAIN;
+	}
+	if (inet6_add_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) {
+		printk(KERN_INFO "ipcomp6 init: can't add protocol\n");
+		xfrm_unregister_type(&ipcomp6_type, AF_INET6);
+		return -EAGAIN;
+	}
+	return 0;
+}
+
+static void __exit ipcomp6_fini(void)
+{
+	if (inet6_del_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) 
+		printk(KERN_INFO "ipv6 ipcomp close: can't remove protocol\n");
+	if (xfrm_unregister_type(&ipcomp6_type, AF_INET6) < 0)
+		printk(KERN_INFO "ipv6 ipcomp close: can't remove xfrm type\n");
+}
+
+module_init(ipcomp6_init);
+module_exit(ipcomp6_fini);
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("IP Payload Compression Protocol (IPComp) for IPv6 - RFC3173");
+MODULE_AUTHOR("Mitsuru KANDA <mk@linux-ipv6.org>");
+
+
diff -urN linux-2.5.69-bk12/net/ipv6/ipv6_syms.c linux-2.5.69-bk13/net/ipv6/ipv6_syms.c
--- linux-2.5.69-bk12/net/ipv6/ipv6_syms.c	2003-05-04 16:53:36.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/ipv6_syms.c	2003-05-18 04:45:55.000000000 -0700
@@ -35,5 +35,6 @@
 EXPORT_SYMBOL(in6addr_any);
 EXPORT_SYMBOL(in6addr_loopback);
 EXPORT_SYMBOL(in6_dev_finish_destroy);
+EXPORT_SYMBOL(ip6_found_nexthdr);
 EXPORT_SYMBOL(xfrm6_rcv);
 EXPORT_SYMBOL(xfrm6_clear_mutable_options);
diff -urN linux-2.5.69-bk12/net/ipv6/ndisc.c linux-2.5.69-bk13/net/ipv6/ndisc.c
--- linux-2.5.69-bk12/net/ipv6/ndisc.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/ndisc.c	2003-05-18 04:45:55.000000000 -0700
@@ -232,6 +232,9 @@
 	case ARPHRD_IEEE802_TR:
 		ipv6_tr_mc_map(addr,buf);
 		return 0;
+	case ARPHRD_ARCNET:
+		ipv6_arcnet_mc_map(addr, buf);
+		return 0;
 	default:
 		if (dir) {
 			memcpy(buf, dev->broadcast, dev->addr_len);
@@ -394,7 +397,7 @@
 	rt->rt6i_expires  = 0;
 	rt->rt6i_flags    = RTF_LOCAL;
 	rt->rt6i_metric   = 0;
-	rt->rt6i_hoplimit = 255;
+	rt->u.dst.metrics[RTAX_HOPLIMIT-1] = 255;
 	rt->u.dst.output  = ndisc_output;
 }
 
diff -urN linux-2.5.69-bk12/net/ipv6/netfilter/ip6_tables.c linux-2.5.69-bk13/net/ipv6/netfilter/ip6_tables.c
--- linux-2.5.69-bk12/net/ipv6/netfilter/ip6_tables.c	2003-05-04 16:53:41.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/netfilter/ip6_tables.c	2003-05-18 04:45:55.000000000 -0700
@@ -527,11 +527,8 @@
 
 	ret = find_inlist_lock_noload(head, name, error, mutex);
 	if (!ret) {
-		char modulename[IP6T_FUNCTION_MAXNAMELEN + strlen(prefix) + 1];
-		strcpy(modulename, prefix);
-		strcat(modulename, name);
-		duprintf("find_inlist: loading `%s'.\n", modulename);
-		request_module(modulename);
+		duprintf("find_inlist: loading `%s%s'.\n", prefix, name);
+		request_module("%s%s", prefix, name);
 		ret = find_inlist_lock_noload(head, name, error, mutex);
 	}
 
diff -urN linux-2.5.69-bk12/net/ipv6/raw.c linux-2.5.69-bk13/net/ipv6/raw.c
--- linux-2.5.69-bk12/net/ipv6/raw.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/raw.c	2003-05-18 04:45:55.000000000 -0700
@@ -677,7 +677,7 @@
 		else
 			hlimit = np->hop_limit;
 		if (hlimit < 0)
-			hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit;
+			hlimit = dst_metric(dst, RTAX_HOPLIMIT);
 	}
 
 	if (msg->msg_flags&MSG_CONFIRM)
diff -urN linux-2.5.69-bk12/net/ipv6/route.c linux-2.5.69-bk13/net/ipv6/route.c
--- linux-2.5.69-bk12/net/ipv6/route.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/route.c	2003-05-18 04:45:55.000000000 -0700
@@ -108,6 +108,7 @@
 			.dev		= &loopback_dev,
 			.obsolete	= -1,
 			.error		= -ENETUNREACH,
+			.metrics[RTAX_HOPLIMIT-1] = 255,
 			.input		= ip6_pkt_discard,
 			.output		= ip6_pkt_discard,
 			.ops		= &ip6_dst_ops,
@@ -116,7 +117,6 @@
 	},
 	.rt6i_flags	= (RTF_REJECT | RTF_NONEXTHOP),
 	.rt6i_metric	= ~(u32) 0,
-	.rt6i_hoplimit	= 255,
 	.rt6i_ref	= ATOMIC_INIT(1),
 };
 
@@ -769,13 +769,6 @@
 		}
 	}
 
-	if (ipv6_addr_is_multicast(&rt->rt6i_dst.addr))
-		rt->rt6i_hoplimit = IPV6_DEFAULT_MCASTHOPS;
-	else if (rta && rta[RTA_HOPLIMIT-1])
-		memcpy(&rt->rt6i_hoplimit, RTA_DATA(rta[RTA_HOPLIMIT-1]), 1);
-	else
-		rt->rt6i_hoplimit = ipv6_get_hoplimit(dev);
-
 	rt->rt6i_flags = rtmsg->rtmsg_flags;
 
 install_route:
@@ -796,6 +789,16 @@
 			attr = RTA_NEXT(attr, attrlen);
 		}
 	}
+
+	if (rt->u.dst.metrics[RTAX_HOPLIMIT-1] == 0) {
+		if (ipv6_addr_is_multicast(&rt->rt6i_dst.addr))
+			rt->u.dst.metrics[RTAX_HOPLIMIT-1] =
+				IPV6_DEFAULT_MCASTHOPS;
+		else
+			rt->u.dst.metrics[RTAX_HOPLIMIT-1] =
+				ipv6_get_hoplimit(dev);
+	}
+
 	if (!rt->u.dst.metrics[RTAX_MTU-1])
 		rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev);
 	if (!rt->u.dst.metrics[RTAX_ADVMSS-1])
@@ -964,7 +967,6 @@
 	nrt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, dst_pmtu(&nrt->u.dst) - 60, ip6_rt_min_advmss);
 	if (nrt->u.dst.metrics[RTAX_ADVMSS-1] > 65535-20)
 		nrt->u.dst.metrics[RTAX_ADVMSS-1] = 65535;
-	nrt->rt6i_hoplimit = ipv6_get_hoplimit(neigh->dev);
 
 	if (rt6_ins(nrt, NULL, NULL))
 		goto out;
@@ -1080,7 +1082,6 @@
 		if (rt->u.dst.dev)
 			dev_hold(rt->u.dst.dev);
 		rt->u.dst.lastuse = jiffies;
-		rt->rt6i_hoplimit = ort->rt6i_hoplimit;
 		rt->rt6i_expires = 0;
 
 		ipv6_addr_copy(&rt->rt6i_gateway, &ort->rt6i_gateway);
@@ -1226,7 +1227,7 @@
 	rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, dst_pmtu(&rt->u.dst) - 60, ip6_rt_min_advmss);
 	if (rt->u.dst.metrics[RTAX_ADVMSS-1] > 65535-20)
 		rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535;
-	rt->rt6i_hoplimit = ipv6_get_hoplimit(rt->rt6i_dev);
+	rt->u.dst.metrics[RTAX_HOPLIMIT-1] = ipv6_get_hoplimit(rt->rt6i_dev);
 	rt->u.dst.obsolete = -1;
 
 	rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP;
diff -urN linux-2.5.69-bk12/net/ipv6/udp.c linux-2.5.69-bk13/net/ipv6/udp.c
--- linux-2.5.69-bk12/net/ipv6/udp.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/udp.c	2003-05-18 04:45:55.000000000 -0700
@@ -968,7 +968,7 @@
 		else
 			hlimit = np->hop_limit;
 		if (hlimit < 0)
-			hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit;
+			hlimit = dst_metric(dst, RTAX_HOPLIMIT);
 	}
 
 	if (msg->msg_flags&MSG_CONFIRM)
diff -urN linux-2.5.69-bk12/net/ipv6/xfrm6_policy.c linux-2.5.69-bk13/net/ipv6/xfrm6_policy.c
--- linux-2.5.69-bk12/net/ipv6/xfrm6_policy.c	2003-05-04 16:53:08.000000000 -0700
+++ linux-2.5.69-bk13/net/ipv6/xfrm6_policy.c	2003-05-18 04:45:55.000000000 -0700
@@ -153,7 +153,6 @@
 		x->u.rt6.rt6i_flags    = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL);
 		x->u.rt6.rt6i_metric   = rt0->rt6i_metric;
 		x->u.rt6.rt6i_node     = rt0->rt6i_node;
-		x->u.rt6.rt6i_hoplimit = rt0->rt6i_hoplimit;
 		x->u.rt6.rt6i_gateway  = rt0->rt6i_gateway;
 		memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway)); 
 		header_len -= x->u.dst.xfrm->props.header_len;
diff -urN linux-2.5.69-bk12/net/ipx/Makefile linux-2.5.69-bk13/net/ipx/Makefile
--- linux-2.5.69-bk12/net/ipx/Makefile	2003-05-04 16:53:36.000000000 -0700
+++ linux-2.5.69-bk13/net/ipx/Makefile	2003-05-18 04:45:55.000000000 -0700
@@ -4,5 +4,5 @@
 
 obj-$(CONFIG_IPX) += ipx.o
 
-ipx-y			:= af_ipx.o ipx_proc.o
+ipx-y			:= af_ipx.o ipx_route.o ipx_proc.o
 ipx-$(CONFIG_SYSCTL)	+= sysctl_net_ipx.o
diff -urN linux-2.5.69-bk12/net/ipx/af_ipx.c linux-2.5.69-bk13/net/ipx/af_ipx.c
--- linux-2.5.69-bk12/net/ipx/af_ipx.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipx/af_ipx.c	2003-05-18 04:45:55.000000000 -0700
@@ -29,35 +29,31 @@
  */
 
 #include <linux/config.h>
-#include <linux/module.h>
 #include <linux/errno.h>
-#include <linux/types.h>
-#include <linux/socket.h>
-#include <linux/in.h>
+#include <linux/if_arp.h>
+#include <linux/if_ether.h>
+#include <linux/init.h>
+#include <linux/ipx.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/timer.h>
-#include <linux/string.h>
-#include <linux/sockios.h>
+#include <linux/list.h>
+#include <linux/module.h>
 #include <linux/net.h>
 #include <linux/netdevice.h>
-#include <net/ipx.h>
-#include <linux/inet.h>
+#include <linux/uio.h>
+#include <linux/skbuff.h>
+#include <linux/socket.h>
+#include <linux/sockios.h>
+#include <linux/string.h>
 #include <linux/tcp.h>
-#include <linux/route.h>
-#include <net/sock.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <linux/fcntl.h>
-#include <linux/mm.h>
-#include <linux/termios.h>	/* For TIOCOUTQ/INQ */
-#include <linux/interrupt.h>
+#include <linux/types.h>
+#include <linux/termios.h>
+
+#include <net/ipx.h>
 #include <net/p8022.h>
 #include <net/psnap.h>
-#include <linux/proc_fs.h>
-#include <linux/stat.h>
-#include <linux/init.h>
-#include <linux/if_arp.h>
+#include <net/sock.h>
+
+#include <asm/uaccess.h>
 
 #ifdef CONFIG_SYSCTL
 extern void ipx_register_sysctl(void);
@@ -81,14 +77,20 @@
 
 static struct proto_ops ipx_dgram_ops;
 
-LIST_HEAD(ipx_routes);
-rwlock_t ipx_routes_lock = RW_LOCK_UNLOCKED;
-
 LIST_HEAD(ipx_interfaces);
 spinlock_t ipx_interfaces_lock = SPIN_LOCK_UNLOCKED;
 
 struct ipx_interface *ipx_primary_net;
-static struct ipx_interface *ipx_internal_net;
+struct ipx_interface *ipx_internal_net;
+
+extern int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
+			    unsigned char *node);
+extern void ipxrtr_del_routes(struct ipx_interface *intrfc);
+extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
+			       struct iovec *iov, int len, int noblock);
+extern int ipxrtr_route_skb(struct sk_buff *skb);
+extern struct ipx_route *ipxrtr_lookup(__u32 net);
+extern int ipxrtr_ioctl(unsigned int cmd, void *arg);
 
 #undef IPX_REFCNT_DEBUG
 #ifdef IPX_REFCNT_DEBUG
@@ -122,28 +124,6 @@
 	return copy_to_user(arg, &vals, sizeof(vals)) ? -EFAULT : 0;
 }
 
-/* Handlers for the socket list. */
-
-static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
-{
-	atomic_inc(&intrfc->refcnt);
-}
-
-static void ipxitf_down(struct ipx_interface *intrfc);
-
-static __inline__ void ipxitf_put(struct ipx_interface *intrfc)
-{
-	if (atomic_dec_and_test(&intrfc->refcnt))
-		ipxitf_down(intrfc);
-}
-
-static void __ipxitf_down(struct ipx_interface *intrfc);
-
-static __inline__ void __ipxitf_put(struct ipx_interface *intrfc)
-{
-	if (atomic_dec_and_test(&intrfc->refcnt))
-		__ipxitf_down(intrfc);
-}
 /*
  * Note: Sockets may not be removed _during_ an interrupt or inet_bh
  * handler using this technique. They can be added although we do not
@@ -201,7 +181,6 @@
  * The following code is used to support IPX Interfaces (IPXITF).  An
  * IPX interface is defined by a physical device and a frame type.
  */
-static struct ipx_route *ipxrtr_lookup(__u32 net);
 
 /* ipxitf_clear_primary_net has to be called with ipx_interfaces_lock held */
 
@@ -238,7 +217,7 @@
 	return i;
 }
 
-static struct ipx_interface *ipxitf_find_using_net(__u32 net)
+struct ipx_interface *ipxitf_find_using_net(__u32 net)
 {
 	struct ipx_interface *i;
 
@@ -333,9 +312,7 @@
 }
 #endif
 
-static void ipxrtr_del_routes(struct ipx_interface *intrfc);
-
-static void __ipxitf_down(struct ipx_interface *intrfc)
+void __ipxitf_down(struct ipx_interface *intrfc)
 {
 	struct sock *s, *t;
 
@@ -374,7 +351,7 @@
 	module_put(THIS_MODULE);
 }
 
-static void ipxitf_down(struct ipx_interface *intrfc)
+void ipxitf_down(struct ipx_interface *intrfc)
 {
 	spin_lock_bh(&ipx_interfaces_lock);
 	__ipxitf_down(intrfc);
@@ -612,9 +589,7 @@
 }
 
 /* caller must hold a reference to intrfc and the skb has to be unshared */
-
-static int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb,
-		       char *node)
+int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, char *node)
 {
 	struct ipxhdr *ipx = ipx_hdr(skb);
 	struct net_device *dev = intrfc->if_dev;
@@ -720,9 +695,6 @@
 	return 0;
 }
 
-static int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
-			    unsigned char *);
-
 static int ipxitf_add_local_route(struct ipx_interface *intrfc)
 {
 	return ipxrtr_add_route(intrfc->if_netnum, intrfc, NULL);
@@ -731,7 +703,6 @@
 static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
 				   struct sk_buff *skb);
 static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb);
-static int ipxrtr_route_skb(struct sk_buff *skb);
 
 static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb)
 {
@@ -1261,130 +1232,6 @@
 	return rc;
 }
 
-/* Routing tables for the IPX socket layer. */
-
-static __inline__ void ipxrtr_hold(struct ipx_route *rt)
-{
-	atomic_inc(&rt->refcnt);
-}
-
-static __inline__ void ipxrtr_put(struct ipx_route *rt)
-{
-	if (atomic_dec_and_test(&rt->refcnt))
-		kfree(rt);
-}
-
-static struct ipx_route *ipxrtr_lookup(__u32 net)
-{
-	struct ipx_route *r;
-
-	read_lock_bh(&ipx_routes_lock);
-	list_for_each_entry(r, &ipx_routes, node)
-		if (r->ir_net == net) {
-			ipxrtr_hold(r);
-			goto unlock;
-		}
-	r = NULL;
-unlock:
-	read_unlock_bh(&ipx_routes_lock);
-	return r;
-}
-
-/* caller must hold a reference to intrfc */
-
-static int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
-			    unsigned char *node)
-{
-	struct ipx_route *rt;
-	int rc;
-
-	/* Get a route structure; either existing or create */
-	rt = ipxrtr_lookup(network);
-	if (!rt) {
-		rt = kmalloc(sizeof(*rt), GFP_ATOMIC);
-		rc = -EAGAIN;
-		if (!rt)
-			goto out;
-
-		atomic_set(&rt->refcnt, 1);
-		ipxrtr_hold(rt);
-		write_lock_bh(&ipx_routes_lock);
-		list_add(&rt->node, &ipx_routes);
-		write_unlock_bh(&ipx_routes_lock);
-	} else {
-		rc = -EEXIST;
-		if (intrfc == ipx_internal_net)
-			goto out_put;
-	}
-
-	rt->ir_net 	= network;
-	rt->ir_intrfc 	= intrfc;
-	if (!node) {
-		memset(rt->ir_router_node, '\0', IPX_NODE_LEN);
-		rt->ir_routed = 0;
-	} else {
-		memcpy(rt->ir_router_node, node, IPX_NODE_LEN);
-		rt->ir_routed = 1;
-	}
-
-	rc = 0;
-out_put:
-	ipxrtr_put(rt);
-out:
-	return rc;
-}
-
-static void ipxrtr_del_routes(struct ipx_interface *intrfc)
-{
-	struct ipx_route *r, *tmp;
-
-	write_lock_bh(&ipx_routes_lock);
-	list_for_each_entry_safe(r, tmp, &ipx_routes, node)
-		if (r->ir_intrfc == intrfc) {
-			list_del(&r->node);
-			ipxrtr_put(r);
-		}
-	write_unlock_bh(&ipx_routes_lock);
-}
-
-static int ipxrtr_create(struct ipx_route_definition *rd)
-{
-	struct ipx_interface *intrfc;
-	int rc = -ENETUNREACH;
-
-	/* Find the appropriate interface */
-	intrfc = ipxitf_find_using_net(rd->ipx_router_network);
-	if (!intrfc)
-		goto out;
-	rc = ipxrtr_add_route(rd->ipx_network, intrfc, rd->ipx_router_node);
-	ipxitf_put(intrfc);
-out:
-	return rc;
-}
-
-static int ipxrtr_delete(long net)
-{
-	struct ipx_route *r, *tmp;
-	int rc;
-
-	write_lock_bh(&ipx_routes_lock);
-	list_for_each_entry_safe(r, tmp, &ipx_routes, node)
-		if (r->ir_net == net) {
-			/* Directly connected; can't lose route */
-			rc = -EPERM;
-			if (!r->ir_routed)
-				goto out;
-			list_del(&r->node);
-			ipxrtr_put(r);
-			rc = 0;
-			goto out;
-		}
-	rc = -ENOENT;
-out:
-	write_unlock_bh(&ipx_routes_lock);
-	return rc;
-}
-
 /*
  *	Checksum routine for IPX
  */
@@ -1392,7 +1239,7 @@
 /* Note: We assume ipx_tctrl==0 and htons(length)==ipx_pktsize */
 /* This functions should *not* mess with packet contents */
 
-static __u16 ipx_cksum(struct ipxhdr *packet, int length) 
+__u16 ipx_cksum(struct ipxhdr *packet, int length) 
 {
 	/* 
 	 *	NOTE: sum is a net byte order quantity, which optimizes the 
@@ -1424,154 +1271,6 @@
 	return ~sum;
 }
 
-/*
- * Route an outgoing frame from a socket.
- */
-static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
-				struct iovec *iov, int len, int noblock)
-{
-	struct sk_buff *skb;
-	struct ipx_opt *ipxs = ipx_sk(sk);
-	struct ipx_interface *intrfc;
-	struct ipxhdr *ipx;
-	int size;
-	int ipx_offset;
-	struct ipx_route *rt = NULL;
-	int rc;
-
-	/* Find the appropriate interface on which to send packet */
-	if (!usipx->sipx_network && ipx_primary_net) {
-		usipx->sipx_network = ipx_primary_net->if_netnum;
-		intrfc = ipx_primary_net;
-	} else {
-		rt = ipxrtr_lookup(usipx->sipx_network);
-		rc = -ENETUNREACH;
-		if (!rt)
-			goto out;
-		intrfc = rt->ir_intrfc;
-	}
-
-	ipxitf_hold(intrfc);
-	ipx_offset = intrfc->if_ipx_offset;
-	size = sizeof(struct ipxhdr) + len + ipx_offset;
-
-	skb = sock_alloc_send_skb(sk, size, noblock, &rc);
-	if (!skb)
-		goto out_put;
-
-	skb_reserve(skb, ipx_offset);
-	skb->sk = sk;
-
-	/* Fill in IPX header */
-	skb->h.raw = skb->nh.raw = skb_put(skb, sizeof(struct ipxhdr));
-	ipx = ipx_hdr(skb);
-	ipx->ipx_pktsize = htons(len + sizeof(struct ipxhdr));
-	IPX_SKB_CB(skb)->ipx_tctrl = 0;
-	ipx->ipx_type 	 = usipx->sipx_type;
-
-	IPX_SKB_CB(skb)->last_hop.index = -1;
-#ifdef CONFIG_IPX_INTERN
-	IPX_SKB_CB(skb)->ipx_source_net = ipxs->intrfc->if_netnum;
-	memcpy(ipx->ipx_source.node, ipxs->node, IPX_NODE_LEN);
-#else
-	rc = ntohs(ipxs->port);
-	if (rc == 0x453 || rc == 0x452) {
-		/* RIP/SAP special handling for mars_nwe */
-		IPX_SKB_CB(skb)->ipx_source_net = intrfc->if_netnum;
-		memcpy(ipx->ipx_source.node, intrfc->if_node, IPX_NODE_LEN);
-	} else {
-		IPX_SKB_CB(skb)->ipx_source_net = ipxs->intrfc->if_netnum;
-		memcpy(ipx->ipx_source.node, ipxs->intrfc->if_node,
-			IPX_NODE_LEN);
-	}
-#endif	/* CONFIG_IPX_INTERN */
-	ipx->ipx_source.sock		= ipxs->port;
-	IPX_SKB_CB(skb)->ipx_dest_net	= usipx->sipx_network;
-	memcpy(ipx->ipx_dest.node, usipx->sipx_node, IPX_NODE_LEN);
-	ipx->ipx_dest.sock		= usipx->sipx_port;
-
-	rc = memcpy_fromiovec(skb_put(skb, len), iov, len);
-	if (rc) {
-		kfree_skb(skb);
-		goto out_put;
-	}	
-
-	/* Apply checksum. Not allowed on 802.3 links. */
-	if (sk->no_check || intrfc->if_dlink_type == IPX_FRAME_8023)
-		ipx->ipx_checksum = 0xFFFF;
-	else
-		ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr));
-
-	rc = ipxitf_send(intrfc, skb, (rt && rt->ir_routed) ? 
-			 rt->ir_router_node : ipx->ipx_dest.node);
-out_put:
-	ipxitf_put(intrfc);
-	if (rt)
-		ipxrtr_put(rt);
-out:
-	return rc;
-}
-
-/* the skb has to be unshared, we'll end up calling ipxitf_send, that'll
- * modify the packet */
-int ipxrtr_route_skb(struct sk_buff *skb)
-{
-	struct ipxhdr *ipx = ipx_hdr(skb);
-	struct ipx_route *r = ipxrtr_lookup(IPX_SKB_CB(skb)->ipx_dest_net);
-
-	if (!r) {	/* no known route */
-		kfree_skb(skb);
-		return 0;
-	}
-
-	ipxitf_hold(r->ir_intrfc);
-	ipxitf_send(r->ir_intrfc, skb, r->ir_routed ?
-			r->ir_router_node : ipx->ipx_dest.node);
-	ipxitf_put(r->ir_intrfc);
-	ipxrtr_put(r);
-
-	return 0;
-}
-
-/*
- * We use a normal struct rtentry for route handling
- */
-static int ipxrtr_ioctl(unsigned int cmd, void *arg)
-{
-	struct rtentry rt;	/* Use these to behave like 'other' stacks */
-	struct sockaddr_ipx *sg, *st;
-	int rc = -EFAULT;
-
-	if (copy_from_user(&rt, arg, sizeof(rt)))
-		goto out;
-
-	sg = (struct sockaddr_ipx *)&rt.rt_gateway;
-	st = (struct sockaddr_ipx *)&rt.rt_dst;
-
-	rc = -EINVAL;
-	if (!(rt.rt_flags & RTF_GATEWAY) || /* Direct routes are fixed */
-	    sg->sipx_family != AF_IPX ||
-	    st->sipx_family != AF_IPX)
-		goto out;
-
-	switch (cmd) {
-	case SIOCDELRT:
-		rc = ipxrtr_delete(st->sipx_network);
-		break;
-	case SIOCADDRT: {
-		struct ipx_route_definition f;
-		f.ipx_network		= st->sipx_network;
-		f.ipx_router_network	= sg->sipx_network;
-		memcpy(f.ipx_router_node, sg->sipx_node, IPX_NODE_LEN);
-		rc = ipxrtr_create(&f);
-		break;
-	}
-	}
-
-out:
-	return rc;
-}
-
 const char *ipx_frame_name(unsigned short frame)
 {
 	char* rc = "None";
@@ -1822,7 +1521,6 @@
 
 	ipxitf_insert_socket(intrfc, sk);
 	sk->zapped = 0;
-	SOCK_DEBUG(sk, "IPX: bound socket 0x%04X.\n", ntohs(addr->sipx_port) );
 
 	rc = 0;
 out_put:
diff -urN linux-2.5.69-bk12/net/ipx/ipx_proc.c linux-2.5.69-bk13/net/ipx/ipx_proc.c
--- linux-2.5.69-bk12/net/ipx/ipx_proc.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/ipx/ipx_proc.c	2003-05-18 04:45:55.000000000 -0700
@@ -5,6 +5,7 @@
  */
 
 #include <linux/config.h>
+#ifdef CONFIG_PROC_FS
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 #include <linux/spinlock.h>
@@ -12,7 +13,6 @@
 #include <linux/tcp.h>
 #include <net/ipx.h>
 
-#ifdef CONFIG_PROC_FS
 static __inline__ struct ipx_interface *ipx_get_interface_idx(loff_t pos)
 {
 	struct ipx_interface *i;
diff -urN linux-2.5.69-bk12/net/ipx/ipx_route.c linux-2.5.69-bk13/net/ipx/ipx_route.c
--- linux-2.5.69-bk12/net/ipx/ipx_route.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.69-bk13/net/ipx/ipx_route.c	2003-05-18 04:45:55.000000000 -0700
@@ -0,0 +1,293 @@
+/*
+ *	Implements the IPX routing routines.
+ *	Code moved from af_ipx.c.
+ *
+ *	Arnaldo Carvalho de Melo <acme@conectiva.com.br>, 2003
+ *
+ *	See net/ipx/ChangeLog.
+ */
+
+#include <linux/config.h>
+#include <linux/list.h>
+#include <linux/route.h>
+#include <linux/spinlock.h>
+
+#include <net/ipx.h>
+#include <net/sock.h>
+
+LIST_HEAD(ipx_routes);
+rwlock_t ipx_routes_lock = RW_LOCK_UNLOCKED;
+
+extern struct ipx_interface *ipx_internal_net;
+
+extern __u16 ipx_cksum(struct ipxhdr *packet, int length);
+extern struct ipx_interface *ipxitf_find_using_net(__u32 net);
+extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
+			       struct sk_buff *skb, int copy);
+extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
+			       struct sk_buff *skb, int copy);
+extern int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb,
+		       char *node);
+extern struct ipx_interface *ipxitf_find_using_net(__u32 net);
+
+struct ipx_route *ipxrtr_lookup(__u32 net)
+{
+	struct ipx_route *r;
+
+	read_lock_bh(&ipx_routes_lock);
+	list_for_each_entry(r, &ipx_routes, node)
+		if (r->ir_net == net) {
+			ipxrtr_hold(r);
+			goto unlock;
+		}
+	r = NULL;
+unlock:
+	read_unlock_bh(&ipx_routes_lock);
+	return r;
+}
+
+/*
+ * Caller must hold a reference to intrfc
+ */
+int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
+		     unsigned char *node)
+{
+	struct ipx_route *rt;
+	int rc;
+
+	/* Get a route structure; either existing or create */
+	rt = ipxrtr_lookup(network);
+	if (!rt) {
+		rt = kmalloc(sizeof(*rt), GFP_ATOMIC);
+		rc = -EAGAIN;
+		if (!rt)
+			goto out;
+
+		atomic_set(&rt->refcnt, 1);
+		ipxrtr_hold(rt);
+		write_lock_bh(&ipx_routes_lock);
+		list_add(&rt->node, &ipx_routes);
+		write_unlock_bh(&ipx_routes_lock);
+	} else {
+		rc = -EEXIST;
+		if (intrfc == ipx_internal_net)
+			goto out_put;
+	}
+
+	rt->ir_net 	= network;
+	rt->ir_intrfc 	= intrfc;
+	if (!node) {
+		memset(rt->ir_router_node, '\0', IPX_NODE_LEN);
+		rt->ir_routed = 0;
+	} else {
+		memcpy(rt->ir_router_node, node, IPX_NODE_LEN);
+		rt->ir_routed = 1;
+	}
+
+	rc = 0;
+out_put:
+	ipxrtr_put(rt);
+out:
+	return rc;
+}
+
+void ipxrtr_del_routes(struct ipx_interface *intrfc)
+{
+	struct ipx_route *r, *tmp;
+
+	write_lock_bh(&ipx_routes_lock);
+	list_for_each_entry_safe(r, tmp, &ipx_routes, node)
+		if (r->ir_intrfc == intrfc) {
+			list_del(&r->node);
+			ipxrtr_put(r);
+		}
+	write_unlock_bh(&ipx_routes_lock);
+}
+
+static int ipxrtr_create(struct ipx_route_definition *rd)
+{
+	struct ipx_interface *intrfc;
+	int rc = -ENETUNREACH;
+
+	/* Find the appropriate interface */
+	intrfc = ipxitf_find_using_net(rd->ipx_router_network);
+	if (!intrfc)
+		goto out;
+	rc = ipxrtr_add_route(rd->ipx_network, intrfc, rd->ipx_router_node);
+	ipxitf_put(intrfc);
+out:
+	return rc;
+}
+
+static int ipxrtr_delete(long net)
+{
+	struct ipx_route *r, *tmp;
+	int rc;
+
+	write_lock_bh(&ipx_routes_lock);
+	list_for_each_entry_safe(r, tmp, &ipx_routes, node)
+		if (r->ir_net == net) {
+			/* Directly connected; can't lose route */
+			rc = -EPERM;
+			if (!r->ir_routed)
+				goto out;
+			list_del(&r->node);
+			ipxrtr_put(r);
+			rc = 0;
+			goto out;
+		}
+	rc = -ENOENT;
+out:
+	write_unlock_bh(&ipx_routes_lock);
+	return rc;
+}
+
+/*
+ * The skb has to be unshared, we'll end up calling ipxitf_send, that'll
+ * modify the packet
+ */
+int ipxrtr_route_skb(struct sk_buff *skb)
+{
+	struct ipxhdr *ipx = ipx_hdr(skb);
+	struct ipx_route *r = ipxrtr_lookup(IPX_SKB_CB(skb)->ipx_dest_net);
+
+	if (!r) {	/* no known route */
+		kfree_skb(skb);
+		return 0;
+	}
+
+	ipxitf_hold(r->ir_intrfc);
+	ipxitf_send(r->ir_intrfc, skb, r->ir_routed ?
+			r->ir_router_node : ipx->ipx_dest.node);
+	ipxitf_put(r->ir_intrfc);
+	ipxrtr_put(r);
+
+	return 0;
+}
+
+/*
+ * Route an outgoing frame from a socket.
+ */
+int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
+			struct iovec *iov, int len, int noblock)
+{
+	struct sk_buff *skb;
+	struct ipx_opt *ipxs = ipx_sk(sk);
+	struct ipx_interface *intrfc;
+	struct ipxhdr *ipx;
+	int size;
+	int ipx_offset;
+	struct ipx_route *rt = NULL;
+	int rc;
+
+	/* Find the appropriate interface on which to send packet */
+	if (!usipx->sipx_network && ipx_primary_net) {
+		usipx->sipx_network = ipx_primary_net->if_netnum;
+		intrfc = ipx_primary_net;
+	} else {
+		rt = ipxrtr_lookup(usipx->sipx_network);
+		rc = -ENETUNREACH;
+		if (!rt)
+			goto out;
+		intrfc = rt->ir_intrfc;
+	}
+
+	ipxitf_hold(intrfc);
+	ipx_offset = intrfc->if_ipx_offset;
+	size = sizeof(struct ipxhdr) + len + ipx_offset;
+
+	skb = sock_alloc_send_skb(sk, size, noblock, &rc);
+	if (!skb)
+		goto out_put;
+
+	skb_reserve(skb, ipx_offset);
+	skb->sk = sk;
+
+	/* Fill in IPX header */
+	skb->h.raw = skb->nh.raw = skb_put(skb, sizeof(struct ipxhdr));
+	ipx = ipx_hdr(skb);
+	ipx->ipx_pktsize = htons(len + sizeof(struct ipxhdr));
+	IPX_SKB_CB(skb)->ipx_tctrl = 0;
+	ipx->ipx_type 	 = usipx->sipx_type;
+
+	IPX_SKB_CB(skb)->last_hop.index = -1;
+#ifdef CONFIG_IPX_INTERN
+	IPX_SKB_CB(skb)->ipx_source_net = ipxs->intrfc->if_netnum;
+	memcpy(ipx->ipx_source.node, ipxs->node, IPX_NODE_LEN);
+#else
+	rc = ntohs(ipxs->port);
+	if (rc == 0x453 || rc == 0x452) {
+		/* RIP/SAP special handling for mars_nwe */
+		IPX_SKB_CB(skb)->ipx_source_net = intrfc->if_netnum;
+		memcpy(ipx->ipx_source.node, intrfc->if_node, IPX_NODE_LEN);
+	} else {
+		IPX_SKB_CB(skb)->ipx_source_net = ipxs->intrfc->if_netnum;
+		memcpy(ipx->ipx_source.node, ipxs->intrfc->if_node,
+			IPX_NODE_LEN);
+	}
+#endif	/* CONFIG_IPX_INTERN */
+	ipx->ipx_source.sock		= ipxs->port;
+	IPX_SKB_CB(skb)->ipx_dest_net	= usipx->sipx_network;
+	memcpy(ipx->ipx_dest.node, usipx->sipx_node, IPX_NODE_LEN);
+	ipx->ipx_dest.sock		= usipx->sipx_port;
+
+	rc = memcpy_fromiovec(skb_put(skb, len), iov, len);
+	if (rc) {
+		kfree_skb(skb);
+		goto out_put;
+	}	
+
+	/* Apply checksum. Not allowed on 802.3 links. */
+	if (sk->no_check || intrfc->if_dlink_type == IPX_FRAME_8023)
+		ipx->ipx_checksum = 0xFFFF;
+	else
+		ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr));
+
+	rc = ipxitf_send(intrfc, skb, (rt && rt->ir_routed) ? 
+			 rt->ir_router_node : ipx->ipx_dest.node);
+out_put:
+	ipxitf_put(intrfc);
+	if (rt)
+		ipxrtr_put(rt);
+out:
+	return rc;
+}
+
+/*
+ * We use a normal struct rtentry for route handling
+ */
+int ipxrtr_ioctl(unsigned int cmd, void *arg)
+{
+	struct rtentry rt;	/* Use these to behave like 'other' stacks */
+	struct sockaddr_ipx *sg, *st;
+	int rc = -EFAULT;
+
+	if (copy_from_user(&rt, arg, sizeof(rt)))
+		goto out;
+
+	sg = (struct sockaddr_ipx *)&rt.rt_gateway;
+	st = (struct sockaddr_ipx *)&rt.rt_dst;
+
+	rc = -EINVAL;
+	if (!(rt.rt_flags & RTF_GATEWAY) || /* Direct routes are fixed */
+	    sg->sipx_family != AF_IPX ||
+	    st->sipx_family != AF_IPX)
+		goto out;
+
+	switch (cmd) {
+	case SIOCDELRT:
+		rc = ipxrtr_delete(st->sipx_network);
+		break;
+	case SIOCADDRT: {
+		struct ipx_route_definition f;
+		f.ipx_network		= st->sipx_network;
+		f.ipx_router_network	= sg->sipx_network;
+		memcpy(f.ipx_router_node, sg->sipx_node, IPX_NODE_LEN);
+		rc = ipxrtr_create(&f);
+		break;
+	}
+	}
+
+out:
+	return rc;
+}
diff -urN linux-2.5.69-bk12/net/irda/irda_device.c linux-2.5.69-bk13/net/irda/irda_device.c
--- linux-2.5.69-bk12/net/irda/irda_device.c	2003-05-04 16:53:14.000000000 -0700
+++ linux-2.5.69-bk13/net/irda/irda_device.c	2003-05-18 04:45:55.000000000 -0700
@@ -433,13 +433,9 @@
 	ASSERT(dev != NULL, return NULL;);
 
 #ifdef CONFIG_KMOD
-	{
-	char modname[32];
 	ASSERT(!in_interrupt(), return NULL;);
 	/* Try to load the module needed */
-	sprintf(modname, "irda-dongle-%d", type);
-	request_module(modname);
-	}
+	request_module("irda-dongle-%d", type);
 #endif
 
 	if (!(reg = hashbin_lock_find(dongles, type, NULL))) {
diff -urN linux-2.5.69-bk12/net/netsyms.c linux-2.5.69-bk13/net/netsyms.c
--- linux-2.5.69-bk12/net/netsyms.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/netsyms.c	2003-05-18 04:45:55.000000000 -0700
@@ -292,7 +292,6 @@
 EXPORT_SYMBOL(xfrm_cfg_sem);
 EXPORT_SYMBOL(xfrm_policy_alloc);
 EXPORT_SYMBOL(__xfrm_policy_destroy);
-EXPORT_SYMBOL(xfrm_policy_lookup);
 EXPORT_SYMBOL(xfrm_lookup);
 EXPORT_SYMBOL(__xfrm_policy_check);
 EXPORT_SYMBOL(__xfrm_route_forward);
@@ -363,6 +362,9 @@
 EXPORT_SYMBOL_GPL(skb_to_sgvec);
 #endif
 
+EXPORT_SYMBOL(flow_cache_lookup);
+EXPORT_SYMBOL(flow_cache_genid);
+
 #if defined (CONFIG_IPV6_MODULE) || defined (CONFIG_IP_SCTP_MODULE)
 /* inet functions common to v4 and v6 */
 EXPORT_SYMBOL(inet_release);
diff -urN linux-2.5.69-bk12/net/sched/Kconfig linux-2.5.69-bk13/net/sched/Kconfig
--- linux-2.5.69-bk12/net/sched/Kconfig	2003-05-04 16:53:41.000000000 -0700
+++ linux-2.5.69-bk13/net/sched/Kconfig	2003-05-18 04:45:55.000000000 -0700
@@ -63,7 +63,7 @@
 #tristate '  H-PFQ packet scheduler' CONFIG_NET_SCH_HPFQ
 #tristate '  H-FSC packet scheduler' CONFIG_NET_SCH_HFCS
 config NET_SCH_ATM
-	bool "ATM pseudo-scheduler"
+	tristate "ATM pseudo-scheduler"
 	depends on NET_SCHED && ATM
 	---help---
 	  Say Y here if you want to use the ATM pseudo-scheduler.  This
diff -urN linux-2.5.69-bk12/net/sched/cls_api.c linux-2.5.69-bk13/net/sched/cls_api.c
--- linux-2.5.69-bk12/net/sched/cls_api.c	2003-05-04 16:53:08.000000000 -0700
+++ linux-2.5.69-bk13/net/sched/cls_api.c	2003-05-18 04:45:55.000000000 -0700
@@ -204,11 +204,9 @@
 #ifdef CONFIG_KMOD
 		if (tp_ops==NULL && tca[TCA_KIND-1] != NULL) {
 			struct rtattr *kind = tca[TCA_KIND-1];
-			char module_name[4 + IFNAMSIZ + 1];
 
 			if (RTA_PAYLOAD(kind) <= IFNAMSIZ) {
-				sprintf(module_name, "cls_%s", (char*)RTA_DATA(kind));
-				request_module (module_name);
+				request_module("cls_%s", (char*)RTA_DATA(kind));
 				tp_ops = tcf_proto_lookup_ops(kind);
 			}
 		}
diff -urN linux-2.5.69-bk12/net/sched/sch_api.c linux-2.5.69-bk13/net/sched/sch_api.c
--- linux-2.5.69-bk12/net/sched/sch_api.c	2003-05-04 16:53:14.000000000 -0700
+++ linux-2.5.69-bk13/net/sched/sch_api.c	2003-05-18 04:45:55.000000000 -0700
@@ -396,11 +396,8 @@
 	ops = qdisc_lookup_ops(kind);
 #ifdef CONFIG_KMOD
 	if (ops==NULL && tca[TCA_KIND-1] != NULL) {
-		char module_name[4 + IFNAMSIZ + 1];
-
 		if (RTA_PAYLOAD(kind) <= IFNAMSIZ) {
-			sprintf(module_name, "sch_%s", (char*)RTA_DATA(kind));
-			request_module (module_name);
+			request_module("sch_%s", (char*)RTA_DATA(kind));
 			ops = qdisc_lookup_ops(kind);
 		}
 	}
diff -urN linux-2.5.69-bk12/net/sctp/ipv6.c linux-2.5.69-bk13/net/sctp/ipv6.c
--- linux-2.5.69-bk12/net/sctp/ipv6.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/sctp/ipv6.c	2003-05-18 04:45:55.000000000 -0700
@@ -547,7 +547,7 @@
 	/* Init the ipv4 part of the socket since we can have sockets
 	 * using v6 API for ipv4.
 	 */
-	newinet->ttl = sysctl_ip_default_ttl;
+	newinet->uc_ttl = -1;
 	newinet->mc_loop = 1;
 	newinet->mc_ttl = 1;
 	newinet->mc_index = 0;
diff -urN linux-2.5.69-bk12/net/sctp/protocol.c linux-2.5.69-bk13/net/sctp/protocol.c
--- linux-2.5.69-bk12/net/sctp/protocol.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/sctp/protocol.c	2003-05-18 04:45:55.000000000 -0700
@@ -545,7 +545,7 @@
 	newinet->pmtudisc = inet->pmtudisc;
       	newinet->id = 0;
 
-	newinet->ttl = sysctl_ip_default_ttl;
+	newinet->uc_ttl = -1;
 	newinet->mc_loop = 1;
 	newinet->mc_ttl = 1;
 	newinet->mc_index = 0;
@@ -602,7 +602,7 @@
 		return err;
 	}
 	sctp_ctl_socket->sk->allocation = GFP_ATOMIC;
-	inet_sk(sctp_ctl_socket->sk)->ttl = MAXTTL;
+	inet_sk(sctp_ctl_socket->sk)->uc_ttl = -1;
 
 	return 0;
 }
diff -urN linux-2.5.69-bk12/net/socket.c linux-2.5.69-bk13/net/socket.c
--- linux-2.5.69-bk12/net/socket.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/socket.c	2003-05-18 04:45:55.000000000 -0700
@@ -1034,9 +1034,7 @@
 	 */
 	if (net_families[family]==NULL)
 	{
-		char module_name[30];
-		sprintf(module_name,"net-pf-%d",family);
-		request_module(module_name);
+		request_module("net-pf-%d",family);
 	}
 #endif
 
diff -urN linux-2.5.69-bk12/net/wanrouter/af_wanpipe.c linux-2.5.69-bk13/net/wanrouter/af_wanpipe.c
--- linux-2.5.69-bk12/net/wanrouter/af_wanpipe.c	2003-05-04 16:53:55.000000000 -0700
+++ linux-2.5.69-bk13/net/wanrouter/af_wanpipe.c	2003-05-18 04:45:55.000000000 -0700
@@ -170,7 +170,7 @@
 {
 	void   *mbox;		/* Mail box  */
 	void   *card; 		/* Card bouded to */
-	netdevice_t *dev;	/* Bounded device */
+	struct net_device *dev;	/* Bounded device */
 	unsigned short lcn;	/* Binded LCN */
 	unsigned char  svc;	/* 0=pvc, 1=svc */
 	unsigned char  timer;   /* flag for delayed transmit*/	
@@ -185,25 +185,26 @@
 extern struct proto_ops wanpipe_ops;
 static unsigned long find_free_critical;
 
-static void wanpipe_unlink_driver (struct sock *);
-static void wanpipe_link_driver (netdevice_t *,struct sock *sk);
+static void wanpipe_unlink_driver(struct sock *sk);
+static void wanpipe_link_driver(struct net_device *dev, struct sock *sk);
 static void wanpipe_wakeup_driver(struct sock *sk);
 static int execute_command(struct sock *, unsigned char, unsigned int);
-static int check_dev (netdevice_t *, sdla_t *);
-netdevice_t * wanpipe_find_free_dev (sdla_t *);
+static int check_dev(struct net_device *dev, sdla_t *card);
+struct net_device *wanpipe_find_free_dev(sdla_t *card);
 static void wanpipe_unlink_card (struct sock *);
 static int wanpipe_link_card (struct sock *);
 static struct sock *wanpipe_make_new(struct sock *);
 static struct sock *wanpipe_alloc_socket(void);
-static inline int get_atomic_device (netdevice_t *);
+static inline int get_atomic_device(struct net_device *dev);
 static int wanpipe_exec_cmd(struct sock *, int, unsigned int);
 static int get_ioctl_cmd (struct sock *, void *);
 static int set_ioctl_cmd (struct sock *, void *);
-static void release_device (netdevice_t *);
+static void release_device(struct net_device *dev);
 static void wanpipe_kill_sock_timer (unsigned long data);
 static void wanpipe_kill_sock_irq (struct sock *);
 static void wanpipe_kill_sock_accept (struct sock *);
-static int wanpipe_do_bind(struct sock *, netdevice_t *, int);
+static int wanpipe_do_bind(struct sock *sk, struct net_device *dev,
+			   int protocol);
 struct sock * get_newsk_from_skb (struct sk_buff *);
 static int wanpipe_debug (struct sock *, void *);
 static void wanpipe_delayed_transmit (unsigned long data);
@@ -225,7 +226,8 @@
  *      WANPIPE driver private.
  *===========================================================*/
 
-static int wanpipe_rcv(struct sk_buff *skb, netdevice_t *dev,  struct sock *sk)
+static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
+		       struct sock *sk)
 {
 	struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb;
 	wanpipe_common_t *chan = dev->priv;
@@ -323,7 +325,7 @@
 	wanpipe_opt *wp = wp_sk(sk), *newwp;
 	struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb;
 	struct sock *newsk;
-	netdevice_t *dev; 
+	struct net_device *dev; 
 	sdla_t *card;
 	mbox_cmd_t *mbox_ptr;
 	wanpipe_common_t *chan;
@@ -539,7 +541,7 @@
 	struct sock *sk = sock->sk;
 	struct wan_sockaddr_ll *saddr=(struct wan_sockaddr_ll *)msg->msg_name;
 	struct sk_buff *skb;
-	netdevice_t *dev;
+	struct net_device *dev;
 	unsigned short proto;
 	unsigned char *addr;
 	int ifindex, err, reserve = 0;
@@ -664,7 +666,7 @@
 	struct sock *sk=(struct sock *)data;
 	struct sk_buff *skb;
 	wanpipe_opt *wp = wp_sk(sk);
-	netdevice_t *dev = wp->dev;
+	struct net_device *dev = wp->dev;
 	sdla_t *card = (sdla_t*)wp->card;
 
 	if (!card || !dev){
@@ -756,7 +758,7 @@
 static int execute_command(struct sock *sk,  unsigned char cmd, unsigned int flags)
 {
 	wanpipe_opt *wp = wp_sk(sk);
-	netdevice_t *dev;
+	struct net_device *dev;
 	wanpipe_common_t *chan=NULL;
 	int err=0;
 	DECLARE_WAITQUEUE(wait, current);
@@ -861,7 +863,7 @@
  *===========================================================*/
 static void wanpipe_unlink_driver (struct sock *sk)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	wanpipe_common_t *chan=NULL;
 
 	sk->zapped=0;
@@ -901,7 +903,7 @@
  *      data up the socket.
  *===========================================================*/
 
-static void wanpipe_link_driver (netdevice_t *dev, struct sock *sk)
+static void wanpipe_link_driver(struct net_device *dev, struct sock *sk)
 {
 	wanpipe_opt *wp = wp_sk(sk);
 	wanpipe_common_t *chan = dev->priv;
@@ -926,7 +928,7 @@
  *===========================================================*/
 
 
-static void release_device (netdevice_t *dev)
+static void release_device(struct net_device *dev)
 {
 	wanpipe_common_t *chan=dev->priv;
 	clear_bit(0,(void*)&chan->rw_bind);
@@ -965,7 +967,7 @@
 
 	if (wp->num == htons(X25_PROT) &&
 	    sk->state != WANSOCK_DISCONNECTED && sk->zapped) {
-		netdevice_t *dev = dev_get_by_index(sk->bound_dev_if);
+		struct net_device *dev = dev_get_by_index(sk->bound_dev_if);
 		wanpipe_common_t *chan;
 		if (dev){
 			chan=dev->priv;
@@ -1153,7 +1155,7 @@
 
 	if (wp_sk(sk)->num == htons(X25_PROT) &&
 	    sk->state != WANSOCK_DISCONNECTED){
-		netdevice_t *dev = dev_get_by_index(sk->bound_dev_if);
+		struct net_device *dev = dev_get_by_index(sk->bound_dev_if);
 		wanpipe_common_t *chan;
 		if (dev){
 			chan=dev->priv;
@@ -1268,7 +1270,8 @@
  *      sock to the driver.
  *===========================================================*/
 
-static int wanpipe_do_bind(struct sock *sk, netdevice_t *dev, int protocol)
+static int wanpipe_do_bind(struct sock *sk, struct net_device *dev,
+			   int protocol)
 {
 	wanpipe_opt *wp = wp_sk(sk);
 	wanpipe_common_t *chan=NULL;
@@ -1341,7 +1344,7 @@
 	struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)uaddr;
 	struct sock *sk=sock->sk;
 	wanpipe_opt *wp = wp_sk(sk);
-	netdevice_t *dev = NULL;
+	struct net_device *dev = NULL;
 	sdla_t *card=NULL;
 	char name[15];
 
@@ -1436,7 +1439,7 @@
  *===========================================================*/
 
 
-static inline int get_atomic_device (netdevice_t *dev)
+static inline int get_atomic_device(struct net_device *dev)
 {
 	wanpipe_common_t *chan = dev->priv;
 	if (!test_and_set_bit(0,(void *)&chan->rw_bind)){
@@ -1451,11 +1454,12 @@
  *  	Check that device name belongs to a particular card.
  *===========================================================*/
 
-static int check_dev (netdevice_t *dev, sdla_t *card)
+static int check_dev(struct net_device *dev, sdla_t *card)
 {
-	netdevice_t* tmp_dev;
+	struct net_device* tmp_dev;
 
-	for (tmp_dev = card->wandev.dev; tmp_dev; tmp_dev=*((netdevice_t**)tmp_dev->priv)){
+	for (tmp_dev = card->wandev.dev; tmp_dev;
+	     tmp_dev = *((struct net_device **)tmp_dev->priv)) {
 		if (tmp_dev->ifindex == dev->ifindex){ 
 			return 0;	
 		}
@@ -1471,16 +1475,17 @@
  *      X25API Specific.
  *===========================================================*/
 
-netdevice_t * wanpipe_find_free_dev (sdla_t *card)
+struct net_device *wanpipe_find_free_dev(sdla_t *card)
 {
-	netdevice_t* dev;
+	struct net_device* dev;
 	volatile wanpipe_common_t *chan;
 
 	if (test_and_set_bit(0,&find_free_critical)){
 		printk(KERN_INFO "CRITICAL in Find Free\n");
 	}	
 
-	for (dev = card->wandev.dev; dev; dev=*((netdevice_t**)dev->priv)){
+	for (dev = card->wandev.dev; dev;
+	     dev = *((struct net_device **)dev->priv)) {
 		chan = dev->priv;
 		if (!chan) 
 			continue;
@@ -1646,7 +1651,7 @@
 
 static void wanpipe_wakeup_driver(struct sock *sk)
 {
-	netdevice_t *dev=NULL;
+	struct net_device *dev = NULL;
 	wanpipe_common_t *chan=NULL;
 
 	dev = dev_get_by_index(sk->bound_dev_if);
@@ -1680,7 +1685,7 @@
 static int wanpipe_getname(struct socket *sock, struct sockaddr *uaddr,
 			  int *uaddr_len, int peer)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	struct sock *sk = sock->sk;
 	struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)uaddr;
 
@@ -1718,7 +1723,7 @@
 static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void *data)
 {
 	struct sock *sk;
-	netdevice_t *dev = (netdevice_t*)data;
+	struct net_device *dev = (struct net_device *)data;
 	struct wanpipe_opt *po;
 
 	for (sk = wanpipe_sklist; sk; sk = sk->next) {
@@ -1867,7 +1872,7 @@
 static int wanpipe_debug (struct sock *origsk, void *arg)
 {
 	struct sock *sk=NULL;
-	netdevice_t *dev=NULL;
+	struct net_device *dev = NULL;
 	wanpipe_common_t *chan=NULL;
 	int cnt=0, err=0;
 	wan_debug_t *dbg_data = (wan_debug_t *)arg;
@@ -2010,7 +2015,7 @@
 
 	if (!wp_sk(sk)->mbox) {
 		void *mbox_ptr;
-		netdevice_t *dev = dev_get_by_index(sk->bound_dev_if);
+		struct net_device *dev = dev_get_by_index(sk->bound_dev_if);
 		if (!dev)
 			return -ENODEV;
 
@@ -2351,7 +2356,7 @@
 
 static int check_driver_busy (struct sock *sk)
 {
-	netdevice_t *dev = dev_get_by_index(sk->bound_dev_if);
+	struct net_device *dev = dev_get_by_index(sk->bound_dev_if);
 	wanpipe_common_t *chan;
 
 	if (!dev)
@@ -2456,7 +2461,7 @@
 
 struct sock * get_newsk_from_skb (struct sk_buff *skb)
 {
-	netdevice_t *dev = skb->dev;
+	struct net_device *dev = skb->dev;
 	wanpipe_common_t *chan;	
 
 	if (!dev){
@@ -2486,7 +2491,7 @@
 {
 	struct sock *sk = sock->sk;
 	struct wan_sockaddr_ll *addr = (struct wan_sockaddr_ll*)uaddr;
-	netdevice_t *dev;
+	struct net_device *dev;
 	int err;
 
 	if (wp_sk(sk)->num != htons(X25_PROT))
diff -urN linux-2.5.69-bk12/net/wanrouter/wanmain.c linux-2.5.69-bk13/net/wanrouter/wanmain.c
--- linux-2.5.69-bk12/net/wanrouter/wanmain.c	2003-05-04 16:53:35.000000000 -0700
+++ linux-2.5.69-bk13/net/wanrouter/wanmain.c	2003-05-18 04:45:55.000000000 -0700
@@ -127,18 +127,18 @@
  *	WAN device IOCTL handlers
  */
 
-static int device_setup(wan_device_t *wandev, wandev_conf_t *u_conf);
-static int device_stat(wan_device_t *wandev, wandev_stat_t *u_stat);
-static int device_shutdown(wan_device_t *wandev);
-static int device_new_if(wan_device_t *wandev, wanif_conf_t *u_conf);
-static int device_del_if(wan_device_t *wandev, char *u_name);
+static int device_setup(struct wan_device *wandev, wandev_conf_t *u_conf);
+static int device_stat(struct wan_device *wandev, wandev_stat_t *u_stat);
+static int device_shutdown(struct wan_device *wandev);
+static int device_new_if(struct wan_device *wandev, wanif_conf_t *u_conf);
+static int device_del_if(struct wan_device *wandev, char *u_name);
 
 /*
  *	Miscellaneous
  */
 
-static wan_device_t *find_device (char *name);
-static int delete_interface (wan_device_t *wandev, char *name);
+static struct wan_device *find_device (char *name);
+static int delete_interface (struct wan_device *wandev, char *name);
 void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
 void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
 
@@ -148,11 +148,11 @@
  *	Global Data
  */
 
-static char fullname[]		= "Sangoma WANPIPE Router";
-static char copyright[]		= "(c) 1995-2000 Sangoma Technologies Inc.";
-static char modname[]		= ROUTER_NAME;	/* short module name */
-wan_device_t* router_devlist 	= NULL;	/* list of registered devices */
-static int devcnt 		= 0;
+static char fullname[]	= "Sangoma WANPIPE Router";
+static char copyright[]	= "(c) 1995-2000 Sangoma Technologies Inc.";
+static char modname[]   = ROUTER_NAME;	/* short module name */
+struct wan_device* router_devlist;	/* list of registered devices */
+static int devcnt;
 
 /*
  *	Organize Unique Identifiers for encapsulation/decapsulation
@@ -262,7 +262,7 @@
  */
 
 
-int register_wan_device(wan_device_t *wandev)
+int register_wan_device(struct wan_device *wandev)
 {
 	int err, namelen;
 
@@ -322,7 +322,7 @@
 
 int unregister_wan_device(char *name)
 {
-	wan_device_t *wandev, *prev;
+	struct wan_device *wandev, *prev;
 
 	if (name == NULL)
 		return -EINVAL;
@@ -363,8 +363,8 @@
  */
 
 
-int wanrouter_encapsulate (struct sk_buff *skb, netdevice_t *dev,
-	unsigned short type)
+int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev,
+			  unsigned short type)
 {
 	int hdr_len = 0;
 
@@ -406,7 +406,7 @@
  */
 
 
-unsigned short wanrouter_type_trans (struct sk_buff *skb, netdevice_t *dev)
+unsigned short wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev)
 {
 	int cnt = skb->data[0] ? 0 : 1;	/* there may be a pad present */
 	unsigned short ethertype;
@@ -457,7 +457,7 @@
 {
 	int err = 0;
 	struct proc_dir_entry *dent;
-	wan_device_t *wandev;
+	struct wan_device *wandev;
 
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
@@ -519,7 +519,7 @@
  *	o call driver's setup() entry point
  */
 
-static int device_setup (wan_device_t *wandev, wandev_conf_t *u_conf)
+static int device_setup(struct wan_device *wandev, wandev_conf_t *u_conf)
 {
 	void *data = NULL;
 	wandev_conf_t *conf;
@@ -595,9 +595,9 @@
  *	o call driver's shutdown() entry point
  */
 
-static int device_shutdown (wan_device_t *wandev)
+static int device_shutdown(struct wan_device *wandev)
 {
-	netdevice_t *dev;
+	struct net_device *dev;
 	int err=0;
 
 	if (wandev->state == WAN_UNCONFIGURED)
@@ -628,7 +628,7 @@
  *	Get WAN device status & statistics.
  */
 
-static int device_stat (wan_device_t *wandev, wandev_stat_t *u_stat)
+static int device_stat(struct wan_device *wandev, wandev_stat_t *u_stat)
 {
 	wandev_stat_t stat;
 
@@ -658,10 +658,10 @@
  *	o register network interface
  */
 
-static int device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf)
+static int device_new_if(struct wan_device *wandev, wanif_conf_t *u_conf)
 {
 	wanif_conf_t conf;
-	netdevice_t *dev=NULL;
+	struct net_device *dev = NULL;
 #ifdef CONFIG_WANPIPE_MULTPPP
 	struct ppp_device *pppdev=NULL;
 #endif
@@ -682,13 +682,14 @@
 		if (pppdev == NULL)
 			return -ENOBUFS;
 		memset(pppdev, 0, sizeof(struct ppp_device));
-		pppdev->dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL);
+		pppdev->dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
 		if (pppdev->dev == NULL) {
 			kfree(pppdev);
 			return -ENOBUFS;
 		}
-		memset(pppdev->dev, 0, sizeof(netdevice_t));
-		err = wandev->new_if(wandev, (netdevice_t *)pppdev, &conf);
+		memset(pppdev->dev, 0, sizeof(struct net_device));
+		err = wandev->new_if(wandev,
+				     (struct net_device *)pppdev, &conf);
 		dev = pppdev->dev;
 #else
 		printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n",
@@ -696,10 +697,10 @@
 		return -EPROTONOSUPPORT;
 #endif
 	} else {
-		dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL);
+		dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
 		if (dev == NULL)
 			return -ENOBUFS;
-		memset(dev, 0, sizeof(netdevice_t));
+		memset(dev, 0, sizeof(struct net_device));
 		err = wandev->new_if(wandev, dev, &conf);
 	}
 
@@ -722,7 +723,7 @@
 
 			err = register_netdev(dev);
 			if (!err) {
-				netdevice_t *slave=NULL;
+				struct net_device *slave = NULL;
 				unsigned long smp_flags=0;
 
 				lock_adapter_irq(&wandev->lock, &smp_flags);
@@ -731,10 +732,10 @@
 					wandev->dev = dev;
 				} else {
 					for (slave=wandev->dev;
-					     *((netdevice_t**)slave->priv);
-					     slave=*((netdevice_t**)slave->priv));
+					 *((struct net_device **)slave->priv);
+				 slave = *((struct net_device **)slave->priv));
 
-					*((netdevice_t**)slave->priv) = dev;
+				     *((struct net_device **)slave->priv) = dev;
 				}
 				++wandev->ndev;
 
@@ -774,7 +775,7 @@
  *	 o copy configuration data to kernel address space
  */
 
-static int device_del_if (wan_device_t *wandev, char *u_name)
+static int device_del_if(struct wan_device *wandev, char *u_name)
 {
 	char name[WAN_IFNAME_SZ + 1];
         int err = 0;
@@ -815,9 +816,9 @@
  *	Return pointer to the WAN device data space or NULL if device not found.
  */
 
-static wan_device_t *find_device(char *name)
+static struct wan_device *find_device(char *name)
 {
-	wan_device_t *wandev;
+	struct wan_device *wandev;
 
 	for (wandev = router_devlist;wandev && strcmp(wandev->name, name);
 		wandev = wandev->next);
@@ -841,16 +842,16 @@
  *	sure that opened interfaces are not removed!
  */
 
-static int delete_interface (wan_device_t *wandev, char *name)
+static int delete_interface(struct wan_device *wandev, char *name)
 {
-	netdevice_t *dev=NULL, *prev=NULL;
+	struct net_device *dev = NULL, *prev = NULL;
 	unsigned long smp_flags=0;
 
 	lock_adapter_irq(&wandev->lock, &smp_flags);
 	dev = wandev->dev;
 	prev = NULL;
 	while (dev && strcmp(name, dev->name)) {
-		netdevice_t **slave = dev->priv;
+		struct net_device **slave = dev->priv;
 		prev = dev;
 		dev = *slave;
 	}
@@ -867,12 +868,12 @@
 
 	lock_adapter_irq(&wandev->lock, &smp_flags);
 	if (prev) {
-		netdevice_t **prev_slave = prev->priv;
-		netdevice_t **slave = dev->priv;
+		struct net_device **prev_slave = prev->priv;
+		struct net_device **slave = dev->priv;
 
 		*prev_slave = *slave;
 	} else {
-		netdevice_t **slave = dev->priv;
+		struct net_device **slave = dev->priv;
 		wandev->dev = *slave;
 	}
 	--wandev->ndev;
diff -urN linux-2.5.69-bk12/net/wanrouter/wanproc.c linux-2.5.69-bk13/net/wanrouter/wanproc.c
--- linux-2.5.69-bk12/net/wanrouter/wanproc.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/wanrouter/wanproc.c	2003-05-18 04:45:55.000000000 -0700
@@ -96,7 +96,7 @@
  */
 static void *r_start(struct seq_file *m, loff_t *pos)
 {
-	wan_device_t *wandev;
+	struct wan_device *wandev;
 	loff_t l = *pos;
 
 	lock_kernel();
@@ -108,7 +108,7 @@
 }
 static void *r_next(struct seq_file *m, void *v, loff_t *pos)
 {
-	wan_device_t *wandev = v;
+	struct wan_device *wandev = v;
 	(*pos)++;
 	return (v == (void *)1) ? router_devlist : wandev->next;
 }
@@ -119,7 +119,7 @@
 
 static int config_show(struct seq_file *m, void *v)
 {
-	wan_device_t *p = v;
+	struct wan_device *p = v;
 	if (v == (void *)1) {
 		seq_puts(m, "Device name    | port |IRQ|DMA|  mem.addr  |");
 		seq_puts(m, "mem.size|option1|option2|option3|option4\n");
@@ -135,7 +135,7 @@
 
 static int status_show(struct seq_file *m, void *v)
 {
-	wan_device_t *p = v;
+	struct wan_device *p = v;
 	if (v == (void *)1) {
 		seq_puts(m, "Device name    |protocol|station|interface|");
 		seq_puts(m, "clocking|baud rate| MTU |ndev|link state\n");
@@ -221,7 +221,7 @@
 
 static int wandev_show(struct seq_file *m, void *v)
 {
-	wan_device_t *wandev = v;
+	struct wan_device *wandev = v;
 
 	if (wandev->magic != ROUTER_MAGIC)
 		return 0;
@@ -339,7 +339,7 @@
  *	Add directory entry for WAN device.
  */
 
-int wanrouter_proc_add (wan_device_t* wandev)
+int wanrouter_proc_add(struct wan_device* wandev)
 {
 	if (wandev->magic != ROUTER_MAGIC)
 		return -EINVAL;
@@ -356,7 +356,7 @@
  *	Delete directory entry for WAN device.
  */
  
-int wanrouter_proc_delete(wan_device_t* wandev)
+int wanrouter_proc_delete(struct wan_device* wandev)
 {
 	if (wandev->magic != ROUTER_MAGIC)
 		return -EINVAL;
@@ -379,12 +379,12 @@
 {
 }
 
-int wanrouter_proc_add(wan_device_t *wandev)
+int wanrouter_proc_add(struct wan_device *wandev)
 {
 	return 0;
 }
 
-int wanrouter_proc_delete(wan_device_t *wandev)
+int wanrouter_proc_delete(struct wan_device *wandev)
 {
 	return 0;
 }
diff -urN linux-2.5.69-bk12/net/xfrm/xfrm_input.c linux-2.5.69-bk13/net/xfrm/xfrm_input.c
--- linux-2.5.69-bk12/net/xfrm/xfrm_input.c	2003-05-04 16:52:49.000000000 -0700
+++ linux-2.5.69-bk13/net/xfrm/xfrm_input.c	2003-05-18 04:45:55.000000000 -0700
@@ -34,7 +34,7 @@
 		offset_seq = offsetof(struct ip_esp_hdr, seq_no);
 		break;
 	case IPPROTO_COMP:
-		if (!pskb_may_pull(skb, 4))
+		if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr)))
 			return -EINVAL;
 		*spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2)));
 		*seq = 0;
diff -urN linux-2.5.69-bk12/net/xfrm/xfrm_policy.c linux-2.5.69-bk13/net/xfrm/xfrm_policy.c
--- linux-2.5.69-bk12/net/xfrm/xfrm_policy.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/net/xfrm/xfrm_policy.c	2003-05-18 04:45:55.000000000 -0700
@@ -19,7 +19,6 @@
 
 DECLARE_MUTEX(xfrm_cfg_sem);
 
-static u32      xfrm_policy_genid;
 static rwlock_t xfrm_policy_lock = RW_LOCK_UNLOCKED;
 
 struct xfrm_policy *xfrm_policy_list[XFRM_POLICY_MAX*2];
@@ -29,142 +28,6 @@
 
 kmem_cache_t *xfrm_dst_cache;
 
-/* Limited flow cache. Its function now is to accelerate search for
- * policy rules.
- *
- * Flow cache is private to cpus, at the moment this is important
- * mostly for flows which do not match any rule, so that flow lookups
- * are absolultely cpu-local. When a rule exists we do some updates
- * to rule (refcnt, stats), so that locality is broken. Later this
- * can be repaired.
- */
-
-struct flow_entry
-{
-	struct flow_entry	*next;
-	struct flowi		fl;
-	u8			dir;
-	u32			genid;
-	struct xfrm_policy	*pol;
-};
-
-static kmem_cache_t *flow_cachep;
-
-struct flow_entry **flow_table;
-
-static int flow_lwm = 2*XFRM_FLOWCACHE_HASH_SIZE;
-static int flow_hwm = 4*XFRM_FLOWCACHE_HASH_SIZE;
-
-static int flow_number[NR_CPUS] __cacheline_aligned;
-
-#define flow_count(cpu)		(flow_number[cpu])
-
-static void flow_cache_shrink(int cpu)
-{
-	int i;
-	struct flow_entry *fle, **flp;
-	int shrink_to = flow_lwm/XFRM_FLOWCACHE_HASH_SIZE;
-
-	for (i=0; i<XFRM_FLOWCACHE_HASH_SIZE; i++) {
-		int k = 0;
-		flp = &flow_table[cpu*XFRM_FLOWCACHE_HASH_SIZE+i];
-		while ((fle=*flp) != NULL && k<shrink_to) {
-			k++;
-			flp = &fle->next;
-		}
-		while ((fle=*flp) != NULL) {
-			*flp = fle->next;
-			if (fle->pol)
-				xfrm_pol_put(fle->pol);
-			kmem_cache_free(flow_cachep, fle);
-		}
-	}
-}
-
-struct xfrm_policy *flow_lookup(int dir, struct flowi *fl, 
-				unsigned short family)
-{
-	struct xfrm_policy *pol = NULL;
-	struct flow_entry *fle;
-	u32 hash;
-	int cpu;
-
-	hash = flow_hash(fl, family);
-
-	local_bh_disable();
-	cpu = smp_processor_id();
-
-	for (fle = flow_table[cpu*XFRM_FLOWCACHE_HASH_SIZE+hash];
-	     fle; fle = fle->next) {
-		if (memcmp(fl, &fle->fl, sizeof(fle->fl)) == 0 &&
-		    fle->dir == dir) {
-			if (fle->genid == xfrm_policy_genid) {
-				if ((pol = fle->pol) != NULL)
-					xfrm_pol_hold(pol);
-				local_bh_enable();
-				return pol;
-			}
-			break;
-		}
-	}
-
-	pol = xfrm_policy_lookup(dir, fl, family);
-
-	if (fle) {
-		/* Stale flow entry found. Update it. */
-		fle->genid = xfrm_policy_genid;
-
-		if (fle->pol)
-			xfrm_pol_put(fle->pol);
-		fle->pol = pol;
-		if (pol)
-			xfrm_pol_hold(pol);
-	} else {
-		if (flow_count(cpu) > flow_hwm)
-			flow_cache_shrink(cpu);
-
-		fle = kmem_cache_alloc(flow_cachep, SLAB_ATOMIC);
-		if (fle) {
-			flow_count(cpu)++;
-			fle->fl = *fl;
-			fle->genid = xfrm_policy_genid;
-			fle->dir = dir;
-			fle->pol = pol;
-			if (pol)
-				xfrm_pol_hold(pol);
-			fle->next = flow_table[cpu*XFRM_FLOWCACHE_HASH_SIZE+hash];
-			flow_table[cpu*XFRM_FLOWCACHE_HASH_SIZE+hash] = fle;
-		}
-	}
-	local_bh_enable();
-	return pol;
-}
-
-void __init flow_cache_init(void)
-{
-	int order;
-
-	flow_cachep = kmem_cache_create("flow_cache",
-					sizeof(struct flow_entry),
-					0, SLAB_HWCACHE_ALIGN,
-					NULL, NULL);
-
-	if (!flow_cachep)
-		panic("NET: failed to allocate flow cache slab\n");
-
-	for (order = 0;
-	     (PAGE_SIZE<<order) < (NR_CPUS*sizeof(struct flow_entry *)*XFRM_FLOWCACHE_HASH_SIZE);
-	     order++)
-		/* NOTHING */;
-
-	flow_table = (struct flow_entry **)__get_free_pages(GFP_ATOMIC, order);
-
-	if (!flow_table)
-		panic("Failed to allocate flow cache hash table\n");
-
-	memset(flow_table, 0, PAGE_SIZE<<order);
-}
-
 int xfrm_register_type(struct xfrm_type *type, unsigned short family)
 {
 	struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
@@ -395,7 +258,7 @@
 	xfrm_pol_hold(policy);
 	policy->next = pol ? pol->next : NULL;
 	*p = policy;
-	xfrm_policy_genid++;
+	atomic_inc(&flow_cache_genid);
 	policy->index = pol ? pol->index : xfrm_gen_index(dir);
 	policy->curlft.add_time = (unsigned long)xtime.tv_sec;
 	policy->curlft.use_time = 0;
@@ -424,7 +287,7 @@
 		}
 	}
 	if (pol)
-		xfrm_policy_genid++;
+		atomic_inc(&flow_cache_genid);
 	write_unlock_bh(&xfrm_policy_lock);
 	return pol;
 }
@@ -443,7 +306,7 @@
 	}
 	if (pol) {
 		if (delete)
-			xfrm_policy_genid++;
+			atomic_inc(&flow_cache_genid);
 		else
 			xfrm_pol_hold(pol);
 	}
@@ -468,7 +331,7 @@
 			write_lock_bh(&xfrm_policy_lock);
 		}
 	}
-	xfrm_policy_genid++;
+	atomic_inc(&flow_cache_genid);
 	write_unlock_bh(&xfrm_policy_lock);
 }
 
@@ -507,8 +370,8 @@
 
 /* Find policy to apply to this flow. */
 
-struct xfrm_policy *xfrm_policy_lookup(int dir, struct flowi *fl, 
-				       unsigned short family)
+void xfrm_policy_lookup(struct flowi *fl, u16 family, u8 dir,
+			void **objp, atomic_t **obj_refp)
 {
 	struct xfrm_policy *pol;
 
@@ -527,7 +390,8 @@
 		}
 	}
 	read_unlock_bh(&xfrm_policy_lock);
-	return pol;
+	if ((*objp = (void *) pol) != NULL)
+		*obj_refp = &pol->refcnt;
 }
 
 struct xfrm_policy *xfrm_sk_policy_lookup(struct sock *sk, int dir, struct flowi *fl)
@@ -719,6 +583,23 @@
 	return err;
 }
 
+static inline int policy_to_flow_dir(int dir)
+{
+	if (XFRM_POLICY_IN == FLOW_DIR_IN &&
+	    XFRM_POLICY_OUT == FLOW_DIR_OUT &&
+	    XFRM_POLICY_FWD == FLOW_DIR_FWD)
+		return dir;
+	switch (dir) {
+	default:
+	case XFRM_POLICY_IN:
+		return FLOW_DIR_IN;
+	case XFRM_POLICY_OUT:
+		return FLOW_DIR_OUT;
+	case XFRM_POLICY_FWD:
+		return FLOW_DIR_FWD;
+	};
+}
+
 /* Main function: finds/creates a bundle for given flow.
  *
  * At the moment we eat a raw IP route. Mostly to speed up lookups
@@ -749,7 +630,7 @@
 	}
 
 restart:
-	genid = xfrm_policy_genid;
+	genid = atomic_read(&flow_cache_genid);
 	policy = NULL;
 	if (sk && sk->policy[1])
 		policy = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl);
@@ -759,7 +640,9 @@
 		if ((rt->u.dst.flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT])
 			return 0;
 
-		policy = flow_lookup(XFRM_POLICY_OUT, fl, family);
+		policy = flow_cache_lookup(fl, family,
+					   policy_to_flow_dir(XFRM_POLICY_OUT),
+					   xfrm_policy_lookup);
 	}
 
 	if (!policy)
@@ -817,7 +700,7 @@
 					goto error;
 				}
 				if (err == -EAGAIN ||
-				    genid != xfrm_policy_genid)
+				    genid != atomic_read(&flow_cache_genid))
 					goto restart;
 			}
 			if (err)
@@ -941,7 +824,9 @@
 		pol = xfrm_sk_policy_lookup(sk, dir, &fl);
 
 	if (!pol)
-		pol = flow_lookup(dir, &fl, family);
+		pol = flow_cache_lookup(&fl, family,
+					policy_to_flow_dir(dir),
+					xfrm_policy_lookup);
 
 	if (!pol)
 		return 1;
@@ -1237,7 +1122,6 @@
 void __init xfrm_init(void)
 {
 	xfrm_state_init();
-	flow_cache_init();
 	xfrm_policy_init();
 }
 
diff -urN linux-2.5.69-bk12/sound/core/seq/seq_clientmgr.c linux-2.5.69-bk13/sound/core/seq/seq_clientmgr.c
--- linux-2.5.69-bk12/sound/core/seq/seq_clientmgr.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/sound/core/seq/seq_clientmgr.c	2003-05-18 04:45:55.000000000 -0700
@@ -136,7 +136,6 @@
 		static char card_requested[SNDRV_CARDS];
 		if (clientid < 64) {
 			int idx;
-			char name[32];
 			
 			if (! client_requested[clientid]) {
 				client_requested[clientid] = 1;
@@ -144,8 +143,7 @@
 					if (seq_client_load[idx] < 0)
 						break;
 					if (seq_client_load[idx] == clientid) {
-						sprintf(name, "snd-seq-client-%i", clientid);
-						request_module(name);
+						request_module("snd-seq-client-%i", clientid);
 						break;
 					}
 				}
diff -urN linux-2.5.69-bk12/sound/core/seq/seq_device.c linux-2.5.69-bk13/sound/core/seq/seq_device.c
--- linux-2.5.69-bk12/sound/core/seq/seq_device.c	2003-05-04 16:53:07.000000000 -0700
+++ linux-2.5.69-bk13/sound/core/seq/seq_device.c	2003-05-18 04:45:55.000000000 -0700
@@ -131,7 +131,6 @@
 {
 #ifdef CONFIG_KMOD
 	struct list_head *head;
-	char modname[64];
 
 	down(&ops_mutex);
 	list_for_each(head, &opslist) {
@@ -141,8 +140,7 @@
 			ops->used++;
 			up(&ops_mutex);
 			ops->driver |= DRIVER_REQUESTED;
-			sprintf(modname, "snd-%s", ops->id);
-			request_module(modname);
+			request_module("snd-%s", ops->id);
 			down(&ops_mutex);
 			ops->used--;
 		}
diff -urN linux-2.5.69-bk12/sound/core/sound.c linux-2.5.69-bk13/sound/core/sound.c
--- linux-2.5.69-bk12/sound/core/sound.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/sound/core/sound.c	2003-05-18 04:45:55.000000000 -0700
@@ -79,7 +79,6 @@
  */
 void snd_request_card(int card)
 {
-	char str[32];
 	int locked;
 
 	read_lock(&snd_card_rwlock);
@@ -89,8 +88,7 @@
 		return;
 	if (card < 0 || card >= cards_limit)
 		return;
-	sprintf(str, "snd-card-%i", card);
-	request_module(str);
+	request_module("snd-card-%i", card);
 }
 
 static void snd_request_other(int minor)
diff -urN linux-2.5.69-bk12/sound/oss/soundcard.c linux-2.5.69-bk13/sound/oss/soundcard.c
--- linux-2.5.69-bk12/sound/oss/soundcard.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/sound/oss/soundcard.c	2003-05-18 04:45:55.000000000 -0700
@@ -216,9 +216,7 @@
 	case SND_DEV_CTL:
 		dev >>= 4;
 		if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) {
-			char modname[20];
-			sprintf(modname, "mixer%d", dev);
-			request_module(modname);
+			request_module("mixer%d", dev);
 		}
 		if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL))
 			return -ENXIO;
@@ -318,9 +316,7 @@
  		return -ENXIO;
  	/* Try to load the mixer... */
  	if (mixer_devs[mixdev] == NULL) {
- 		char modname[20];
- 		sprintf(modname, "mixer%d", mixdev);
- 		request_module(modname);
+ 		request_module("mixer%d", mixdev);
  	}
  	if (mixdev >= num_mixers || !mixer_devs[mixdev])
  		return -ENXIO;
diff -urN linux-2.5.69-bk12/sound/sound_core.c linux-2.5.69-bk13/sound/sound_core.c
--- linux-2.5.69-bk12/sound/sound_core.c	2003-05-18 04:45:45.000000000 -0700
+++ linux-2.5.69-bk13/sound/sound_core.c	2003-05-18 04:45:55.000000000 -0700
@@ -500,8 +500,6 @@
 	if (s)
 		new_fops = fops_get(s->unit_fops);
 	if (!new_fops) {
-		char mod[32];
-	
 		spin_unlock(&sound_loader_lock);
 		/*
 		 *  Please, don't change this order or code.
@@ -510,10 +508,8 @@
 		 *  ALSA toplevel modules for soundcards, thus we need
 		 *  load them at first.	  [Jaroslav Kysela <perex@jcu.cz>]
 		 */
-		sprintf(mod, "sound-slot-%i", unit>>4);
-		request_module(mod);
-		sprintf(mod, "sound-service-%i-%i", unit>>4, chain);
-		request_module(mod);
+		request_module("sound-slot-%i", unit>>4);
+		request_module("sound-service-%i-%i", unit>>4, chain);
 		spin_lock(&sound_loader_lock);
 		s = __look_for_unit(chain, unit);
 		if (s)
