]>
Commit | Line | Data |
---|---|---|
b5a39c4d JR |
1 | diff -uN linux-2.4.20/include/linux/atmdev.h linux-2.5.63/include/linux/atmdev.h |
2 | --- linux-2.4.20/include/linux/atmdev.h Sat Aug 3 02:39:45 2002 | |
3 | +++ linux-2.5.63/include/linux/atmdev.h Mon Feb 24 20:05:40 2003 | |
4 | @@ -33,7 +33,8 @@ | |
5 | #define ATM_PDU_OVHD 0 /* number of bytes to charge against buffer | |
6 | quota per PDU */ | |
7 | ||
8 | -#define ATM_SD(s) ((s)->sk->protinfo.af_atm) | |
9 | +#define atm_sk(__sk) ((struct atm_vcc *)(__sk)->protinfo.af_atm) | |
10 | +#define ATM_SD(s) (atm_sk((s)->sk)) | |
11 | ||
12 | ||
13 | #define __AAL_STAT_ITEMS \ | |
14 | @@ -206,7 +205,7 @@ | |
15 | #undef __AAL_STAT_ITEMS | |
16 | #else | |
17 | ||
18 | -#include <linux/sched.h> /* wait_queue_head_t */ | |
19 | +#include <linux/wait.h> /* wait_queue_head_t */ | |
20 | #include <linux/time.h> /* struct timeval */ | |
21 | #include <linux/net.h> | |
22 | #include <linux/skbuff.h> /* struct sk_buff */ | |
23 | @@ -276,12 +275,8 @@ | |
24 | ||
25 | #define ATM_ATMOPT_CLP 1 /* set CLP bit */ | |
26 | ||
27 | - | |
28 | -typedef struct { unsigned long bits; } atm_vcc_flags_t; | |
29 | - | |
30 | - | |
31 | struct atm_vcc { | |
32 | - atm_vcc_flags_t flags; /* VCC flags (ATM_VF_*) */ | |
33 | + unsigned long flags; /* VCC flags (ATM_VF_*) */ | |
34 | unsigned char family; /* address family; 0 if unused */ | |
35 | short vpi; /* VPI and VCI (types must be equal */ | |
36 | /* with sockaddr) */ | |
37 | @@ -302,7 +297,6 @@ | |
38 | int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); | |
39 | void *dev_data; /* per-device data */ | |
40 | void *proto_data; /* per-protocol data */ | |
41 | - struct timeval timestamp; /* AAL timestamps */ | |
42 | struct sk_buff_head recvq; /* receive queue */ | |
43 | struct k_atm_aal_stats *stats; /* pointer to AAL stats group */ | |
44 | wait_queue_head_t sleep; /* if socket is busy */ | |
45 | @@ -331,10 +325,6 @@ | |
46 | struct atm_dev_addr *next; /* next address */ | |
47 | }; | |
48 | ||
49 | - | |
50 | -typedef struct { unsigned int bits; } atm_dev_flags_t; | |
51 | - | |
52 | - | |
53 | struct atm_dev { | |
54 | const struct atmdev_ops *ops; /* device operations; NULL if unused */ | |
55 | const struct atmphy_ops *phy; /* PHY operations, may be undefined */ | |
56 | @@ -345,7 +335,7 @@ | |
57 | struct atm_vcc *last; /* last VCC (or undefined) */ | |
58 | void *dev_data; /* per-device data */ | |
59 | void *phy_data; /* private PHY date */ | |
60 | - atm_dev_flags_t flags; /* device flags (ATM_DF_*) */ | |
61 | + unsigned long flags; /* device flags (ATM_DF_*) */ | |
62 | struct atm_dev_addr *local; /* local ATM addresses */ | |
63 | unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */ | |
64 | struct atm_cirange ci_range; /* VPI/VCI range */ | |
65 | @@ -415,7 +405,7 @@ | |
66 | #define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb)) | |
67 | ||
68 | struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, | |
69 | - int number,atm_dev_flags_t *flags); /* number == -1: pick first available */ | |
70 | + int number,unsigned long *flags); /* number == -1: pick first available */ | |
71 | struct atm_dev *atm_find_dev(int number); | |
72 | void atm_dev_deregister(struct atm_dev *dev); | |
73 | void shutdown_atm_dev(struct atm_dev *dev); | |
74 | diff -urN linux-2.4.20/net/atm/clip.c linux-2.5.63/net/atm/clip.c | |
75 | --- linux-2.4.20/net/atm/clip.c Thu Jun 28 02:10:55 2001 | |
76 | +++ linux-2.5.63/net/atm/clip.c Mon Feb 24 20:06:01 2003 | |
77 | @@ -710,7 +711,7 @@ | |
78 | 999, /* dummy device number */ | |
79 | NULL,NULL, /* pretend not to have any VCCs */ | |
80 | NULL,NULL, /* no data */ | |
81 | - { 0 }, /* no flags */ | |
82 | + 0, /* no flags */ | |
83 | NULL, /* no local address */ | |
84 | { 0 } /* no ESI, no statistics */ | |
85 | }; | |
86 | diff -urN linux-2.4.20/net/atm/common.c linux-2.5.63/net/atm/common.c | |
87 | --- linux-2.4.20/net/atm/common.c Sat Aug 3 02:39:46 2002 | |
88 | +++ linux-2.5.63/net/atm/common.c Mon Feb 24 20:06:03 2003 | |
89 | @@ -112,7 +105,7 @@ | |
90 | sock->sk = NULL; | |
91 | if (sock->type == SOCK_STREAM) return -EINVAL; | |
92 | if (!(sk = alloc_atm_vcc_sk(family))) return -ENOMEM; | |
93 | - vcc = sk->protinfo.af_atm; | |
94 | + vcc = atm_sk(sk); | |
95 | memset(&vcc->flags,0,sizeof(vcc->flags)); | |
96 | vcc->dev = NULL; | |
97 | vcc->family = sock->ops->family; | |
98 | @@ -128,7 +121,6 @@ | |
99 | vcc->push_oam = NULL; | |
100 | vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */ | |
101 | vcc->atm_options = vcc->aal_options = 0; | |
102 | - vcc->timestamp.tv_sec = vcc->timestamp.tv_usec = 0; | |
103 | init_waitqueue_head(&vcc->sleep); | |
104 | skb_queue_head_init(&vcc->recvq); | |
105 | skb_queue_head_init(&vcc->listenq); | |
106 | @@ -140,10 +132,9 @@ | |
107 | ||
108 | void atm_release_vcc_sk(struct sock *sk,int free_sk) | |
109 | { | |
110 | - struct atm_vcc *vcc; | |
111 | + struct atm_vcc *vcc = atm_sk(sk); | |
112 | struct sk_buff *skb; | |
113 | ||
114 | - vcc = sk->protinfo.af_atm; | |
115 | clear_bit(ATM_VF_READY,&vcc->flags); | |
116 | if (vcc->dev) { | |
117 | if (vcc->dev->ops->close) vcc->dev->ops->close(vcc); | |
118 | @@ -295,7 +286,7 @@ | |
119 | if (vpi != ATM_VPI_UNSPEC && vci != ATM_VCI_UNSPEC) | |
120 | clear_bit(ATM_VF_PARTIAL,&vcc->flags); | |
121 | else if (test_bit(ATM_VF_PARTIAL,&vcc->flags)) return -EINVAL; | |
122 | - printk(KERN_DEBUG "atm_connect (TX: cl %d,bw %d-%d,sdu %d; " | |
123 | + DPRINTK("atm_connect (TX: cl %d,bw %d-%d,sdu %d; " | |
124 | "RX: cl %d,bw %d-%d,sdu %d,AAL %s%d)\n", | |
125 | vcc->qos.txtp.traffic_class,vcc->qos.txtp.min_pcr, | |
126 | vcc->qos.txtp.max_pcr,vcc->qos.txtp.max_sdu, | |
127 | @@ -387,7 +378,7 @@ | |
128 | set_current_state(TASK_RUNNING); | |
129 | remove_wait_queue(&vcc->sleep,&wait); | |
130 | if (error <= 0) return error; | |
131 | - vcc->timestamp = skb->stamp; | |
132 | + sock_recv_timestamp(m, vcc->sk, skb); | |
133 | eff_len = skb->len > size ? size : skb->len; | |
134 | if (skb->len > size) /* Not fit ? Report it... */ | |
135 | m->msg_flags |= MSG_TRUNC; | |
136 | @@ -619,13 +610,11 @@ | |
137 | kfree(tmp_buf); | |
138 | goto done; | |
139 | case SIOCGSTAMP: /* borrowed from IP */ | |
140 | - if (!vcc->timestamp.tv_sec) { | |
141 | + if (!vcc->sk->stamp.tv_sec) { | |
142 | ret_val = -ENOENT; | |
143 | goto done; | |
144 | } | |
145 | - vcc->timestamp.tv_sec += vcc->timestamp.tv_usec/1000000; | |
146 | - vcc->timestamp.tv_usec %= 1000000; | |
147 | - ret_val = copy_to_user((void *) arg,&vcc->timestamp, | |
148 | + ret_val = copy_to_user((void *) arg, &vcc->sk->stamp, | |
149 | sizeof(struct timeval)) ? -EFAULT : 0; | |
150 | goto done; | |
151 | case ATM_SETSC: | |
152 | diff -urN linux-2.4.20/net/atm/lec.c linux-2.5.63/net/atm/lec.c | |
153 | --- linux-2.4.20/net/atm/lec.c Sun Sep 30 21:26:08 2001 | |
154 | +++ linux-2.5.63/net/atm/lec.c Mon Feb 24 20:05:34 2003 | |
155 | @@ -20,6 +20,7 @@ | |
156 | #include <net/arp.h> | |
157 | #include <net/dst.h> | |
158 | #include <linux/proc_fs.h> | |
159 | +#include <linux/spinlock.h> | |
160 | ||
161 | /* TokenRing if needed */ | |
162 | #ifdef CONFIG_TR | |
163 | @@ -35,6 +36,10 @@ | |
164 | #include <linux/if_bridge.h> | |
165 | #include "../bridge/br_private.h" | |
166 | static unsigned char bridge_ula_lec[] = {0x01, 0x80, 0xc2, 0x00, 0x00}; | |
167 | + | |
168 | +extern struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br, | |
169 | + unsigned char *addr); | |
170 | +extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); | |
171 | #endif | |
172 | ||
173 | /* Modular too */ | |
174 | @@ -51,10 +56,7 @@ | |
175 | #define DPRINTK(format,args...) | |
176 | #endif | |
177 | ||
178 | -extern struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br, | |
179 | - unsigned char *addr); | |
180 | -extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); | |
181 | - | |
182 | +static spinlock_t lec_arp_spinlock = SPIN_LOCK_UNLOCKED; | |
183 | ||
184 | #define DUMP_PACKETS 0 /* 0 = None, | |
185 | * 1 = 30 first bytes | |
186 | @@ -196,6 +198,23 @@ | |
187 | return 0; | |
188 | } | |
189 | ||
190 | +static __inline__ void | |
191 | +lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv) | |
192 | +{ | |
193 | + if (atm_may_send(vcc, skb->len)) { | |
194 | + atomic_add(skb->truesize, &vcc->tx_inuse); | |
195 | + ATM_SKB(skb)->vcc = vcc; | |
196 | + ATM_SKB(skb)->iovcnt = 0; | |
197 | + ATM_SKB(skb)->atm_options = vcc->atm_options; | |
198 | + priv->stats.tx_packets++; | |
199 | + priv->stats.tx_bytes += skb->len; | |
200 | + vcc->send(vcc, skb); | |
201 | + } else { | |
202 | + priv->stats.tx_dropped++; | |
203 | + dev_kfree_skb(skb); | |
204 | + } | |
205 | +} | |
206 | + | |
207 | static int | |
208 | lec_send_packet(struct sk_buff *skb, struct net_device *dev) | |
209 | { | |
210 | @@ -341,34 +360,10 @@ | |
211 | DPRINTK("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n", | |
212 | lec_h->h_dest[0], lec_h->h_dest[1], lec_h->h_dest[2], | |
213 | lec_h->h_dest[3], lec_h->h_dest[4], lec_h->h_dest[5]); | |
214 | - ATM_SKB(skb2)->vcc = send_vcc; | |
215 | - ATM_SKB(skb2)->iovcnt = 0; | |
216 | - ATM_SKB(skb2)->atm_options = send_vcc->atm_options; | |
217 | - DPRINTK("%s:sending to vpi:%d vci:%d\n", dev->name, | |
218 | - send_vcc->vpi, send_vcc->vci); | |
219 | - if (atm_may_send(send_vcc, skb2->len)) { | |
220 | - atomic_add(skb2->truesize, &send_vcc->tx_inuse); | |
221 | - priv->stats.tx_packets++; | |
222 | - priv->stats.tx_bytes += skb2->len; | |
223 | - send_vcc->send(send_vcc, skb2); | |
224 | - } else { | |
225 | - priv->stats.tx_dropped++; | |
226 | - dev_kfree_skb(skb2); | |
227 | - } | |
228 | + lec_send(send_vcc, skb2, priv); | |
229 | } | |
230 | ||
231 | - ATM_SKB(skb)->vcc = send_vcc; | |
232 | - ATM_SKB(skb)->iovcnt = 0; | |
233 | - ATM_SKB(skb)->atm_options = send_vcc->atm_options; | |
234 | - if (atm_may_send(send_vcc, skb->len)) { | |
235 | - atomic_add(skb->truesize, &send_vcc->tx_inuse); | |
236 | - priv->stats.tx_packets++; | |
237 | - priv->stats.tx_bytes += skb->len; | |
238 | - send_vcc->send(send_vcc, skb); | |
239 | - } else { | |
240 | - priv->stats.tx_dropped++; | |
241 | - dev_kfree_skb(skb); | |
242 | - } | |
243 | + lec_send(send_vcc, skb, priv); | |
244 | ||
245 | #if 0 | |
246 | /* Should we wait for card's device driver to notify us? */ | |
247 | @@ -564,7 +559,7 @@ | |
248 | 999, /*dummy device number*/ | |
249 | NULL,NULL, /*no VCCs*/ | |
250 | NULL,NULL, /*no data*/ | |
251 | - { 0 }, /*no flags*/ | |
252 | + 0, /*no flags*/ | |
253 | NULL, /* no local address*/ | |
254 | { 0 } /*no ESI or rest of the atm_dev struct things*/ | |
255 | }; | |
256 | @@ -1044,15 +1039,15 @@ | |
257 | #define HASH(ch) (ch & (LEC_ARP_TABLE_SIZE -1)) | |
258 | ||
259 | static __inline__ void | |
260 | -lec_arp_lock(struct lec_priv *priv) | |
261 | +lec_arp_get(struct lec_priv *priv) | |
262 | { | |
263 | - atomic_inc(&priv->lec_arp_lock_var); | |
264 | + atomic_inc(&priv->lec_arp_users); | |
265 | } | |
266 | ||
267 | static __inline__ void | |
268 | -lec_arp_unlock(struct lec_priv *priv) | |
269 | +lec_arp_put(struct lec_priv *priv) | |
270 | { | |
271 | - atomic_dec(&priv->lec_arp_lock_var); | |
272 | + atomic_dec(&priv->lec_arp_users); | |
273 | } | |
274 | ||
275 | /* | |
276 | @@ -1103,33 +1098,33 @@ | |
277 | * LANE2: Add to the end of the list to satisfy 8.1.13 | |
278 | */ | |
279 | static __inline__ void | |
280 | -lec_arp_put(struct lec_arp_table **lec_arp_tables, | |
281 | - struct lec_arp_table *to_put) | |
282 | +lec_arp_add(struct lec_arp_table **lec_arp_tables, | |
283 | + struct lec_arp_table *to_add) | |
284 | { | |
285 | - unsigned short place; | |
286 | unsigned long flags; | |
287 | + unsigned short place; | |
288 | struct lec_arp_table *tmp; | |
289 | ||
290 | - save_flags(flags); | |
291 | - cli(); | |
292 | + spin_lock_irqsave(&lec_arp_spinlock, flags); | |
293 | ||
294 | - place = HASH(to_put->mac_addr[ETH_ALEN-1]); | |
295 | + place = HASH(to_add->mac_addr[ETH_ALEN-1]); | |
296 | tmp = lec_arp_tables[place]; | |
297 | - to_put->next = NULL; | |
298 | + to_add->next = NULL; | |
299 | if (tmp == NULL) | |
300 | - lec_arp_tables[place] = to_put; | |
301 | + lec_arp_tables[place] = to_add; | |
302 | ||
303 | else { /* add to the end */ | |
304 | while (tmp->next) | |
305 | tmp = tmp->next; | |
306 | - tmp->next = to_put; | |
307 | + tmp->next = to_add; | |
308 | } | |
309 | ||
310 | - restore_flags(flags); | |
311 | + spin_unlock_irqrestore(&lec_arp_spinlock, flags); | |
312 | + | |
313 | DPRINTK("LEC_ARP: Added entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", | |
314 | - 0xff&to_put->mac_addr[0], 0xff&to_put->mac_addr[1], | |
315 | - 0xff&to_put->mac_addr[2], 0xff&to_put->mac_addr[3], | |
316 | - 0xff&to_put->mac_addr[4], 0xff&to_put->mac_addr[5]); | |
317 | + 0xff&to_add->mac_addr[0], 0xff&to_add->mac_addr[1], | |
318 | + 0xff&to_add->mac_addr[2], 0xff&to_add->mac_addr[3], | |
319 | + 0xff&to_add->mac_addr[4], 0xff&to_add->mac_addr[5]); | |
320 | } | |
321 | ||
322 | /* | |
323 | @@ -1139,16 +1134,15 @@ | |
324 | lec_arp_remove(struct lec_arp_table **lec_arp_tables, | |
325 | struct lec_arp_table *to_remove) | |
326 | { | |
327 | + unsigned long flags; | |
328 | unsigned short place; | |
329 | struct lec_arp_table *tmp; | |
330 | - unsigned long flags; | |
331 | int remove_vcc=1; | |
332 | ||
333 | - save_flags(flags); | |
334 | - cli(); | |
335 | + spin_lock_irqsave(&lec_arp_spinlock, flags); | |
336 | ||
337 | if (!to_remove) { | |
338 | - restore_flags(flags); | |
339 | + spin_unlock_irqrestore(&lec_arp_spinlock, flags); | |
340 | return -1; | |
341 | } | |
342 | place = HASH(to_remove->mac_addr[ETH_ALEN-1]); | |
343 | @@ -1160,7 +1154,7 @@ | |
344 | tmp = tmp->next; | |
345 | } | |
346 | if (!tmp) {/* Entry was not found */ | |
347 | - restore_flags(flags); | |
348 | + spin_unlock_irqrestore(&lec_arp_spinlock, flags); | |
349 | return -1; | |
350 | } | |
351 | } | |
352 | @@ -1186,7 +1180,9 @@ | |
353 | lec_arp_clear_vccs(to_remove); | |
354 | } | |
355 | skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */ | |
356 | - restore_flags(flags); | |
357 | + | |
358 | + spin_unlock_irqrestore(&lec_arp_spinlock, flags); | |
359 | + | |
360 | DPRINTK("LEC_ARP: Removed entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", | |
361 | 0xff&to_remove->mac_addr[0], 0xff&to_remove->mac_addr[1], | |
362 | 0xff&to_remove->mac_addr[2], 0xff&to_remove->mac_addr[3], | |
363 | @@ -1371,12 +1367,8 @@ | |
364 | lec_arp_destroy(struct lec_priv *priv) | |
365 | { | |
366 | struct lec_arp_table *entry, *next; | |
367 | - unsigned long flags; | |
368 | int i; | |
369 | ||
370 | - save_flags(flags); | |
371 | - cli(); | |
372 | - | |
373 | del_timer(&priv->lec_arp_timer); | |
374 | ||
375 | /* | |
376 | @@ -1419,7 +1411,6 @@ | |
377 | priv->mcast_vcc = NULL; | |
378 | memset(priv->lec_arp_tables, 0, | |
379 | sizeof(struct lec_arp_table*)*LEC_ARP_TABLE_SIZE); | |
380 | - restore_flags(flags); | |
381 | } | |
382 | ||
383 | ||
384 | @@ -1436,18 +1427,18 @@ | |
385 | DPRINTK("LEC_ARP: lec_arp_find :%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", | |
386 | mac_addr[0]&0xff, mac_addr[1]&0xff, mac_addr[2]&0xff, | |
387 | mac_addr[3]&0xff, mac_addr[4]&0xff, mac_addr[5]&0xff); | |
388 | - lec_arp_lock(priv); | |
389 | + lec_arp_get(priv); | |
390 | place = HASH(mac_addr[ETH_ALEN-1]); | |
391 | ||
392 | to_return = priv->lec_arp_tables[place]; | |
393 | while(to_return) { | |
394 | if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0) { | |
395 | - lec_arp_unlock(priv); | |
396 | + lec_arp_put(priv); | |
397 | return to_return; | |
398 | } | |
399 | to_return = to_return->next; | |
400 | } | |
401 | - lec_arp_unlock(priv); | |
402 | + lec_arp_put(priv); | |
403 | return NULL; | |
404 | } | |
405 | ||
406 | @@ -1574,11 +1565,11 @@ | |
407 | del_timer(&priv->lec_arp_timer); | |
408 | ||
409 | DPRINTK("lec_arp_check_expire %p,%d\n",priv, | |
410 | - priv->lec_arp_lock_var.counter); | |
411 | + atomic_read(&priv->lec_arp_users)); | |
412 | DPRINTK("expire: eo:%p nf:%p\n",priv->lec_arp_empty_ones, | |
413 | priv->lec_no_forward); | |
414 | - if (!priv->lec_arp_lock_var.counter) { | |
415 | - lec_arp_lock(priv); | |
416 | + if (!atomic_read(&priv->lec_arp_users)) { | |
417 | + lec_arp_get(priv); | |
418 | now = jiffies; | |
419 | for(i=0;i<LEC_ARP_TABLE_SIZE;i++) { | |
420 | for(entry = lec_arp_tables[i];entry != NULL;) { | |
421 | @@ -1616,6 +1607,10 @@ | |
422 | && | |
423 | time_after_eq(now, entry->timestamp+ | |
424 | priv->path_switching_delay)) { | |
425 | + struct sk_buff *skb; | |
426 | + | |
427 | + while ((skb = skb_dequeue(&entry->tx_wait))) | |
428 | + lec_send(entry->vcc, skb, entry->priv); | |
429 | entry->last_used = jiffies; | |
430 | entry->status = | |
431 | ESI_FORWARD_DIRECT; | |
432 | @@ -1624,7 +1619,7 @@ | |
433 | } | |
434 | } | |
435 | } | |
436 | - lec_arp_unlock(priv); | |
437 | + lec_arp_put(priv); | |
438 | } | |
439 | priv->lec_arp_timer.expires = jiffies + LEC_ARP_REFRESH_INTERVAL; | |
440 | add_timer(&priv->lec_arp_timer); | |
441 | @@ -1686,7 +1681,7 @@ | |
442 | if (!entry) { | |
443 | return priv->mcast_vcc; | |
444 | } | |
445 | - lec_arp_put(priv->lec_arp_tables, entry); | |
446 | + lec_arp_add(priv->lec_arp_tables, entry); | |
447 | /* We want arp-request(s) to be sent */ | |
448 | entry->packets_flooded =1; | |
449 | entry->status = ESI_ARP_PENDING; | |
450 | @@ -1711,7 +1706,7 @@ | |
451 | struct lec_arp_table *entry, *next; | |
452 | int i; | |
453 | ||
454 | - lec_arp_lock(priv); | |
455 | + lec_arp_get(priv); | |
456 | DPRINTK("lec_addr_delete\n"); | |
457 | for(i=0;i<LEC_ARP_TABLE_SIZE;i++) { | |
458 | for(entry=priv->lec_arp_tables[i];entry != NULL; entry=next) { | |
459 | @@ -1722,11 +1717,11 @@ | |
460 | lec_arp_remove(priv->lec_arp_tables, entry); | |
461 | kfree(entry); | |
462 | } | |
463 | - lec_arp_unlock(priv); | |
464 | + lec_arp_put(priv); | |
465 | return 0; | |
466 | } | |
467 | } | |
468 | - lec_arp_unlock(priv); | |
469 | + lec_arp_put(priv); | |
470 | return -1; | |
471 | } | |
472 | ||
473 | @@ -1751,7 +1746,7 @@ | |
474 | return; /* LANE2: ignore targetless LE_ARPs for which | |
475 | * we have no entry in the cache. 7.1.30 | |
476 | */ | |
477 | - lec_arp_lock(priv); | |
478 | + lec_arp_get(priv); | |
479 | if (priv->lec_arp_empty_ones) { | |
480 | entry = priv->lec_arp_empty_ones; | |
481 | if (!memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN)) { | |
482 | @@ -1785,13 +1780,13 @@ | |
483 | entry->status = ESI_FORWARD_DIRECT; | |
484 | memcpy(entry->mac_addr, mac_addr, ETH_ALEN); | |
485 | entry->last_used = jiffies; | |
486 | - lec_arp_put(priv->lec_arp_tables, entry); | |
487 | + lec_arp_add(priv->lec_arp_tables, entry); | |
488 | } | |
489 | if (remoteflag) | |
490 | entry->flags|=LEC_REMOTE_FLAG; | |
491 | else | |
492 | entry->flags&=~LEC_REMOTE_FLAG; | |
493 | - lec_arp_unlock(priv); | |
494 | + lec_arp_put(priv); | |
495 | DPRINTK("After update\n"); | |
496 | dump_arp_table(priv); | |
497 | return; | |
498 | @@ -1801,11 +1796,11 @@ | |
499 | if (!entry) { | |
500 | entry = make_entry(priv, mac_addr); | |
501 | if (!entry) { | |
502 | - lec_arp_unlock(priv); | |
503 | + lec_arp_put(priv); | |
504 | return; | |
505 | } | |
506 | entry->status = ESI_UNKNOWN; | |
507 | - lec_arp_put(priv->lec_arp_tables, entry); | |
508 | + lec_arp_add(priv->lec_arp_tables, entry); | |
509 | /* Temporary, changes before end of function */ | |
510 | } | |
511 | memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN); | |
512 | @@ -1840,7 +1835,7 @@ | |
513 | } | |
514 | DPRINTK("After update2\n"); | |
515 | dump_arp_table(priv); | |
516 | - lec_arp_unlock(priv); | |
517 | + lec_arp_put(priv); | |
518 | } | |
519 | ||
520 | /* | |
521 | @@ -1854,7 +1849,7 @@ | |
522 | struct lec_arp_table *entry; | |
523 | int i, found_entry=0; | |
524 | ||
525 | - lec_arp_lock(priv); | |
526 | + lec_arp_get(priv); | |
527 | if (ioc_data->receive == 2) { | |
528 | /* Vcc for Multicast Forward. No timer, LANEv2 7.1.20 and 2.3.5.3 */ | |
529 | ||
530 | @@ -1863,7 +1858,7 @@ | |
531 | entry = lec_arp_find(priv, bus_mac); | |
532 | if (!entry) { | |
533 | printk("LEC_ARP: Multicast entry not found!\n"); | |
534 | - lec_arp_unlock(priv); | |
535 | + lec_arp_put(priv); | |
536 | return; | |
537 | } | |
538 | memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN); | |
539 | @@ -1872,7 +1867,7 @@ | |
540 | #endif | |
541 | entry = make_entry(priv, bus_mac); | |
542 | if (entry == NULL) { | |
543 | - lec_arp_unlock(priv); | |
544 | + lec_arp_put(priv); | |
545 | return; | |
546 | } | |
547 | del_timer(&entry->timer); | |
548 | @@ -1881,7 +1876,7 @@ | |
549 | entry->old_recv_push = old_push; | |
550 | entry->next = priv->mcast_fwds; | |
551 | priv->mcast_fwds = entry; | |
552 | - lec_arp_unlock(priv); | |
553 | + lec_arp_put(priv); | |
554 | return; | |
555 | } else if (ioc_data->receive == 1) { | |
556 | /* Vcc which we don't want to make default vcc, attach it | |
557 | @@ -1899,7 +1894,7 @@ | |
558 | ioc_data->atm_addr[18],ioc_data->atm_addr[19]); | |
559 | entry = make_entry(priv, bus_mac); | |
560 | if (entry == NULL) { | |
561 | - lec_arp_unlock(priv); | |
562 | + lec_arp_put(priv); | |
563 | return; | |
564 | } | |
565 | memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN); | |
566 | @@ -1912,7 +1907,7 @@ | |
567 | add_timer(&entry->timer); | |
568 | entry->next = priv->lec_no_forward; | |
569 | priv->lec_no_forward = entry; | |
570 | - lec_arp_unlock(priv); | |
571 | + lec_arp_put(priv); | |
572 | dump_arp_table(priv); | |
573 | return; | |
574 | } | |
575 | @@ -1971,7 +1966,7 @@ | |
576 | } | |
577 | } | |
578 | if (found_entry) { | |
579 | - lec_arp_unlock(priv); | |
580 | + lec_arp_put(priv); | |
581 | DPRINTK("After vcc was added\n"); | |
582 | dump_arp_table(priv); | |
583 | return; | |
584 | @@ -1980,7 +1975,7 @@ | |
585 | this vcc */ | |
586 | entry = make_entry(priv, bus_mac); | |
587 | if (!entry) { | |
588 | - lec_arp_unlock(priv); | |
589 | + lec_arp_put(priv); | |
590 | return; | |
591 | } | |
592 | entry->vcc = vcc; | |
593 | @@ -1993,7 +1988,7 @@ | |
594 | entry->timer.expires = jiffies + priv->vcc_timeout_period; | |
595 | entry->timer.function = lec_arp_expire_vcc; | |
596 | add_timer(&entry->timer); | |
597 | - lec_arp_unlock(priv); | |
598 | + lec_arp_put(priv); | |
599 | DPRINTK("After vcc was added\n"); | |
600 | dump_arp_table(priv); | |
601 | } | |
602 | @@ -2009,6 +2004,10 @@ | |
603 | for (entry=priv->lec_arp_tables[i];entry;entry=entry->next) { | |
604 | if (entry->flush_tran_id == tran_id && | |
605 | entry->status == ESI_FLUSH_PENDING) { | |
606 | + struct sk_buff *skb; | |
607 | + | |
608 | + while ((skb = skb_dequeue(&entry->tx_wait))) | |
609 | + lec_send(entry->vcc, skb, entry->priv); | |
610 | entry->status = ESI_FORWARD_DIRECT; | |
611 | DPRINTK("LEC_ARP: Flushed\n"); | |
612 | } | |
613 | @@ -2039,10 +2038,10 @@ | |
614 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | |
615 | struct lec_arp_table *to_add; | |
616 | ||
617 | - lec_arp_lock(priv); | |
618 | + lec_arp_get(priv); | |
619 | to_add = make_entry(priv, mac_addr); | |
620 | if (!to_add) { | |
621 | - lec_arp_unlock(priv); | |
622 | + lec_arp_put(priv); | |
623 | return -ENOMEM; | |
624 | } | |
625 | memcpy(to_add->atm_addr, vcc->remote.sas_addr.prv, ATM_ESA_LEN); | |
626 | @@ -2052,8 +2051,8 @@ | |
627 | to_add->old_push = vcc->push; | |
628 | vcc->push = lec_push; | |
629 | priv->mcast_vcc = vcc; | |
630 | - lec_arp_put(priv->lec_arp_tables, to_add); | |
631 | - lec_arp_unlock(priv); | |
632 | + lec_arp_add(priv->lec_arp_tables, to_add); | |
633 | + lec_arp_put(priv); | |
634 | return 0; | |
635 | } | |
636 | ||
637 | @@ -2065,7 +2064,7 @@ | |
638 | ||
639 | DPRINTK("LEC_ARP: lec_vcc_close vpi:%d vci:%d\n",vcc->vpi,vcc->vci); | |
640 | dump_arp_table(priv); | |
641 | - lec_arp_lock(priv); | |
642 | + lec_arp_get(priv); | |
643 | for(i=0;i<LEC_ARP_TABLE_SIZE;i++) { | |
644 | for(entry = priv->lec_arp_tables[i];entry; entry=next) { | |
645 | next = entry->next; | |
646 | @@ -2127,7 +2126,7 @@ | |
647 | entry = next; | |
648 | } | |
649 | ||
650 | - lec_arp_unlock(priv); | |
651 | + lec_arp_put(priv); | |
652 | dump_arp_table(priv); | |
653 | } | |
654 | ||
655 | @@ -2135,9 +2134,9 @@ | |
656 | lec_arp_check_empties(struct lec_priv *priv, | |
657 | struct atm_vcc *vcc, struct sk_buff *skb) | |
658 | { | |
659 | + unsigned long flags; | |
660 | struct lec_arp_table *entry, *prev; | |
661 | struct lecdatahdr_8023 *hdr = (struct lecdatahdr_8023 *)skb->data; | |
662 | - unsigned long flags; | |
663 | unsigned char *src; | |
664 | #ifdef CONFIG_TR | |
665 | struct lecdatahdr_8025 *tr_hdr = (struct lecdatahdr_8025 *)skb->data; | |
666 | @@ -2147,26 +2146,26 @@ | |
667 | #endif | |
668 | src = hdr->h_source; | |
669 | ||
670 | - lec_arp_lock(priv); | |
671 | + lec_arp_get(priv); | |
672 | entry = priv->lec_arp_empty_ones; | |
673 | if (vcc == entry->vcc) { | |
674 | - save_flags(flags); | |
675 | - cli(); | |
676 | + spin_lock_irqsave(&lec_arp_spinlock, flags); | |
677 | del_timer(&entry->timer); | |
678 | memcpy(entry->mac_addr, src, ETH_ALEN); | |
679 | entry->status = ESI_FORWARD_DIRECT; | |
680 | entry->last_used = jiffies; | |
681 | priv->lec_arp_empty_ones = entry->next; | |
682 | - restore_flags(flags); | |
683 | + spin_unlock_irqrestore(&lec_arp_spinlock, flags); | |
684 | /* We might have got an entry */ | |
685 | if ((prev=lec_arp_find(priv,src))) { | |
686 | lec_arp_remove(priv->lec_arp_tables, prev); | |
687 | kfree(prev); | |
688 | } | |
689 | - lec_arp_put(priv->lec_arp_tables, entry); | |
690 | - lec_arp_unlock(priv); | |
691 | + lec_arp_add(priv->lec_arp_tables, entry); | |
692 | + lec_arp_put(priv); | |
693 | return; | |
694 | } | |
695 | + spin_lock_irqsave(&lec_arp_spinlock, flags); | |
696 | prev = entry; | |
697 | entry = entry->next; | |
698 | while (entry && entry->vcc != vcc) { | |
699 | @@ -2175,22 +2174,21 @@ | |
700 | } | |
701 | if (!entry) { | |
702 | DPRINTK("LEC_ARP: Arp_check_empties: entry not found!\n"); | |
703 | - lec_arp_unlock(priv); | |
704 | + lec_arp_put(priv); | |
705 | + spin_unlock_irqrestore(&lec_arp_spinlock, flags); | |
706 | return; | |
707 | } | |
708 | - save_flags(flags); | |
709 | - cli(); | |
710 | del_timer(&entry->timer); | |
711 | memcpy(entry->mac_addr, src, ETH_ALEN); | |
712 | entry->status = ESI_FORWARD_DIRECT; | |
713 | entry->last_used = jiffies; | |
714 | prev->next = entry->next; | |
715 | - restore_flags(flags); | |
716 | + spin_unlock_irqrestore(&lec_arp_spinlock, flags); | |
717 | if ((prev = lec_arp_find(priv, src))) { | |
718 | lec_arp_remove(priv->lec_arp_tables,prev); | |
719 | kfree(prev); | |
720 | } | |
721 | - lec_arp_put(priv->lec_arp_tables,entry); | |
722 | - lec_arp_unlock(priv); | |
723 | + lec_arp_add(priv->lec_arp_tables,entry); | |
724 | + lec_arp_put(priv); | |
725 | } | |
726 | MODULE_LICENSE("GPL"); | |
727 | diff -urN linux-2.4.20/net/atm/lec.h linux-2.5.63/net/atm/lec.h | |
728 | --- linux-2.4.20/net/atm/lec.h Fri Feb 9 20:34:13 2001 | |
729 | +++ linux-2.5.63/net/atm/lec.h Mon Feb 24 20:05:15 2003 | |
730 | @@ -98,7 +98,7 @@ | |
731 | establishes multiple Multicast Forward VCCs to us. This list | |
732 | collects all those VCCs. LANEv1 client has only one item in this | |
733 | list. These entries are not aged out. */ | |
734 | - atomic_t lec_arp_lock_var; | |
735 | + atomic_t lec_arp_users; | |
736 | struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */ | |
737 | struct atm_vcc *lecd; | |
738 | struct timer_list lec_arp_timer; | |
739 | diff -urN linux-2.4.20/net/atm/mpc.c linux-2.5.63/net/atm/mpc.c | |
740 | --- linux-2.4.20/net/atm/mpc.c Sun Sep 30 21:26:08 2001 | |
741 | +++ linux-2.5.63/net/atm/mpc.c Mon Feb 24 20:05:40 2003 | |
742 | @@ -13,7 +13,7 @@ | |
743 | #include <linux/ip.h> | |
744 | #include <asm/byteorder.h> | |
745 | #include <asm/uaccess.h> | |
746 | -#include <asm/checksum.h> /* for ip_fast_csum() */ | |
747 | +#include <net/checksum.h> /* for ip_fast_csum() */ | |
748 | #include <net/arp.h> | |
749 | #include <net/dst.h> | |
750 | #include <linux/proc_fs.h> | |
751 | @@ -741,18 +741,10 @@ | |
752 | }; | |
753 | ||
754 | static struct atm_dev mpc_dev = { | |
755 | - &mpc_ops, /* device operations */ | |
756 | - NULL, /* PHY operations */ | |
757 | - "mpc", /* device type name */ | |
758 | - 42, /* device index (dummy) */ | |
759 | - NULL, /* VCC table */ | |
760 | - NULL, /* last VCC */ | |
761 | - NULL, /* per-device data */ | |
762 | - NULL, /* private PHY data */ | |
763 | - { 0 }, /* device flags */ | |
764 | - NULL, /* local ATM address */ | |
765 | - { 0 } /* no ESI */ | |
766 | - /* rest of the members will be 0 */ | |
767 | + ops: &mpc_ops, | |
768 | + type: "mpc", | |
769 | + number: 42, | |
770 | + /* members not explicitely initialised will be 0 */ | |
771 | }; | |
772 | ||
773 | int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |
774 | @@ -1432,10 +1424,6 @@ | |
775 | struct atm_mpoa_qos *qos, *nextqos; | |
776 | struct lec_priv *priv; | |
777 | ||
778 | - if (MOD_IN_USE) { | |
779 | - printk("mpc.c: module in use\n"); | |
780 | - return; | |
781 | - } | |
782 | #ifdef CONFIG_PROC_FS | |
783 | mpc_proc_clean(); | |
784 | #endif | |
785 | diff -urN linux-2.4.20/net/atm/mpoa_proc.c linux-2.5.63/net/atm/mpoa_proc.c | |
786 | --- linux-2.4.20/net/atm/mpoa_proc.c Wed Jul 4 20:50:38 2001 | |
787 | +++ linux-2.5.63/net/atm/mpoa_proc.c Mon Feb 24 20:05:39 2003 | |
788 | @@ -111,7 +111,7 @@ | |
789 | unsigned char ip_string[16]; | |
790 | if(count == 0) | |
791 | return 0; | |
792 | - page = get_free_page(GFP_KERNEL); | |
793 | + page = get_zeroed_page(GFP_KERNEL); | |
794 | if(!page) | |
795 | return -ENOMEM; | |
796 | atm_mpoa_disp_qos((char *)page, &length); | |
797 | diff -urN linux-2.4.20/net/atm/proc.c linux-2.5.63/net/atm/proc.c | |
798 | --- linux-2.4.20/net/atm/proc.c Fri Nov 29 00:53:15 2002 | |
799 | +++ linux-2.5.63/net/atm/proc.c Mon Feb 24 20:05:14 2003 | |
800 | @@ -220,7 +220,7 @@ | |
801 | default: | |
802 | here += sprintf(here,"%3d",vcc->family); | |
803 | } | |
804 | - here += sprintf(here," %04lx %5d %7d/%7d %7d/%7d\n",vcc->flags.bits, | |
805 | + here += sprintf(here," %04lx %5d %7d/%7d %7d/%7d\n",vcc->flags, | |
806 | vcc->reply, | |
807 | atomic_read(&vcc->tx_inuse),vcc->sk->sndbuf, | |
808 | atomic_read(&vcc->rx_inuse),vcc->sk->rcvbuf); | |
809 | @@ -496,7 +496,7 @@ | |
810 | int length; | |
811 | ||
812 | if (count == 0) return 0; | |
813 | - page = get_free_page(GFP_KERNEL); | |
814 | + page = get_zeroed_page(GFP_KERNEL); | |
815 | if (!page) return -ENOMEM; | |
816 | dev = ((struct proc_dir_entry *) file->f_dentry->d_inode->u.generic_ip) | |
817 | ->data; | |
818 | @@ -521,7 +520,7 @@ | |
819 | ->data; | |
820 | ||
821 | if (count == 0) return 0; | |
822 | - page = get_free_page(GFP_KERNEL); | |
823 | + page = get_zeroed_page(GFP_KERNEL); | |
824 | if (!page) return -ENOMEM; | |
825 | length = (*info)(*pos,(char *) page); | |
826 | if (length > count) length = -EINVAL; | |
827 | @@ -552,7 +550,7 @@ | |
828 | for (num = dev->number; num; num /= 10) digits++; | |
829 | if (!digits) digits++; | |
830 | ||
831 | - dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_ATOMIC); | |
832 | + dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_KERNEL); | |
833 | if (!dev->proc_name) | |
834 | goto fail1; | |
835 | sprintf(dev->proc_name,"%s:%d",dev->type, dev->number); | |
836 | diff -urN linux-2.4.20/net/atm/pvc.c linux-2.5.63/net/atm/pvc.c | |
837 | --- linux-2.4.20/net/atm/pvc.c Thu Apr 12 21:11:39 2001 | |
838 | +++ linux-2.5.63/net/atm/pvc.c Mon Feb 24 20:05:14 2003 | |
839 | @@ -111,11 +111,8 @@ | |
840 | ||
841 | ||
842 | static struct net_proto_family pvc_family_ops = { | |
843 | - PF_ATMPVC, | |
844 | - pvc_create, | |
845 | - 0, /* no authentication */ | |
846 | - 0, /* no encryption */ | |
847 | - 0 /* no encrypt_net */ | |
848 | + family: PF_ATMPVC, | |
849 | + create: pvc_create, | |
850 | }; | |
851 | ||
852 | ||
853 | diff -urN linux-2.4.20/net/atm/resources.c linux-2.5.63/net/atm/resources.c | |
854 | --- linux-2.4.20/net/atm/resources.c Fri Nov 29 00:53:15 2002 | |
855 | +++ linux-2.5.63/net/atm/resources.c Mon Feb 24 20:05:45 2003 | |
856 | @@ -2,6 +2,11 @@ | |
857 | ||
858 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | |
859 | ||
860 | +/* Fixes | |
861 | + * Arnaldo Carvalho de Melo <acme@conectiva.com.br> | |
862 | + * 2002/01 - don't free the whole struct sock on sk->destruct time, | |
863 | + * use the default destruct function initialized by sock_init_data */ | |
864 | + | |
865 | ||
866 | #include <linux/config.h> | |
867 | #include <linux/ctype.h> | |
868 | @@ -11,7 +16,6 @@ | |
869 | #include <linux/module.h> | |
870 | #include <linux/bitops.h> | |
871 | #include <net/sock.h> /* for struct sock */ | |
872 | -#include <asm/segment.h> /* for get_fs_long and put_fs_long */ | |
873 | ||
874 | #include "common.h" | |
875 | #include "resources.h" | |
876 | @@ -27,14 +31,15 @@ | |
877 | struct atm_vcc *nodev_vccs = NULL; | |
878 | extern spinlock_t atm_dev_lock; | |
879 | ||
880 | - | |
881 | -static struct atm_dev *alloc_atm_dev(const char *type) | |
882 | +/* Caller must hold atm_dev_lock. */ | |
883 | +static struct atm_dev *__alloc_atm_dev(const char *type) | |
884 | { | |
885 | struct atm_dev *dev; | |
886 | ||
887 | dev = kmalloc(sizeof(*dev), GFP_ATOMIC); | |
888 | - if (!dev) return NULL; | |
889 | - memset(dev,0,sizeof(*dev)); | |
890 | + if (!dev) | |
891 | + return NULL; | |
892 | + memset(dev, 0, sizeof(*dev)); | |
893 | dev->type = type; | |
894 | dev->signal = ATM_PHY_SIG_UNKNOWN; | |
895 | dev->link_rate = ATM_OC3_PCR; | |
896 | @@ -42,39 +47,49 @@ | |
897 | ||
898 | dev->prev = last_dev; | |
899 | ||
900 | - if (atm_devs) last_dev->next = dev; | |
901 | - else atm_devs = dev; | |
902 | + if (atm_devs) | |
903 | + last_dev->next = dev; | |
904 | + else | |
905 | + atm_devs = dev; | |
906 | last_dev = dev; | |
907 | + | |
908 | return dev; | |
909 | } | |
910 | ||
911 | - | |
912 | -static void free_atm_dev(struct atm_dev *dev) | |
913 | +/* Caller must hold atm_dev_lock. */ | |
914 | +static void __free_atm_dev(struct atm_dev *dev) | |
915 | { | |
916 | - if (dev->prev) dev->prev->next = dev->next; | |
917 | - else atm_devs = dev->next; | |
918 | - if (dev->next) dev->next->prev = dev->prev; | |
919 | - else last_dev = dev->prev; | |
920 | + if (dev->prev) | |
921 | + dev->prev->next = dev->next; | |
922 | + else | |
923 | + atm_devs = dev->next; | |
924 | + if (dev->next) | |
925 | + dev->next->prev = dev->prev; | |
926 | + else | |
927 | + last_dev = dev->prev; | |
928 | kfree(dev); | |
929 | } | |
930 | ||
931 | +/* Caller must hold atm_dev_lock. */ | |
932 | struct atm_dev *atm_find_dev(int number) | |
933 | { | |
934 | struct atm_dev *dev; | |
935 | ||
936 | for (dev = atm_devs; dev; dev = dev->next) | |
937 | - if (dev->ops && dev->number == number) return dev; | |
938 | + if (dev->ops && dev->number == number) | |
939 | + return dev; | |
940 | return NULL; | |
941 | } | |
942 | ||
943 | -struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, | |
944 | - int number,atm_dev_flags_t *flags) | |
945 | + | |
946 | +struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |
947 | + int number, unsigned long *flags) | |
948 | { | |
949 | - struct atm_dev *dev = NULL; | |
950 | + struct atm_dev *dev; | |
951 | ||
952 | spin_lock(&atm_dev_lock); | |
953 | ||
954 | - dev = alloc_atm_dev(type); | |
955 | + dev = __alloc_atm_dev(type); | |
956 | if (!dev) { | |
957 | printk(KERN_ERR "atm_dev_register: no space for dev %s\n", | |
958 | type); | |
959 | @@ -82,31 +97,37 @@ | |
960 | } | |
961 | if (number != -1) { | |
962 | if (atm_find_dev(number)) { | |
963 | - free_atm_dev(dev); | |
964 | - return NULL; | |
965 | + __free_atm_dev(dev); | |
966 | + dev = NULL; | |
967 | + goto done; | |
968 | } | |
969 | dev->number = number; | |
970 | } else { | |
971 | dev->number = 0; | |
972 | - while (atm_find_dev(dev->number)) dev->number++; | |
973 | + while (atm_find_dev(dev->number)) | |
974 | + dev->number++; | |
975 | } | |
976 | dev->vccs = dev->last = NULL; | |
977 | dev->dev_data = NULL; | |
978 | barrier(); | |
979 | dev->ops = ops; | |
980 | - if (flags) | |
981 | + if (flags) | |
982 | dev->flags = *flags; | |
983 | - else | |
984 | - memset(&dev->flags,0,sizeof(dev->flags)); | |
985 | - memset((void *) &dev->stats,0,sizeof(dev->stats)); | |
986 | + else | |
987 | + memset(&dev->flags, 0, sizeof(dev->flags)); | |
988 | + memset(&dev->stats, 0, sizeof(dev->stats)); | |
989 | + | |
990 | #ifdef CONFIG_PROC_FS | |
991 | - if (ops->proc_read) | |
992 | + if (ops->proc_read) { | |
993 | if (atm_proc_dev_register(dev) < 0) { | |
994 | printk(KERN_ERR "atm_dev_register: " | |
995 | - "atm_proc_dev_register failed for dev %s\n",type); | |
996 | - free_atm_dev(dev); | |
997 | + "atm_proc_dev_register failed for dev %s\n", | |
998 | + type); | |
999 | + __free_atm_dev(dev); | |
1000 | + dev = NULL; | |
1001 | goto done; | |
1002 | } | |
1003 | + } | |
1004 | #endif | |
1005 | ||
1006 | done: | |
1007 | @@ -118,47 +139,50 @@ | |
1008 | void atm_dev_deregister(struct atm_dev *dev) | |
1009 | { | |
1010 | #ifdef CONFIG_PROC_FS | |
1011 | - if (dev->ops->proc_read) atm_proc_dev_deregister(dev); | |
1012 | + if (dev->ops->proc_read) | |
1013 | + atm_proc_dev_deregister(dev); | |
1014 | #endif | |
1015 | spin_lock(&atm_dev_lock); | |
1016 | - free_atm_dev(dev); | |
1017 | + __free_atm_dev(dev); | |
1018 | spin_unlock(&atm_dev_lock); | |
1019 | } | |
1020 | ||
1021 | void shutdown_atm_dev(struct atm_dev *dev) | |
1022 | { | |
1023 | if (dev->vccs) { | |
1024 | - set_bit(ATM_DF_CLOSE,&dev->flags); | |
1025 | + set_bit(ATM_DF_CLOSE, &dev->flags); | |
1026 | return; | |
1027 | } | |
1028 | - if (dev->ops->dev_close) dev->ops->dev_close(dev); | |
1029 | + if (dev->ops->dev_close) | |
1030 | + dev->ops->dev_close(dev); | |
1031 | atm_dev_deregister(dev); | |
1032 | } | |
1033 | ||
1034 | - | |
1035 | /* Handler for sk->destruct, invoked by sk_free() */ | |
1036 | static void atm_free_sock(struct sock *sk) | |
1037 | { | |
1038 | kfree(sk->protinfo.af_atm); | |
1039 | } | |
1040 | ||
1041 | struct sock *alloc_atm_vcc_sk(int family) | |
1042 | { | |
1043 | struct sock *sk; | |
1044 | struct atm_vcc *vcc; | |
1045 | ||
1046 | - sk = sk_alloc(family, GFP_KERNEL, 1); | |
1047 | - if (!sk) return NULL; | |
1048 | - vcc = sk->protinfo.af_atm = kmalloc(sizeof(*vcc),GFP_KERNEL); | |
1049 | + sk = sk_alloc(family, GFP_KERNEL, 1); | |
1050 | + if (!sk) | |
1051 | + return NULL; | |
1052 | + vcc = atm_sk(sk) = kmalloc(sizeof(*vcc), GFP_KERNEL); | |
1053 | if (!vcc) { | |
1054 | sk_free(sk); | |
1055 | return NULL; | |
1056 | } | |
1057 | - sock_init_data(NULL,sk); | |
1058 | sk->destruct = atm_free_sock; | |
1059 | - memset(vcc,0,sizeof(*vcc)); | |
1060 | + sock_init_data(NULL, sk); | |
1061 | + memset(vcc, 0, sizeof(*vcc)); | |
1062 | vcc->sk = sk; | |
1063 | - if (nodev_vccs) nodev_vccs->prev = vcc; | |
1064 | + if (nodev_vccs) | |
1065 | + nodev_vccs->prev = vcc; | |
1066 | vcc->prev = NULL; | |
1067 | vcc->next = nodev_vccs; | |
1068 | nodev_vccs = vcc; | |
1069 | @@ -168,11 +185,16 @@ | |
1070 | ||
1071 | static void unlink_vcc(struct atm_vcc *vcc,struct atm_dev *hold_dev) | |
1072 | { | |
1073 | - if (vcc->prev) vcc->prev->next = vcc->next; | |
1074 | - else if (vcc->dev) vcc->dev->vccs = vcc->next; | |
1075 | - else nodev_vccs = vcc->next; | |
1076 | - if (vcc->next) vcc->next->prev = vcc->prev; | |
1077 | - else if (vcc->dev) vcc->dev->last = vcc->prev; | |
1078 | + if (vcc->prev) | |
1079 | + vcc->prev->next = vcc->next; | |
1080 | + else if (vcc->dev) | |
1081 | + vcc->dev->vccs = vcc->next; | |
1082 | + else | |
1083 | + nodev_vccs = vcc->next; | |
1084 | + if (vcc->next) | |
1085 | + vcc->next->prev = vcc->prev; | |
1086 | + else if (vcc->dev) | |
1087 | + vcc->dev->last = vcc->prev; | |
1088 | if (vcc->dev && vcc->dev != hold_dev && !vcc->dev->vccs && | |
1089 | test_bit(ATM_DF_CLOSE,&vcc->dev->flags)) | |
1090 | shutdown_atm_dev(vcc->dev); | |
1091 | @@ -181,11 +203,10 @@ | |
1092 | ||
1093 | void free_atm_vcc_sk(struct sock *sk) | |
1094 | { | |
1095 | - unlink_vcc(sk->protinfo.af_atm,NULL); | |
1096 | + unlink_vcc(atm_sk(sk), NULL); | |
1097 | sk_free(sk); | |
1098 | } | |
1099 | ||
1100 | - | |
1101 | void bind_vcc(struct atm_vcc *vcc,struct atm_dev *dev) | |
1102 | { | |
1103 | unlink_vcc(vcc,dev); | |
1104 | @@ -193,19 +214,20 @@ | |
1105 | if (dev) { | |
1106 | vcc->next = NULL; | |
1107 | vcc->prev = dev->last; | |
1108 | - if (dev->vccs) dev->last->next = vcc; | |
1109 | - else dev->vccs = vcc; | |
1110 | + if (dev->vccs) | |
1111 | + dev->last->next = vcc; | |
1112 | + else | |
1113 | + dev->vccs = vcc; | |
1114 | dev->last = vcc; | |
1115 | - } | |
1116 | - else { | |
1117 | - if (nodev_vccs) nodev_vccs->prev = vcc; | |
1118 | + } else { | |
1119 | + if (nodev_vccs) | |
1120 | + nodev_vccs->prev = vcc; | |
1121 | vcc->next = nodev_vccs; | |
1122 | vcc->prev = NULL; | |
1123 | nodev_vccs = vcc; | |
1124 | } | |
1125 | } | |
1126 | ||
1127 | - | |
1128 | EXPORT_SYMBOL(atm_dev_register); | |
1129 | EXPORT_SYMBOL(atm_dev_deregister); | |
1130 | EXPORT_SYMBOL(atm_find_dev); | |
1131 | diff -urN linux-2.4.20/net/atm/signaling.c linux-2.5.63/net/atm/signaling.c | |
1132 | --- linux-2.4.20/net/atm/signaling.c Thu Jun 28 02:10:55 2001 | |
1133 | +++ linux-2.5.63/net/atm/signaling.c Mon Feb 24 20:05:39 2003 | |
1134 | @@ -239,7 +239,7 @@ | |
1135 | 999, /* dummy device number */ | |
1136 | NULL,NULL, /* pretend not to have any VCCs */ | |
1137 | NULL,NULL, /* no data */ | |
1138 | - { 0 }, /* no flags */ | |
1139 | + 0, /* no flags */ | |
1140 | NULL, /* no local address */ | |
1141 | { 0 } /* no ESI, no statistics */ | |
1142 | }; | |
1143 | diff -urN linux-2.4.20/net/atm/svc.c linux-2.5.63/net/atm/svc.c | |
1144 | --- linux-2.4.20/net/atm/svc.c Thu Apr 12 21:11:39 2001 | |
1145 | +++ linux-2.5.63/net/atm/svc.c Mon Feb 24 20:05:36 2003 | |
1146 | @@ -430,11 +430,8 @@ | |
1147 | ||
1148 | ||
1149 | static struct net_proto_family svc_family_ops = { | |
1150 | - PF_ATMSVC, | |
1151 | - svc_create, | |
1152 | - 0, /* no authentication */ | |
1153 | - 0, /* no encryption */ | |
1154 | - 0 /* no encrypt_net */ | |
1155 | + family: PF_ATMSVC, | |
1156 | + create: svc_create, | |
1157 | }; | |
1158 | ||
1159 |