aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm')
-rw-r--r--net/atm/Makefile2
-rw-r--r--net/atm/atm_sysfs.c176
-rw-r--r--net/atm/br2684.c1
-rw-r--r--net/atm/clip.c21
-rw-r--r--net/atm/common.c8
-rw-r--r--net/atm/common.h2
-rw-r--r--net/atm/ioctl.c1
-rw-r--r--net/atm/ipcommon.c17
-rw-r--r--net/atm/lec.c1
-rw-r--r--net/atm/lec.h1
-rw-r--r--net/atm/mpc.c17
-rw-r--r--net/atm/mpoa_caches.c12
-rw-r--r--net/atm/mpoa_proc.c1
-rw-r--r--net/atm/pppoatm.c1
-rw-r--r--net/atm/proc.c1
-rw-r--r--net/atm/pvc.c1
-rw-r--r--net/atm/resources.c23
-rw-r--r--net/atm/resources.h3
18 files changed, 238 insertions, 51 deletions
diff --git a/net/atm/Makefile b/net/atm/Makefile
index d5818751f6..89656d6c0b 100644
--- a/net/atm/Makefile
+++ b/net/atm/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the ATM Protocol Families. 2# Makefile for the ATM Protocol Families.
3# 3#
4 4
5atm-y := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o raw.o resources.o 5atm-y := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o raw.o resources.o atm_sysfs.o
6mpoa-objs := mpc.o mpoa_caches.o mpoa_proc.o 6mpoa-objs := mpc.o mpoa_caches.o mpoa_proc.o
7 7
8obj-$(CONFIG_ATM) += atm.o 8obj-$(CONFIG_ATM) += atm.o
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
new file mode 100644
index 0000000000..5df4b9a068
--- /dev/null
+++ b/net/atm/atm_sysfs.c
@@ -0,0 +1,176 @@
1/* ATM driver model support. */
2
3#include <linux/config.h>
4#include <linux/kernel.h>
5#include <linux/init.h>
6#include <linux/kobject.h>
7#include <linux/atmdev.h>
8#include "common.h"
9#include "resources.h"
10
11#define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev)
12
13static ssize_t show_type(struct class_device *cdev, char *buf)
14{
15 struct atm_dev *adev = to_atm_dev(cdev);
16 return sprintf(buf, "%s\n", adev->type);
17}
18
19static ssize_t show_address(struct class_device *cdev, char *buf)
20{
21 char *pos = buf;
22 struct atm_dev *adev = to_atm_dev(cdev);
23 int i;
24
25 for (i = 0; i < (ESI_LEN - 1); i++)
26 pos += sprintf(pos, "%02x:", adev->esi[i]);
27 pos += sprintf(pos, "%02x\n", adev->esi[i]);
28
29 return pos - buf;
30}
31
32static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
33{
34 unsigned long flags;
35 char *pos = buf;
36 struct atm_dev *adev = to_atm_dev(cdev);
37 struct atm_dev_addr *aaddr;
38 int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
39 int i, j;
40
41 spin_lock_irqsave(&adev->lock, flags);
42 list_for_each_entry(aaddr, &adev->local, entry) {
43 for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) {
44 if (j == *fmt) {
45 pos += sprintf(pos, ".");
46 ++fmt;
47 j = 0;
48 }
49 pos += sprintf(pos, "%02x", aaddr->addr.sas_addr.prv[i]);
50 }
51 pos += sprintf(pos, "\n");
52 }
53 spin_unlock_irqrestore(&adev->lock, flags);
54
55 return pos - buf;
56}
57
58static ssize_t show_carrier(struct class_device *cdev, char *buf)
59{
60 char *pos = buf;
61 struct atm_dev *adev = to_atm_dev(cdev);
62
63 pos += sprintf(pos, "%d\n",
64 adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
65
66 return pos - buf;
67}
68
69static ssize_t show_link_rate(struct class_device *cdev, char *buf)
70{
71 char *pos = buf;
72 struct atm_dev *adev = to_atm_dev(cdev);
73 int link_rate;
74
75 /* show the link rate, not the data rate */
76 switch (adev->link_rate) {
77 case ATM_OC3_PCR:
78 link_rate = 155520000;
79 break;
80 case ATM_OC12_PCR:
81 link_rate = 622080000;
82 break;
83 case ATM_25_PCR:
84 link_rate = 25600000;
85 break;
86 default:
87 link_rate = adev->link_rate * 8 * 53;
88 }
89 pos += sprintf(pos, "%d\n", link_rate);
90
91 return pos - buf;
92}
93
94static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
95static CLASS_DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
96static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
97static CLASS_DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
98static CLASS_DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
99
100static struct class_device_attribute *atm_attrs[] = {
101 &class_device_attr_atmaddress,
102 &class_device_attr_address,
103 &class_device_attr_carrier,
104 &class_device_attr_type,
105 &class_device_attr_link_rate,
106 NULL
107};
108
109static int atm_uevent(struct class_device *cdev, char **envp, int num_envp, char *buf, int size)
110{
111 struct atm_dev *adev;
112 int i = 0, len = 0;
113
114 if (!cdev)
115 return -ENODEV;
116
117 adev = to_atm_dev(cdev);
118 if (!adev)
119 return -ENODEV;
120
121 if (add_uevent_var(envp, num_envp, &i, buf, size, &len,
122 "NAME=%s%d", adev->type, adev->number))
123 return -ENOMEM;
124
125 envp[i] = NULL;
126 return 0;
127}
128
129static void atm_release(struct class_device *cdev)
130{
131 struct atm_dev *adev = to_atm_dev(cdev);
132
133 kfree(adev);
134}
135
136static struct class atm_class = {
137 .name = "atm",
138 .release = atm_release,
139 .uevent = atm_uevent,
140};
141
142int atm_register_sysfs(struct atm_dev *adev)
143{
144 struct class_device *cdev = &adev->class_dev;
145 int i, err;
146
147 cdev->class = &atm_class;
148 class_set_devdata(cdev, adev);
149
150 snprintf(cdev->class_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number);
151 err = class_device_register(cdev);
152 if (err < 0)
153 return err;
154
155 for (i = 0; atm_attrs[i]; i++)
156 class_device_create_file(cdev, atm_attrs[i]);
157
158 return 0;
159}
160
161void atm_unregister_sysfs(struct atm_dev *adev)
162{
163 struct class_device *cdev = &adev->class_dev;
164
165 class_device_del(cdev);
166}
167
168int __init atm_sysfs_init(void)
169{
170 return class_register(&atm_class);
171}
172
173void __exit atm_sysfs_exit(void)
174{
175 class_unregister(&atm_class);
176}
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 680ccb12aa..a487233dc4 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -5,7 +5,6 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary
5*/ 5*/
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/config.h>
9#include <linux/init.h> 8#include <linux/init.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/list.h> 10#include <linux/list.h>
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 72d8529826..2e62105d91 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -2,7 +2,6 @@
2 2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4 4
5#include <linux/config.h>
6#include <linux/string.h> 5#include <linux/string.h>
7#include <linux/errno.h> 6#include <linux/errno.h>
8#include <linux/kernel.h> /* for UINT_MAX */ 7#include <linux/kernel.h> /* for UINT_MAX */
@@ -24,6 +23,7 @@
24#include <linux/if.h> /* for IFF_UP */ 23#include <linux/if.h> /* for IFF_UP */
25#include <linux/inetdevice.h> 24#include <linux/inetdevice.h>
26#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/poison.h>
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/seq_file.h> 28#include <linux/seq_file.h>
29#include <linux/rcupdate.h> 29#include <linux/rcupdate.h>
@@ -98,7 +98,7 @@ static void unlink_clip_vcc(struct clip_vcc *clip_vcc)
98 printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n", clip_vcc); 98 printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n", clip_vcc);
99 return; 99 return;
100 } 100 }
101 spin_lock_bh(&entry->neigh->dev->xmit_lock); /* block clip_start_xmit() */ 101 netif_tx_lock_bh(entry->neigh->dev); /* block clip_start_xmit() */
102 entry->neigh->used = jiffies; 102 entry->neigh->used = jiffies;
103 for (walk = &entry->vccs; *walk; walk = &(*walk)->next) 103 for (walk = &entry->vccs; *walk; walk = &(*walk)->next)
104 if (*walk == clip_vcc) { 104 if (*walk == clip_vcc) {
@@ -122,7 +122,7 @@ static void unlink_clip_vcc(struct clip_vcc *clip_vcc)
122 printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc " 122 printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc "
123 "0x%p)\n", entry, clip_vcc); 123 "0x%p)\n", entry, clip_vcc);
124 out: 124 out:
125 spin_unlock_bh(&entry->neigh->dev->xmit_lock); 125 netif_tx_unlock_bh(entry->neigh->dev);
126} 126}
127 127
128/* The neighbour entry n->lock is held. */ 128/* The neighbour entry n->lock is held. */
@@ -267,7 +267,7 @@ static void clip_neigh_destroy(struct neighbour *neigh)
267 DPRINTK("clip_neigh_destroy (neigh %p)\n", neigh); 267 DPRINTK("clip_neigh_destroy (neigh %p)\n", neigh);
268 if (NEIGH2ENTRY(neigh)->vccs) 268 if (NEIGH2ENTRY(neigh)->vccs)
269 printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n"); 269 printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n");
270 NEIGH2ENTRY(neigh)->vccs = (void *) 0xdeadbeef; 270 NEIGH2ENTRY(neigh)->vccs = (void *) NEIGHBOR_DEAD;
271} 271}
272 272
273static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb) 273static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb)
@@ -962,7 +962,6 @@ static struct file_operations arp_seq_fops = {
962 962
963static int __init atm_clip_init(void) 963static int __init atm_clip_init(void)
964{ 964{
965 struct proc_dir_entry *p;
966 neigh_table_init_no_netlink(&clip_tbl); 965 neigh_table_init_no_netlink(&clip_tbl);
967 966
968 clip_tbl_hook = &clip_tbl; 967 clip_tbl_hook = &clip_tbl;
@@ -972,9 +971,15 @@ static int __init atm_clip_init(void)
972 971
973 setup_timer(&idle_timer, idle_timer_check, 0); 972 setup_timer(&idle_timer, idle_timer_check, 0);
974 973
975 p = create_proc_entry("arp", S_IRUGO, atm_proc_root); 974#ifdef CONFIG_PROC_FS
976 if (p) 975 {
977 p->proc_fops = &arp_seq_fops; 976 struct proc_dir_entry *p;
977
978 p = create_proc_entry("arp", S_IRUGO, atm_proc_root);
979 if (p)
980 p->proc_fops = &arp_seq_fops;
981 }
982#endif
978 983
979 return 0; 984 return 0;
980} 985}
diff --git a/net/atm/common.c b/net/atm/common.c
index ae002220fa..fbabff4944 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -3,7 +3,6 @@
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4 4
5 5
6#include <linux/config.h>
7#include <linux/module.h> 6#include <linux/module.h>
8#include <linux/kmod.h> 7#include <linux/kmod.h>
9#include <linux/net.h> /* struct socket, struct proto_ops */ 8#include <linux/net.h> /* struct socket, struct proto_ops */
@@ -791,8 +790,14 @@ static int __init atm_init(void)
791 printk(KERN_ERR "atm_proc_init() failed with %d\n",error); 790 printk(KERN_ERR "atm_proc_init() failed with %d\n",error);
792 goto out_atmsvc_exit; 791 goto out_atmsvc_exit;
793 } 792 }
793 if ((error = atm_sysfs_init()) < 0) {
794 printk(KERN_ERR "atm_sysfs_init() failed with %d\n",error);
795 goto out_atmproc_exit;
796 }
794out: 797out:
795 return error; 798 return error;
799out_atmproc_exit:
800 atm_proc_exit();
796out_atmsvc_exit: 801out_atmsvc_exit:
797 atmsvc_exit(); 802 atmsvc_exit();
798out_atmpvc_exit: 803out_atmpvc_exit:
@@ -805,6 +810,7 @@ out_unregister_vcc_proto:
805static void __exit atm_exit(void) 810static void __exit atm_exit(void)
806{ 811{
807 atm_proc_exit(); 812 atm_proc_exit();
813 atm_sysfs_exit();
808 atmsvc_exit(); 814 atmsvc_exit();
809 atmpvc_exit(); 815 atmpvc_exit();
810 proto_unregister(&vcc_proto); 816 proto_unregister(&vcc_proto);
diff --git a/net/atm/common.h b/net/atm/common.h
index 4887c317ce..a422da7788 100644
--- a/net/atm/common.h
+++ b/net/atm/common.h
@@ -28,6 +28,8 @@ int atmpvc_init(void);
28void atmpvc_exit(void); 28void atmpvc_exit(void);
29int atmsvc_init(void); 29int atmsvc_init(void);
30void atmsvc_exit(void); 30void atmsvc_exit(void);
31int atm_sysfs_init(void);
32void atm_sysfs_exit(void);
31 33
32#ifdef CONFIG_PROC_FS 34#ifdef CONFIG_PROC_FS
33int atm_proc_init(void); 35int atm_proc_init(void);
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c
index 851cfa6312..8c2022c3e8 100644
--- a/net/atm/ioctl.c
+++ b/net/atm/ioctl.c
@@ -4,7 +4,6 @@
4/* 2003 John Levon <levon@movementarian.org> */ 4/* 2003 John Levon <levon@movementarian.org> */
5 5
6 6
7#include <linux/config.h>
8#include <linux/module.h> 7#include <linux/module.h>
9#include <linux/kmod.h> 8#include <linux/kmod.h>
10#include <linux/net.h> /* struct socket, struct proto_ops */ 9#include <linux/net.h> /* struct socket, struct proto_ops */
diff --git a/net/atm/ipcommon.c b/net/atm/ipcommon.c
index 4b1faca501..1d3de42fad 100644
--- a/net/atm/ipcommon.c
+++ b/net/atm/ipcommon.c
@@ -25,22 +25,27 @@
25/* 25/*
26 * skb_migrate appends the list at "from" to "to", emptying "from" in the 26 * skb_migrate appends the list at "from" to "to", emptying "from" in the
27 * process. skb_migrate is atomic with respect to all other skb operations on 27 * process. skb_migrate is atomic with respect to all other skb operations on
28 * "from" and "to". Note that it locks both lists at the same time, so beware 28 * "from" and "to". Note that it locks both lists at the same time, so to deal
29 * of potential deadlocks. 29 * with the lock ordering, the locks are taken in address order.
30 * 30 *
31 * This function should live in skbuff.c or skbuff.h. 31 * This function should live in skbuff.c or skbuff.h.
32 */ 32 */
33 33
34 34
35void skb_migrate(struct sk_buff_head *from,struct sk_buff_head *to) 35void skb_migrate(struct sk_buff_head *from, struct sk_buff_head *to)
36{ 36{
37 unsigned long flags; 37 unsigned long flags;
38 struct sk_buff *skb_from = (struct sk_buff *) from; 38 struct sk_buff *skb_from = (struct sk_buff *) from;
39 struct sk_buff *skb_to = (struct sk_buff *) to; 39 struct sk_buff *skb_to = (struct sk_buff *) to;
40 struct sk_buff *prev; 40 struct sk_buff *prev;
41 41
42 spin_lock_irqsave(&from->lock,flags); 42 if ((unsigned long) from < (unsigned long) to) {
43 spin_lock(&to->lock); 43 spin_lock_irqsave(&from->lock, flags);
44 spin_lock_nested(&to->lock, SINGLE_DEPTH_NESTING);
45 } else {
46 spin_lock_irqsave(&to->lock, flags);
47 spin_lock_nested(&from->lock, SINGLE_DEPTH_NESTING);
48 }
44 prev = from->prev; 49 prev = from->prev;
45 from->next->prev = to->prev; 50 from->next->prev = to->prev;
46 prev->next = skb_to; 51 prev->next = skb_to;
@@ -51,7 +56,7 @@ void skb_migrate(struct sk_buff_head *from,struct sk_buff_head *to)
51 from->prev = skb_from; 56 from->prev = skb_from;
52 from->next = skb_from; 57 from->next = skb_from;
53 from->qlen = 0; 58 from->qlen = 0;
54 spin_unlock_irqrestore(&from->lock,flags); 59 spin_unlock_irqrestore(&from->lock, flags);
55} 60}
56 61
57 62
diff --git a/net/atm/lec.c b/net/atm/lec.c
index c4fc722fef..4b68a18171 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -4,7 +4,6 @@
4 * 4 *
5 */ 5 */
6 6
7#include <linux/config.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9#include <linux/bitops.h> 8#include <linux/bitops.h>
10#include <linux/capability.h> 9#include <linux/capability.h>
diff --git a/net/atm/lec.h b/net/atm/lec.h
index 6606082b29..c22a8bfa1f 100644
--- a/net/atm/lec.h
+++ b/net/atm/lec.h
@@ -9,7 +9,6 @@
9#ifndef _LEC_H_ 9#ifndef _LEC_H_
10#define _LEC_H_ 10#define _LEC_H_
11 11
12#include <linux/config.h>
13#include <linux/atmdev.h> 12#include <linux/atmdev.h>
14#include <linux/netdevice.h> 13#include <linux/netdevice.h>
15#include <linux/atmlec.h> 14#include <linux/atmlec.h>
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index c304ef1513..9aafe1e2f0 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -25,7 +25,6 @@
25#include <linux/atmlec.h> 25#include <linux/atmlec.h>
26#include <linux/atmmpc.h> 26#include <linux/atmmpc.h>
27/* Modular too */ 27/* Modular too */
28#include <linux/config.h>
29#include <linux/module.h> 28#include <linux/module.h>
30 29
31#include "lec.h" 30#include "lec.h"
@@ -229,20 +228,15 @@ int atm_mpoa_delete_qos(struct atm_mpoa_qos *entry)
229/* this is buggered - we need locking for qos_head */ 228/* this is buggered - we need locking for qos_head */
230void atm_mpoa_disp_qos(struct seq_file *m) 229void atm_mpoa_disp_qos(struct seq_file *m)
231{ 230{
232 unsigned char *ip;
233 char ipaddr[16];
234 struct atm_mpoa_qos *qos; 231 struct atm_mpoa_qos *qos;
235 232
236 qos = qos_head; 233 qos = qos_head;
237 seq_printf(m, "QoS entries for shortcuts:\n"); 234 seq_printf(m, "QoS entries for shortcuts:\n");
238 seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n"); 235 seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n");
239 236
240 ipaddr[sizeof(ipaddr)-1] = '\0';
241 while (qos != NULL) { 237 while (qos != NULL) {
242 ip = (unsigned char *)&qos->ipaddr;
243 sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(ip));
244 seq_printf(m, "%u.%u.%u.%u\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", 238 seq_printf(m, "%u.%u.%u.%u\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n",
245 NIPQUAD(ipaddr), 239 NIPQUAD(qos->ipaddr),
246 qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu, 240 qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu,
247 qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu); 241 qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu);
248 qos = qos->next; 242 qos = qos->next;
@@ -1083,7 +1077,6 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1083static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry) 1077static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry)
1084{ 1078{
1085 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1079 uint32_t dst_ip = msg->content.in_info.in_dst_ip;
1086 unsigned char *ip __attribute__ ((unused)) = (unsigned char *)&dst_ip;
1087 struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip); 1080 struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip);
1088 eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client); 1081 eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client);
1089 1082
@@ -1097,7 +1090,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
1097 entry->shortcut = eg_entry->shortcut; 1090 entry->shortcut = eg_entry->shortcut;
1098 } 1091 }
1099 if(entry->shortcut){ 1092 if(entry->shortcut){
1100 dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(ip)); 1093 dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip));
1101 client->eg_ops->put(eg_entry); 1094 client->eg_ops->put(eg_entry);
1102 return; 1095 return;
1103 } 1096 }
@@ -1119,12 +1112,10 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
1119 1112
1120static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) 1113static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1121{ 1114{
1122 unsigned char *ip;
1123
1124 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1115 uint32_t dst_ip = msg->content.in_info.in_dst_ip;
1125 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); 1116 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc);
1126 ip = (unsigned char *)&dst_ip; 1117
1127 dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(ip)); 1118 dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip));
1128 ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); 1119 ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry);
1129 if(entry == NULL){ 1120 if(entry == NULL){
1130 printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); 1121 printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name);
diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c
index 64ddebb640..781ed1b932 100644
--- a/net/atm/mpoa_caches.c
+++ b/net/atm/mpoa_caches.c
@@ -223,7 +223,6 @@ static void in_cache_remove_entry(in_cache_entry *entry,
223 but an easy one... */ 223 but an easy one... */
224static void clear_count_and_expired(struct mpoa_client *client) 224static void clear_count_and_expired(struct mpoa_client *client)
225{ 225{
226 unsigned char *ip;
227 in_cache_entry *entry, *next_entry; 226 in_cache_entry *entry, *next_entry;
228 struct timeval now; 227 struct timeval now;
229 228
@@ -236,8 +235,7 @@ static void clear_count_and_expired(struct mpoa_client *client)
236 next_entry = entry->next; 235 next_entry = entry->next;
237 if((now.tv_sec - entry->tv.tv_sec) 236 if((now.tv_sec - entry->tv.tv_sec)
238 > entry->ctrl_info.holding_time){ 237 > entry->ctrl_info.holding_time){
239 ip = (unsigned char*)&entry->ctrl_info.in_dst_ip; 238 dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %u.%u.%u.%u\n", NIPQUAD(entry->ctrl_info.in_dst_ip));
240 dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %u.%u.%u.%u\n", NIPQUAD(ip));
241 client->in_ops->remove_entry(entry, client); 239 client->in_ops->remove_entry(entry, client);
242 } 240 }
243 entry = next_entry; 241 entry = next_entry;
@@ -455,7 +453,6 @@ static void eg_cache_remove_entry(eg_cache_entry *entry,
455 453
456static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_client *client) 454static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_client *client)
457{ 455{
458 unsigned char *ip;
459 eg_cache_entry *entry = kmalloc(sizeof(eg_cache_entry), GFP_KERNEL); 456 eg_cache_entry *entry = kmalloc(sizeof(eg_cache_entry), GFP_KERNEL);
460 457
461 if (entry == NULL) { 458 if (entry == NULL) {
@@ -463,8 +460,7 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli
463 return NULL; 460 return NULL;
464 } 461 }
465 462
466 ip = (unsigned char *)&msg->content.eg_info.eg_dst_ip; 463 dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(msg->content.eg_info.eg_dst_ip));
467 dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(ip));
468 memset(entry, 0, sizeof(eg_cache_entry)); 464 memset(entry, 0, sizeof(eg_cache_entry));
469 465
470 atomic_set(&entry->use, 1); 466 atomic_set(&entry->use, 1);
@@ -481,8 +477,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli
481 do_gettimeofday(&(entry->tv)); 477 do_gettimeofday(&(entry->tv));
482 entry->entry_state = EGRESS_RESOLVED; 478 entry->entry_state = EGRESS_RESOLVED;
483 dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id)); 479 dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id));
484 ip = (unsigned char *)&entry->ctrl_info.mps_ip; 480 dprintk("mpoa: mpoa_caches.c: mps_ip = %u.%u.%u.%u\n",
485 dprintk("mpoa: mpoa_caches.c: mps_ip = %u.%u.%u.%u\n", NIPQUAD(ip)); 481 NIPQUAD(entry->ctrl_info.mps_ip));
486 atomic_inc(&entry->use); 482 atomic_inc(&entry->use);
487 483
488 write_unlock_irq(&client->egress_lock); 484 write_unlock_irq(&client->egress_lock);
diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c
index 60834b5a14..d37b8911b3 100644
--- a/net/atm/mpoa_proc.c
+++ b/net/atm/mpoa_proc.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2 1
3#ifdef CONFIG_PROC_FS 2#ifdef CONFIG_PROC_FS
4#include <linux/errno.h> 3#include <linux/errno.h>
diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c
index 1489067c1e..76a7d8ff6c 100644
--- a/net/atm/pppoatm.c
+++ b/net/atm/pppoatm.c
@@ -34,7 +34,6 @@
34 */ 34 */
35 35
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/config.h>
38#include <linux/init.h> 37#include <linux/init.h>
39#include <linux/skbuff.h> 38#include <linux/skbuff.h>
40#include <linux/atm.h> 39#include <linux/atm.h>
diff --git a/net/atm/proc.c b/net/atm/proc.c
index 4041054e52..3f95b0886a 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -8,7 +8,6 @@
8 * the reader. 8 * the reader.
9 */ 9 */
10 10
11#include <linux/config.h>
12#include <linux/module.h> /* for EXPORT_SYMBOL */ 11#include <linux/module.h> /* for EXPORT_SYMBOL */
13#include <linux/string.h> 12#include <linux/string.h>
14#include <linux/types.h> 13#include <linux/types.h>
diff --git a/net/atm/pvc.c b/net/atm/pvc.c
index f2c541774d..b2148b43a4 100644
--- a/net/atm/pvc.c
+++ b/net/atm/pvc.c
@@ -3,7 +3,6 @@
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4 4
5 5
6#include <linux/config.h>
7#include <linux/net.h> /* struct socket, struct proto_ops */ 6#include <linux/net.h> /* struct socket, struct proto_ops */
8#include <linux/atm.h> /* ATM stuff */ 7#include <linux/atm.h> /* ATM stuff */
9#include <linux/atmdev.h> /* ATM devices */ 8#include <linux/atmdev.h> /* ATM devices */
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 18ac80698f..de25c6408b 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -8,7 +8,6 @@
8 * use the default destruct function initialized by sock_init_data */ 8 * use the default destruct function initialized by sock_init_data */
9 9
10 10
11#include <linux/config.h>
12#include <linux/ctype.h> 11#include <linux/ctype.h>
13#include <linux/string.h> 12#include <linux/string.h>
14#include <linux/atmdev.h> 13#include <linux/atmdev.h>
@@ -114,14 +113,27 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
114 printk(KERN_ERR "atm_dev_register: " 113 printk(KERN_ERR "atm_dev_register: "
115 "atm_proc_dev_register failed for dev %s\n", 114 "atm_proc_dev_register failed for dev %s\n",
116 type); 115 type);
117 mutex_unlock(&atm_dev_mutex); 116 goto out_fail;
118 kfree(dev); 117 }
119 return NULL; 118
119 if (atm_register_sysfs(dev) < 0) {
120 printk(KERN_ERR "atm_dev_register: "
121 "atm_register_sysfs failed for dev %s\n",
122 type);
123 atm_proc_dev_deregister(dev);
124 goto out_fail;
120 } 125 }
126
121 list_add_tail(&dev->dev_list, &atm_devs); 127 list_add_tail(&dev->dev_list, &atm_devs);
122 mutex_unlock(&atm_dev_mutex);
123 128
129out:
130 mutex_unlock(&atm_dev_mutex);
124 return dev; 131 return dev;
132
133out_fail:
134 kfree(dev);
135 dev = NULL;
136 goto out;
125} 137}
126 138
127 139
@@ -140,6 +152,7 @@ void atm_dev_deregister(struct atm_dev *dev)
140 mutex_unlock(&atm_dev_mutex); 152 mutex_unlock(&atm_dev_mutex);
141 153
142 atm_dev_release_vccs(dev); 154 atm_dev_release_vccs(dev);
155 atm_unregister_sysfs(dev);
143 atm_proc_dev_deregister(dev); 156 atm_proc_dev_deregister(dev);
144 157
145 atm_dev_put(dev); 158 atm_dev_put(dev);
diff --git a/net/atm/resources.h b/net/atm/resources.h
index ac7222fee7..1d004aaaee 100644
--- a/net/atm/resources.h
+++ b/net/atm/resources.h
@@ -6,7 +6,6 @@
6#ifndef NET_ATM_RESOURCES_H 6#ifndef NET_ATM_RESOURCES_H
7#define NET_ATM_RESOURCES_H 7#define NET_ATM_RESOURCES_H
8 8
9#include <linux/config.h>
10#include <linux/atmdev.h> 9#include <linux/atmdev.h>
11#include <linux/mutex.h> 10#include <linux/mutex.h>
12 11
@@ -43,4 +42,6 @@ static inline void atm_proc_dev_deregister(struct atm_dev *dev)
43 42
44#endif /* CONFIG_PROC_FS */ 43#endif /* CONFIG_PROC_FS */
45 44
45int atm_register_sysfs(struct atm_dev *adev);
46void atm_unregister_sysfs(struct atm_dev *adev);
46#endif 47#endif