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
5 #define ATM_PDU_OVHD 0 /* number of bytes to charge against buffer
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))
13 #define __AAL_STAT_ITEMS \
15 #undef __AAL_STAT_ITEMS
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 */
25 #define ATM_ATMOPT_CLP 1 /* set CLP bit */
28 -typedef struct { unsigned long bits; } atm_vcc_flags_t;
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 */
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 */
46 struct atm_dev_addr *next; /* next address */
50 -typedef struct { unsigned int bits; } atm_dev_flags_t;
54 const struct atmdev_ops *ops; /* device operations; NULL if unused */
55 const struct atmphy_ops *phy; /* PHY operations, may be undefined */
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 */
66 #define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb))
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
78 999, /* dummy device number */
79 NULL,NULL, /* pretend not to have any VCCs */
80 NULL,NULL, /* no data */
81 - { 0 }, /* no flags */
83 NULL, /* no local address */
84 { 0 } /* no ESI, no statistics */
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
91 if (sock->type == SOCK_STREAM) return -EINVAL;
92 if (!(sk = alloc_atm_vcc_sk(family))) return -ENOMEM;
93 - vcc = sk->protinfo.af_atm;
95 memset(&vcc->flags,0,sizeof(vcc->flags));
97 vcc->family = sock->ops->family;
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);
108 void atm_release_vcc_sk(struct sock *sk,int free_sk)
110 - struct atm_vcc *vcc;
111 + struct atm_vcc *vcc = atm_sk(sk);
114 - vcc = sk->protinfo.af_atm;
115 clear_bit(ATM_VF_READY,&vcc->flags);
117 if (vcc->dev->ops->close) vcc->dev->ops->close(vcc);
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,
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 @@
139 case SIOCGSTAMP: /* borrowed from IP */
140 - if (!vcc->timestamp.tv_sec) {
141 + if (!vcc->sk->stamp.tv_sec) {
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;
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
158 #include <linux/proc_fs.h>
159 +#include <linux/spinlock.h>
161 /* TokenRing if needed */
164 #include <linux/if_bridge.h>
165 #include "../bridge/br_private.h"
166 static unsigned char bridge_ula_lec[] = {0x01, 0x80, 0xc2, 0x00, 0x00};
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);
175 #define DPRINTK(format,args...)
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);
182 +static spinlock_t lec_arp_spinlock = SPIN_LOCK_UNLOCKED;
184 #define DUMP_PACKETS 0 /* 0 = None,
190 +static __inline__ void
191 +lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
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);
202 + priv->stats.tx_dropped++;
203 + dev_kfree_skb(skb);
208 lec_send_packet(struct sk_buff *skb, struct net_device *dev)
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);
225 - priv->stats.tx_dropped++;
226 - dev_kfree_skb(skb2);
228 + lec_send(send_vcc, skb2, priv);
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);
240 - priv->stats.tx_dropped++;
241 - dev_kfree_skb(skb);
243 + lec_send(send_vcc, skb, priv);
246 /* Should we wait for card's device driver to notify us? */
248 999, /*dummy device number*/
249 NULL,NULL, /*no VCCs*/
250 NULL,NULL, /*no data*/
251 - { 0 }, /*no flags*/
253 NULL, /* no local address*/
254 { 0 } /*no ESI or rest of the atm_dev struct things*/
256 @@ -1044,15 +1039,15 @@
257 #define HASH(ch) (ch & (LEC_ARP_TABLE_SIZE -1))
259 static __inline__ void
260 -lec_arp_lock(struct lec_priv *priv)
261 +lec_arp_get(struct lec_priv *priv)
263 - atomic_inc(&priv->lec_arp_lock_var);
264 + atomic_inc(&priv->lec_arp_users);
267 static __inline__ void
268 -lec_arp_unlock(struct lec_priv *priv)
269 +lec_arp_put(struct lec_priv *priv)
271 - atomic_dec(&priv->lec_arp_lock_var);
272 + atomic_dec(&priv->lec_arp_users);
276 @@ -1103,33 +1098,33 @@
277 * LANE2: Add to the end of the list to satisfy 8.1.13
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)
285 - unsigned short place;
287 + unsigned short place;
288 struct lec_arp_table *tmp;
292 + spin_lock_irqsave(&lec_arp_spinlock, flags);
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;
300 - lec_arp_tables[place] = to_put;
301 + lec_arp_tables[place] = to_add;
303 else { /* add to the end */
306 - tmp->next = to_put;
307 + tmp->next = to_add;
310 - restore_flags(flags);
311 + spin_unlock_irqrestore(&lec_arp_spinlock, flags);
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]);
323 @@ -1139,16 +1134,15 @@
324 lec_arp_remove(struct lec_arp_table **lec_arp_tables,
325 struct lec_arp_table *to_remove)
327 + unsigned long flags;
328 unsigned short place;
329 struct lec_arp_table *tmp;
330 - unsigned long flags;
335 + spin_lock_irqsave(&lec_arp_spinlock, flags);
338 - restore_flags(flags);
339 + spin_unlock_irqrestore(&lec_arp_spinlock, flags);
342 place = HASH(to_remove->mac_addr[ETH_ALEN-1]);
343 @@ -1160,7 +1154,7 @@
346 if (!tmp) {/* Entry was not found */
347 - restore_flags(flags);
348 + spin_unlock_irqrestore(&lec_arp_spinlock, flags);
352 @@ -1186,7 +1180,9 @@
353 lec_arp_clear_vccs(to_remove);
355 skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */
356 - restore_flags(flags);
358 + spin_unlock_irqrestore(&lec_arp_spinlock, flags);
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)
366 struct lec_arp_table *entry, *next;
367 - unsigned long flags;
373 del_timer(&priv->lec_arp_timer);
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);
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);
390 place = HASH(mac_addr[ETH_ALEN-1]);
392 to_return = priv->lec_arp_tables[place];
394 if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0) {
395 - lec_arp_unlock(priv);
399 to_return = to_return->next;
401 - lec_arp_unlock(priv);
406 @@ -1574,11 +1565,11 @@
407 del_timer(&priv->lec_arp_timer);
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)) {
419 for(i=0;i<LEC_ARP_TABLE_SIZE;i++) {
420 for(entry = lec_arp_tables[i];entry != NULL;) {
421 @@ -1616,6 +1607,10 @@
423 time_after_eq(now, entry->timestamp+
424 priv->path_switching_delay)) {
425 + struct sk_buff *skb;
427 + while ((skb = skb_dequeue(&entry->tx_wait)))
428 + lec_send(entry->vcc, skb, entry->priv);
429 entry->last_used = jiffies;
432 @@ -1624,7 +1619,7 @@
436 - lec_arp_unlock(priv);
439 priv->lec_arp_timer.expires = jiffies + LEC_ARP_REFRESH_INTERVAL;
440 add_timer(&priv->lec_arp_timer);
441 @@ -1686,7 +1681,7 @@
443 return priv->mcast_vcc;
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;
454 - lec_arp_lock(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);
463 - lec_arp_unlock(priv);
468 - lec_arp_unlock(priv);
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
477 - lec_arp_lock(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);
490 entry->flags|=LEC_REMOTE_FLAG;
492 entry->flags&=~LEC_REMOTE_FLAG;
493 - lec_arp_unlock(priv);
495 DPRINTK("After update\n");
496 dump_arp_table(priv);
498 @@ -1801,11 +1796,11 @@
500 entry = make_entry(priv, mac_addr);
502 - lec_arp_unlock(priv);
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 */
511 memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN);
512 @@ -1840,7 +1835,7 @@
514 DPRINTK("After update2\n");
515 dump_arp_table(priv);
516 - lec_arp_unlock(priv);
521 @@ -1854,7 +1849,7 @@
522 struct lec_arp_table *entry;
523 int i, found_entry=0;
525 - lec_arp_lock(priv);
527 if (ioc_data->receive == 2) {
528 /* Vcc for Multicast Forward. No timer, LANEv2 7.1.20 and 2.3.5.3 */
530 @@ -1863,7 +1858,7 @@
531 entry = lec_arp_find(priv, bus_mac);
533 printk("LEC_ARP: Multicast entry not found!\n");
534 - lec_arp_unlock(priv);
538 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN);
539 @@ -1872,7 +1867,7 @@
541 entry = make_entry(priv, bus_mac);
543 - lec_arp_unlock(priv);
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);
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);
561 - lec_arp_unlock(priv);
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);
572 dump_arp_table(priv);
575 @@ -1971,7 +1966,7 @@
579 - lec_arp_unlock(priv);
581 DPRINTK("After vcc was added\n");
582 dump_arp_table(priv);
584 @@ -1980,7 +1975,7 @@
586 entry = make_entry(priv, bus_mac);
588 - lec_arp_unlock(priv);
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);
599 DPRINTK("After vcc was added\n");
600 dump_arp_table(priv);
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;
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");
613 @@ -2039,10 +2038,10 @@
614 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
615 struct lec_arp_table *to_add;
617 - lec_arp_lock(priv);
619 to_add = make_entry(priv, mac_addr);
621 - lec_arp_unlock(priv);
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);
637 @@ -2065,7 +2064,7 @@
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);
643 for(i=0;i<LEC_ARP_TABLE_SIZE;i++) {
644 for(entry = priv->lec_arp_tables[i];entry; entry=next) {
646 @@ -2127,7 +2126,7 @@
650 - lec_arp_unlock(priv);
652 dump_arp_table(priv);
655 @@ -2135,9 +2134,9 @@
656 lec_arp_check_empties(struct lec_priv *priv,
657 struct atm_vcc *vcc, struct sk_buff *skb)
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;
665 struct lecdatahdr_8025 *tr_hdr = (struct lecdatahdr_8025 *)skb->data;
666 @@ -2147,26 +2146,26 @@
670 - lec_arp_lock(priv);
672 entry = priv->lec_arp_empty_ones;
673 if (vcc == entry->vcc) {
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);
689 - lec_arp_put(priv->lec_arp_tables, entry);
690 - lec_arp_unlock(priv);
691 + lec_arp_add(priv->lec_arp_tables, entry);
695 + spin_lock_irqsave(&lec_arp_spinlock, flags);
698 while (entry && entry->vcc != vcc) {
699 @@ -2175,22 +2174,21 @@
702 DPRINTK("LEC_ARP: Arp_check_empties: entry not found!\n");
703 - lec_arp_unlock(priv);
705 + spin_unlock_irqrestore(&lec_arp_spinlock, flags);
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);
721 - lec_arp_put(priv->lec_arp_tables,entry);
722 - lec_arp_unlock(priv);
723 + lec_arp_add(priv->lec_arp_tables,entry);
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
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
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() */
750 #include <linux/proc_fs.h>
751 @@ -741,18 +741,10 @@
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 */
766 - /* rest of the members will be 0 */
770 + /* members not explicitely initialised will be 0 */
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;
779 - printk("mpc.c: module in use\n");
782 #ifdef CONFIG_PROC_FS
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
789 unsigned char ip_string[16];
792 - page = get_free_page(GFP_KERNEL);
793 + page = get_zeroed_page(GFP_KERNEL);
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
802 here += sprintf(here,"%3d",vcc->family);
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,
807 atomic_read(&vcc->tx_inuse),vcc->sk->sndbuf,
808 atomic_read(&vcc->rx_inuse),vcc->sk->rcvbuf);
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)
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;
828 for (num = dev->number; num; num /= 10) digits++;
829 if (!digits) digits++;
831 - dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_ATOMIC);
832 + dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_KERNEL);
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
842 static struct net_proto_family pvc_family_ops = {
845 - 0, /* no authentication */
846 - 0, /* no encryption */
847 - 0 /* no encrypt_net */
849 + create: pvc_create,
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
858 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
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 */
866 #include <linux/config.h>
867 #include <linux/ctype.h>
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 */
875 #include "resources.h"
877 struct atm_vcc *nodev_vccs = NULL;
878 extern spinlock_t atm_dev_lock;
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)
887 dev = kmalloc(sizeof(*dev), GFP_ATOMIC);
888 - if (!dev) return NULL;
889 - memset(dev,0,sizeof(*dev));
892 + memset(dev, 0, sizeof(*dev));
894 dev->signal = ATM_PHY_SIG_UNKNOWN;
895 dev->link_rate = ATM_OC3_PCR;
898 dev->prev = last_dev;
900 - if (atm_devs) last_dev->next = dev;
901 - else atm_devs = dev;
903 + last_dev->next = dev;
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)
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;
921 + dev->prev->next = dev->next;
923 + atm_devs = dev->next;
925 + dev->next->prev = dev->prev;
927 + last_dev = dev->prev;
931 +/* Caller must hold atm_dev_lock. */
932 struct atm_dev *atm_find_dev(int number)
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)
943 -struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
944 - int number,atm_dev_flags_t *flags)
946 +struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
947 + int number, unsigned long *flags)
949 - struct atm_dev *dev = NULL;
950 + struct atm_dev *dev;
952 spin_lock(&atm_dev_lock);
954 - dev = alloc_atm_dev(type);
955 + dev = __alloc_atm_dev(type);
957 printk(KERN_ERR "atm_dev_register: no space for dev %s\n",
962 if (atm_find_dev(number)) {
965 + __free_atm_dev(dev);
969 dev->number = number;
972 - while (atm_find_dev(dev->number)) dev->number++;
973 + while (atm_find_dev(dev->number))
976 dev->vccs = dev->last = NULL;
977 dev->dev_data = NULL;
984 - memset(&dev->flags,0,sizeof(dev->flags));
985 - memset((void *) &dev->stats,0,sizeof(dev->stats));
987 + memset(&dev->flags, 0, sizeof(dev->flags));
988 + memset(&dev->stats, 0, sizeof(dev->stats));
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);
997 + "atm_proc_dev_register failed for dev %s\n",
999 + __free_atm_dev(dev);
1007 @@ -118,47 +139,50 @@
1008 void atm_dev_deregister(struct atm_dev *dev)
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);
1015 spin_lock(&atm_dev_lock);
1016 - free_atm_dev(dev);
1017 + __free_atm_dev(dev);
1018 spin_unlock(&atm_dev_lock);
1021 void shutdown_atm_dev(struct atm_dev *dev)
1024 - set_bit(ATM_DF_CLOSE,&dev->flags);
1025 + set_bit(ATM_DF_CLOSE, &dev->flags);
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);
1035 /* Handler for sk->destruct, invoked by sk_free() */
1036 static void atm_free_sock(struct sock *sk)
1038 kfree(sk->protinfo.af_atm);
1041 struct sock *alloc_atm_vcc_sk(int family)
1044 struct atm_vcc *vcc;
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);
1052 + vcc = atm_sk(sk) = kmalloc(sizeof(*vcc), GFP_KERNEL);
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));
1063 - if (nodev_vccs) nodev_vccs->prev = vcc;
1065 + nodev_vccs->prev = vcc;
1067 vcc->next = nodev_vccs;
1069 @@ -168,11 +185,16 @@
1071 static void unlink_vcc(struct atm_vcc *vcc,struct atm_dev *hold_dev)
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;
1079 + vcc->prev->next = vcc->next;
1080 + else if (vcc->dev)
1081 + vcc->dev->vccs = vcc->next;
1083 + nodev_vccs = 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 @@
1093 void free_atm_vcc_sk(struct sock *sk)
1095 - unlink_vcc(sk->protinfo.af_atm,NULL);
1096 + unlink_vcc(atm_sk(sk), NULL);
1101 void bind_vcc(struct atm_vcc *vcc,struct atm_dev *dev)
1103 unlink_vcc(vcc,dev);
1104 @@ -193,19 +214,20 @@
1107 vcc->prev = dev->last;
1108 - if (dev->vccs) dev->last->next = vcc;
1109 - else dev->vccs = vcc;
1111 + dev->last->next = vcc;
1117 - if (nodev_vccs) nodev_vccs->prev = vcc;
1120 + nodev_vccs->prev = vcc;
1121 vcc->next = nodev_vccs;
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
1135 999, /* dummy device number */
1136 NULL,NULL, /* pretend not to have any VCCs */
1137 NULL,NULL, /* no data */
1138 - { 0 }, /* no flags */
1140 NULL, /* no local address */
1141 { 0 } /* no ESI, no statistics */
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 @@
1149 static struct net_proto_family svc_family_ops = {
1152 - 0, /* no authentication */
1153 - 0, /* no encryption */
1154 - 0 /* no encrypt_net */
1155 + family: PF_ATMSVC,
1156 + create: svc_create,