1 the following patch makes atm a module. this patch also fixes a
2 number of other problems: MOD_INC/MOD_DEC are gone in lec and mpc
3 (however i needed to use module_put() inside lec, mpc and clip due to
4 the way the user space 'clients' unregister from the modules), clip
5 is a module (i wrote the clip module_exit() function -- its *probably*
6 correct), structs are now exported as pointers (if someone has a
7 compelling reason it should remain the old way let me know), ipcommon.c
8 is included by clip.c and doesnt export symbols -- it should probably
9 just be split eventually with only llc_oui residing in the kernel
10 (and exported) and skb_migrate moved to clip -- this really depends
11 on the status of CONFIG_NET_SCH_ATM.
13 Index: linux/net/atm/clip.c
14 ===================================================================
15 RCS file: /home/chas/CVSROOT/linux/net/atm/clip.c,v
16 retrieving revision 1.1.1.1
17 diff -u -r1.1.1.1 clip.c
18 --- linux/net/atm/clip.c 20 Feb 2003 13:46:30 -0000 1.1.1.1
19 +++ linux/net/atm/clip.c 3 Mar 2003 19:33:38 -0000
21 #include <linux/string.h>
22 #include <linux/errno.h>
23 #include <linux/kernel.h> /* for UINT_MAX */
24 +#include <linux/module.h>
25 #include <linux/netdevice.h>
26 #include <linux/skbuff.h>
27 #include <linux/wait.h>
29 static struct timer_list idle_timer;
30 static int start_timer = 1;
32 +#include "ipcommon.c"
34 static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
38 skb_queue_purge(&vcc->recvq);
48 +static struct atm_clip_ops __atm_clip_ops = {
49 + clip_create: clip_create,
50 + clip_mkip: clip_mkip,
51 + clip_setentry: clip_setentry,
52 + clip_encap: clip_encap,
53 + clip_push: clip_push,
54 + atm_init_atmarp: atm_init_atmarp,
55 + clip_tbl: &clip_tbl,
59 -void atm_clip_init(void)
60 +static int __init atm_clip_init(void)
62 + extern struct atm_clip_ops *atm_clip_ops;
64 clip_tbl.lock = RW_LOCK_UNLOCKED;
65 clip_tbl.kmem_cachep = kmem_cache_create(clip_tbl.id,
66 clip_tbl.entry_size, 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
68 + atm_clip_ops = &__atm_clip_ops;
73 +static void __exit atm_clip_exit(void)
75 + extern struct atm_clip_ops *atm_clip_ops;
76 + struct net_device *dev, *next;
78 + atm_clip_ops = NULL;
83 + next = PRIV(dev)->next;
84 + unregister_netdev(dev);
87 + if (start_timer == 0) del_timer(&idle_timer);
89 + kmem_cache_destroy(clip_tbl.kmem_cachep);
92 +module_init(atm_clip_init);
93 +module_exit(atm_clip_exit);
95 +MODULE_LICENSE("GPL");
96 Index: linux/net/atm/common.c
97 ===================================================================
98 RCS file: /home/chas/CVSROOT/linux/net/atm/common.c,v
99 retrieving revision 1.5
100 diff -u -r1.5 common.c
101 --- linux/net/atm/common.c 26 Feb 2003 15:52:44 -0000 1.5
102 +++ linux/net/atm/common.c 3 Mar 2003 19:41:21 -0000
105 #include <linux/config.h>
106 #include <linux/module.h>
107 +#include <linux/init.h>
108 #include <linux/kmod.h>
109 #include <linux/net.h> /* struct socket, struct net_proto, struct
112 #include <linux/atmlec.h>
114 #include "lec_arpc.h"
115 -struct atm_lane_ops atm_lane_ops;
117 +struct atm_lane_ops *atm_lane_ops = NULL;
118 #ifdef CONFIG_ATM_LANE_MODULE
119 EXPORT_SYMBOL(atm_lane_ops);
123 #if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
124 #include <linux/atmmpc.h>
126 -struct atm_mpoa_ops atm_mpoa_ops;
127 +struct atm_mpoa_ops *atm_mpoa_ops = NULL;
129 #ifdef CONFIG_ATM_MPOA_MODULE
130 EXPORT_SYMBOL(atm_mpoa_ops);
135 +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
136 +#include <net/atmclip.h>
137 +struct atm_clip_ops *atm_clip_ops = NULL;
138 +#ifdef CONFIG_ATM_CLIP_MODULE
139 +EXPORT_SYMBOL(atm_clip_ops);
143 #if defined(CONFIG_PPPOATM) || defined(CONFIG_PPPOATM_MODULE)
144 int (*pppoatm_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
145 EXPORT_SYMBOL(pppoatm_ioctl_hook);
147 #include "common.h" /* prototypes */
148 #include "protocols.h" /* atm_init_<transport> */
149 #include "addr.h" /* address registry */
150 -#ifdef CONFIG_ATM_CLIP
151 -#include <net/atmclip.h> /* for clip_create */
153 #include "signaling.h" /* for WAITING and sigd_attach */
156 @@ -642,39 +647,50 @@
157 if (!error) sock->state = SS_CONNECTED;
160 -#ifdef CONFIG_ATM_CLIP
161 +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
163 if (!capable(CAP_NET_ADMIN))
166 - ret_val = clip_create(arg);
167 + ret_val = atm_clip_ops->clip_create(arg);
170 if (!capable(CAP_NET_ADMIN)) {
174 - error = atm_init_atmarp(vcc);
175 - if (!error) sock->state = SS_CONNECTED;
176 +#if defined(CONFIG_ATM_CLIP_MODULE)
177 + if (atm_clip_ops == NULL)
178 + request_module("clip");
180 + if (atm_clip_ops && !try_inc_mod_count(atm_clip_ops->owner)) {
184 + error = atm_clip_ops->atm_init_atmarp(vcc);
186 + sock->state = SS_CONNECTED;
187 + else if (atm_clip_ops->owner)
188 + __MOD_DEC_USE_COUNT(atm_clip_ops->owner);
192 if (!capable(CAP_NET_ADMIN))
195 - ret_val = clip_mkip(vcc,arg);
196 + ret_val = atm_clip_ops->clip_mkip(vcc,arg);
198 case ATMARP_SETENTRY:
199 if (!capable(CAP_NET_ADMIN))
202 - ret_val = clip_setentry(vcc,arg);
203 + ret_val = atm_clip_ops->clip_setentry(vcc,arg);
206 if (!capable(CAP_NET_ADMIN))
209 - ret_val = clip_encap(vcc,arg);
210 + ret_val = atm_clip_ops->clip_encap(vcc,arg);
213 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
214 @@ -683,30 +699,32 @@
218 - if (atm_lane_ops.lecd_attach == NULL)
220 - if (!try_module_get(atm_lane_ops.owner)) { /* try again */
221 +#if defined(CONFIG_ATM_LANE_MODULE)
222 + if (atm_lane_ops == NULL)
223 + request_module("lec");
225 + if (atm_lane_ops && !try_inc_mod_count(atm_lane_ops->owner)) {
229 - error = atm_lane_ops.lecd_attach(vcc, (int)arg);
230 + error = atm_lane_ops->lecd_attach(vcc, (int)arg);
232 sock->state = SS_CONNECTED;
234 - module_put(atm_lane_ops.owner);
235 + else if (atm_lane_ops->owner)
236 + __MOD_DEC_USE_COUNT(atm_lane_ops->owner);
240 if (!capable(CAP_NET_ADMIN))
243 - ret_val = atm_lane_ops.mcast_attach(vcc, (int)arg);
244 + ret_val = atm_lane_ops->mcast_attach(vcc, (int)arg);
247 if (!capable(CAP_NET_ADMIN))
250 - ret_val = atm_lane_ops.vcc_attach(vcc, (void*)arg);
251 + ret_val = atm_lane_ops->vcc_attach(vcc, (void*)arg);
254 #if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
255 @@ -715,21 +733,26 @@
259 - if (atm_mpoa_ops.mpoad_attach == NULL)
261 - if (atm_mpoa_ops.mpoad_attach == NULL) { /* try again */
262 +#if defined(CONFIG_ATM_MPOA_MODULE)
263 + if (atm_mpoa_ops == NULL)
264 + request_module("mpoa");
266 + if (atm_mpoa_ops && !try_inc_mod_count(atm_mpoa_ops->owner)) {
270 - error = atm_mpoa_ops.mpoad_attach(vcc, (int)arg);
271 - if (error >= 0) sock->state = SS_CONNECTED;
272 + error = atm_mpoa_ops->mpoad_attach(vcc, (int)arg);
274 + sock->state = SS_CONNECTED;
275 + else if (atm_mpoa_ops->owner)
276 + __MOD_DEC_USE_COUNT(atm_mpoa_ops->owner);
280 if (!capable(CAP_NET_ADMIN))
283 - ret_val = atm_mpoa_ops.vcc_attach(vcc, arg);
284 + ret_val = atm_mpoa_ops->vcc_attach(vcc, arg);
287 #if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
288 @@ -1105,40 +1128,6 @@
293 - * lane_mpoa_init.c: A couple of helper functions
294 - * to make modular LANE and MPOA client easier to implement
298 - * This is how it goes:
300 - * if xxxx is not compiled as module, call atm_xxxx_init_ops()
302 - * else call atm_mpoa_init_ops() from init_module() within
303 - * the kernel when xxxx module is loaded
305 - * In either case function pointers in struct atm_xxxx_ops
306 - * are initialized to their correct values. Either they
307 - * point to functions in the module or in the kernel
310 -extern struct atm_mpoa_ops atm_mpoa_ops; /* in common.c */
311 -extern struct atm_lane_ops atm_lane_ops; /* in common.c */
313 -#if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
314 -void atm_mpoa_init(void)
316 -#ifndef CONFIG_ATM_MPOA_MODULE /* not module */
317 - atm_mpoa_init_ops(&atm_mpoa_ops);
319 - request_module("mpoa");
326 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
327 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
328 struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
329 @@ -1149,15 +1138,33 @@
330 EXPORT_SYMBOL(br_fdb_put_hook);
331 #endif /* defined(CONFIG_ATM_LANE_MODULE) || defined(CONFIG_BRIDGE_MODULE) */
332 #endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
333 +#endif /* defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) */
336 -void atm_lane_init(void)
337 +static int __init atm_init(void)
339 -#ifndef CONFIG_ATM_LANE_MODULE /* not module */
340 - atm_lane_init_ops(&atm_lane_ops);
342 - request_module("lec");
345 + if (atmpvc_init() < 0)
347 + if (atmsvc_init() < 0)
349 +#ifdef CONFIG_PROC_FS
350 + error = atm_proc_init();
351 + if (error) printk("atm_proc_init fails with %d\n",error);
358 +static void __exit atm_exit(void)
360 +#ifdef CONFIG_PROC_FS
367 +module_init(atm_init);
368 +module_exit(atm_exit);
369 +MODULE_LICENSE("GPL");
370 Index: linux/net/atm/common.h
371 ===================================================================
372 RCS file: /home/chas/CVSROOT/linux/net/atm/common.h,v
373 retrieving revision 1.1.1.1
374 diff -u -r1.1.1.1 common.h
375 --- linux/net/atm/common.h 20 Feb 2003 13:46:30 -0000 1.1.1.1
376 +++ linux/net/atm/common.h 27 Feb 2003 16:47:15 -0000
378 void atm_release_vcc_sk(struct sock *sk,int free_sk);
379 void atm_shutdown_dev(struct atm_dev *dev);
381 +int atmsvc_init(void);
382 +void atmsvc_exit(void);
384 +int atmpvc_init(void);
385 +void atmpvc_exit(void);
387 int atm_proc_init(void);
388 +void atm_proc_exit(void);
392 Index: linux/net/atm/ipcommon.c
393 ===================================================================
394 RCS file: /home/chas/CVSROOT/linux/net/atm/ipcommon.c,v
395 retrieving revision 1.1.1.1
396 diff -u -r1.1.1.1 ipcommon.c
397 --- linux/net/atm/ipcommon.c 20 Feb 2003 13:46:30 -0000 1.1.1.1
398 +++ linux/net/atm/ipcommon.c 3 Mar 2003 16:51:32 -0000
401 spin_unlock_irqrestore(&from->lock,flags);
405 -EXPORT_SYMBOL(skb_migrate);
406 Index: linux/net/atm/ipcommon.h
407 ===================================================================
408 RCS file: /home/chas/CVSROOT/linux/net/atm/ipcommon.h,v
409 retrieving revision 1.1.1.1
410 diff -u -r1.1.1.1 ipcommon.h
411 --- linux/net/atm/ipcommon.h 20 Feb 2003 13:46:30 -0000 1.1.1.1
412 +++ linux/net/atm/ipcommon.h 3 Mar 2003 16:52:24 -0000
414 #include <linux/atmdev.h>
417 -extern struct net_device *clip_devs;
420 * Appends all skbs from "from" to "to". The operation is atomic with respect
421 * to all other skb operations on "from" or "to".
422 Index: linux/net/atm/lec.c
423 ===================================================================
424 RCS file: /home/chas/CVSROOT/linux/net/atm/lec.c,v
425 retrieving revision 1.11
427 --- linux/net/atm/lec.c 3 Mar 2003 21:25:05 -0000 1.11
428 +++ linux/net/atm/lec.c 3 Mar 2003 21:27:05 -0000
430 dev_lec[i] = init_etherdev(NULL, size);
434 priv = dev_lec[i]->priv;
435 priv->is_trdev = is_trdev;
436 sprintf(dev_lec[i]->name, "lec%d", i);
437 @@ -828,24 +827,20 @@
441 -void atm_lane_init_ops(struct atm_lane_ops *ops)
443 - ops->lecd_attach = lecd_attach;
444 - ops->mcast_attach = lec_mcast_attach;
445 - ops->vcc_attach = lec_vcc_attach;
446 - ops->get_lecs = get_dev_lec;
447 - ops->owner = lecdev_ops.owner;
449 - printk("lec.c: " __DATE__ " " __TIME__ " initialized\n");
453 +static struct atm_lane_ops __atm_lane_ops = {
454 + lecd_attach: lecd_attach,
455 + mcast_attach: lec_mcast_attach,
456 + vcc_attach: lec_vcc_attach,
457 + get_lecs: get_dev_lec,
461 static int __init lane_module_init(void)
463 - extern struct atm_lane_ops atm_lane_ops;
464 + extern struct atm_lane_ops *atm_lane_ops;
466 - atm_lane_init_ops(&atm_lane_ops);
467 + atm_lane_ops = &__atm_lane_ops;
468 + printk("lec.c: " __DATE__ " " __TIME__ " initialized\n");
472 @@ -852,14 +847,10 @@
473 static void __exit lane_module_cleanup(void)
476 - extern struct atm_lane_ops atm_lane_ops;
477 + extern struct atm_lane_ops *atm_lane_ops;
478 struct lec_priv *priv;
480 - atm_lane_ops.lecd_attach = NULL;
481 - atm_lane_ops.mcast_attach = NULL;
482 - atm_lane_ops.vcc_attach = NULL;
483 - atm_lane_ops.get_lecs = NULL;
484 - atm_lane_ops.owner = NULL;
485 + atm_lane_ops = NULL;
487 for (i = 0; i < MAX_LEC_ITF; i++) {
488 if (dev_lec[i] != NULL) {
490 unregister_netdev(dev_lec[i]);
498 @@ -1021,7 +1013,7 @@
499 #include <linux/timer.h>
500 #include <asm/param.h>
501 #include <asm/atomic.h>
502 -#include <linux/inetdevice.h>
503 +#include <linux/netdevice.h>
504 #include <net/route.h>
507 Index: linux/net/atm/lec.h
508 ===================================================================
509 RCS file: /home/chas/CVSROOT/linux/net/atm/lec.h,v
510 retrieving revision 1.5
512 --- linux/net/atm/lec.h 3 Mar 2003 21:25:05 -0000 1.5
513 +++ linux/net/atm/lec.h 3 Mar 2003 21:25:17 -0000
515 unsigned char *atm_addr, struct sk_buff *data);
516 void lec_push(struct atm_vcc *vcc, struct sk_buff *skb);
518 -void atm_lane_init(void);
519 -void atm_lane_init_ops(struct atm_lane_ops *ops);
522 Index: linux/net/atm/mpc.c
523 ===================================================================
524 RCS file: /home/chas/CVSROOT/linux/net/atm/mpc.c,v
525 retrieving revision 1.3
527 --- linux/net/atm/mpc.c 3 Mar 2003 21:25:05 -0000 1.3
528 +++ linux/net/atm/mpc.c 3 Mar 2003 21:25:19 -0000
530 send_set_mps_ctrl_addr(mpc->mps_ctrl_addr, mpc);
537 @@ -1390,11 +1389,17 @@
541 -void atm_mpoa_init_ops(struct atm_mpoa_ops *ops)
542 +struct atm_mpoa_ops __atm_mpoa_ops = {
543 + mpoad_attach: atm_mpoa_mpoad_attach,
544 + vcc_attach: atm_mpoa_vcc_attach,
548 +static int __init atm_mpoa_init(void)
550 - ops->mpoad_attach = atm_mpoa_mpoad_attach;
551 - ops->vcc_attach = atm_mpoa_vcc_attach;
552 + extern struct atm_mpoa_ops *atm_mpoa_ops;
554 + atm_mpoa_ops = &__atm_mpoa_ops;
555 #ifdef CONFIG_PROC_FS
556 if(mpc_proc_init() != 0)
557 printk(KERN_INFO "mpoa: failed to initialize /proc/mpoa\n");
558 @@ -1404,22 +1409,12 @@
560 printk("mpc.c: " __DATE__ " " __TIME__ " initialized\n");
566 -int init_module(void)
568 - extern struct atm_mpoa_ops atm_mpoa_ops;
570 - atm_mpoa_init_ops(&atm_mpoa_ops);
575 -void cleanup_module(void)
576 +static void __exit atm_mpoa_cleanup(void)
578 - extern struct atm_mpoa_ops atm_mpoa_ops;
579 + extern struct atm_mpoa_ops *atm_mpoa_ops;
580 struct mpoa_client *mpc, *tmp;
581 struct atm_mpoa_qos *qos, *nextqos;
582 struct lec_priv *priv;
583 @@ -1430,8 +1425,7 @@
585 del_timer(&mpc_timer);
586 unregister_netdevice_notifier(&mpoa_notifier);
587 - atm_mpoa_ops.mpoad_attach = NULL;
588 - atm_mpoa_ops.vcc_attach = NULL;
589 + atm_mpoa_ops = NULL;
593 @@ -1463,8 +1457,9 @@
602 +module_init(atm_mpoa_init);
603 +module_exit(atm_mpoa_cleanup);
605 MODULE_LICENSE("GPL");
606 Index: linux/net/atm/mpc.h
607 ===================================================================
608 RCS file: /home/chas/CVSROOT/linux/net/atm/mpc.h,v
609 retrieving revision 1.1.1.1
610 diff -u -r1.1.1.1 mpc.h
611 --- linux/net/atm/mpc.h 20 Feb 2003 13:46:30 -0000 1.1.1.1
612 +++ linux/net/atm/mpc.h 1 Mar 2003 13:37:05 -0000
614 struct atm_mpoa_ops {
615 int (*mpoad_attach)(struct atm_vcc *vcc, int arg); /* attach mpoa daemon */
616 int (*vcc_attach)(struct atm_vcc *vcc, long arg); /* attach shortcut vcc */
617 + struct module *owner;
620 -/* Boot/module initialization function */
621 -void atm_mpoa_init(void);
622 -void atm_mpoa_init_ops(struct atm_mpoa_ops *ops);
624 /* MPOA QoS operations */
625 struct atm_mpoa_qos *atm_mpoa_add_qos(uint32_t dst_ip, struct atm_qos *qos);
626 Index: linux/net/atm/proc.c
627 ===================================================================
628 RCS file: /home/chas/CVSROOT/linux/net/atm/proc.c,v
629 retrieving revision 1.2
631 --- linux/net/atm/proc.c 26 Feb 2003 15:52:44 -0000 1.2
632 +++ linux/net/atm/proc.c 1 Mar 2003 14:39:12 -0000
634 #include "common.h" /* atm_proc_init prototype */
635 #include "signaling.h" /* to get sigd - ugly too */
637 -#ifdef CONFIG_ATM_CLIP
638 +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
639 #include <net/atmclip.h>
640 -#include "ipcommon.h"
641 -extern void clip_push(struct atm_vcc *vcc,struct sk_buff *skb);
642 +extern struct atm_clip_ops *atm_clip_ops; /* in common.c */
645 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
647 #include "lec_arpc.h"
648 -extern struct atm_lane_ops atm_lane_ops; /* in common.c */
649 +extern struct atm_lane_ops *atm_lane_ops; /* in common.c */
652 static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count,
657 -#ifdef CONFIG_ATM_CLIP
658 +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
661 static int svc_addr(char *buf,struct sockaddr_atmsvc *addr)
663 aal_name[vcc->qos.aal],vcc->qos.rxtp.min_pcr,
664 class_name[vcc->qos.rxtp.traffic_class],vcc->qos.txtp.min_pcr,
665 class_name[vcc->qos.txtp.traffic_class]);
666 -#ifdef CONFIG_ATM_CLIP
667 - if (vcc->push == clip_push) {
668 +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
669 + if (atm_clip_ops && (vcc->push == atm_clip_ops->clip_push)) {
670 struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
671 struct net_device *dev;
677 -#ifdef CONFIG_ATM_CLIP
678 +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
679 static int atm_arp_info(loff_t pos,char *buf)
682 @@ -403,28 +402,30 @@
683 return sprintf(buf,"IPitf TypeEncp Idle IP address "
689 - read_lock_bh(&clip_tbl.lock);
690 + read_lock_bh(&atm_clip_ops->clip_tbl->lock);
691 for (i = 0; i <= NEIGH_HASHMASK; i++)
692 - for (n = clip_tbl.hash_buckets[i]; n; n = n->next) {
693 + for (n = atm_clip_ops->clip_tbl->hash_buckets[i]; n; n = n->next) {
694 struct atmarp_entry *entry = NEIGH2ENTRY(n);
695 struct clip_vcc *vcc;
698 if (--count) continue;
699 atmarp_info(n->dev,entry,NULL,buf);
700 - read_unlock_bh(&clip_tbl.lock);
701 + read_unlock_bh(&atm_clip_ops->clip_tbl->lock);
704 for (vcc = entry->vccs; vcc;
706 if (--count) continue;
707 atmarp_info(n->dev,entry,vcc,buf);
708 - read_unlock_bh(&clip_tbl.lock);
709 + read_unlock_bh(&atm_clip_ops->clip_tbl->lock);
713 - read_unlock_bh(&clip_tbl.lock);
714 + read_unlock_bh(&atm_clip_ops->clip_tbl->lock);
718 @@ -442,13 +443,13 @@
720 "VPI/VCI Recv VPI/VCI\n");
722 - if (atm_lane_ops.get_lecs == NULL)
724 return 0; /* the lane module is not there yet */
726 - if (!try_module_get(atm_lane_ops.owner))
727 + if (!try_inc_mod_count(atm_lane_ops->owner))
730 - dev_lec = atm_lane_ops.get_lecs();
731 + dev_lec = atm_lane_ops->get_lecs();
734 for(d=0;d<MAX_LEC_ITF;d++) {
738 lec_info(entry,buf+e);
739 - module_put(atm_lane_ops.owner);
740 + if (atm_lane_ops->owner)
741 + __MOD_DEC_USE_COUNT(atm_lane_ops->owner);
746 if (--count) continue;
747 e=sprintf(buf,"%s ",dev_lec[d]->name);
748 lec_info(entry, buf+e);
749 - module_put(atm_lane_ops.owner);
750 + if (atm_lane_ops->owner)
751 + __MOD_DEC_USE_COUNT(atm_lane_ops->owner);
754 for(entry=priv->lec_no_forward; entry;
756 if (--count) continue;
757 e=sprintf(buf,"%s ",dev_lec[d]->name);
758 lec_info(entry, buf+e);
759 - module_put(atm_lane_ops.owner);
760 + if (atm_lane_ops->owner)
761 + __MOD_DEC_USE_COUNT(atm_lane_ops->owner);
764 for(entry=priv->mcast_fwds; entry;
765 @@ -486,11 +487,13 @@
766 if (--count) continue;
767 e=sprintf(buf,"%s ",dev_lec[d]->name);
768 lec_info(entry, buf+e);
769 - module_put(atm_lane_ops.owner);
770 + if (atm_lane_ops->owner)
771 + __MOD_DEC_USE_COUNT(atm_lane_ops->owner);
775 - module_put(atm_lane_ops.owner);
776 + if (atm_lane_ops->owner)
777 + __MOD_DEC_USE_COUNT(atm_lane_ops->owner);
781 @@ -591,12 +592,11 @@
782 name->proc_fops = &proc_spec_atm_operations; \
783 name->owner = THIS_MODULE
785 +struct proc_dir_entry *devices = NULL, *pvc = NULL, *svc = NULL;
786 +struct proc_dir_entry *arp = NULL, *lec = NULL, *vc = NULL;
788 int __init atm_proc_init(void)
790 - struct proc_dir_entry *devices = NULL,*pvc = NULL,*svc = NULL;
791 - struct proc_dir_entry *arp = NULL,*lec = NULL,*vc = NULL;
793 atm_proc_root = proc_mkdir("net/atm",NULL);
800 -#ifdef CONFIG_ATM_CLIP
801 +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
804 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
806 if (vc) remove_proc_entry("vc",atm_proc_root);
807 remove_proc_entry("net/atm",NULL);
811 +void __exit atm_proc_exit(void)
813 + if (vc) remove_proc_entry("vc",atm_proc_root);
814 + if (lec) remove_proc_entry("lec",atm_proc_root);
815 + if (arp) remove_proc_entry("arp",atm_proc_root);
816 + if (svc) remove_proc_entry("svc",atm_proc_root);
817 + if (pvc) remove_proc_entry("pvc",atm_proc_root);
818 + if (devices) remove_proc_entry("devices",atm_proc_root);
819 + remove_proc_entry("net/atm",NULL);
821 Index: linux/net/atm/pvc.c
822 ===================================================================
823 RCS file: /home/chas/CVSROOT/linux/net/atm/pvc.c,v
824 retrieving revision 1.1.1.1
825 diff -u -r1.1.1.1 pvc.c
826 --- linux/net/atm/pvc.c 20 Feb 2003 13:46:30 -0000 1.1.1.1
827 +++ linux/net/atm/pvc.c 1 Mar 2003 14:11:17 -0000
829 #include <linux/skbuff.h>
830 #include <linux/bitops.h>
831 #include <net/sock.h> /* for sock_no_* */
832 -#ifdef CONFIG_ATM_CLIP
833 -#include <net/atmclip.h>
836 #include "resources.h" /* devs and vccs */
837 #include "common.h" /* common for PVCs and SVCs */
838 @@ -121,23 +118,20 @@
842 -static int __init atmpvc_init(void)
843 +int __init atmpvc_init(void)
847 error = sock_register(&pvc_family_ops);
849 - printk(KERN_ERR "ATMPVC: can't register (%d)",error);
850 + printk(KERN_ERR "ATMPVC: can't register (%d)", error);
853 -#ifdef CONFIG_ATM_CLIP
856 -#ifdef CONFIG_PROC_FS
857 - error = atm_proc_init();
858 - if (error) printk("atm_proc_init fails with %d\n",error);
865 -module_init(atmpvc_init);
866 +void __exit atmpvc_exit(void)
868 + sock_unregister(PF_ATMPVC);
870 Index: linux/net/atm/svc.c
871 ===================================================================
872 RCS file: /home/chas/CVSROOT/linux/net/atm/svc.c,v
873 retrieving revision 1.1.1.1
874 diff -u -r1.1.1.1 svc.c
875 --- linux/net/atm/svc.c 20 Feb 2003 13:46:30 -0000 1.1.1.1
876 +++ linux/net/atm/svc.c 27 Feb 2003 16:48:54 -0000
877 @@ -439,13 +439,19 @@
878 * Initialize the ATM SVC protocol family
881 -static int __init atmsvc_init(void)
882 +int __init atmsvc_init(void)
884 - if (sock_register(&svc_family_ops) < 0) {
885 - printk(KERN_ERR "ATMSVC: can't register");
888 + error = sock_register(&svc_family_ops);
890 + printk(KERN_ERR "ATMSVC: can't register (%d)\n", error);
896 -module_init(atmsvc_init);
897 +void __exit atmsvc_exit(void)
899 + sock_unregister(PF_ATMSVC);
901 Index: linux/include/net/atmclip.h
902 ===================================================================
903 RCS file: /home/chas/CVSROOT/linux/include/net/atmclip.h,v
904 retrieving revision 1.1.1.1
905 diff -u -r1.1.1.1 atmclip.h
906 --- linux/include/net/atmclip.h 20 Feb 2003 13:45:58 -0000 1.1.1.1
907 +++ linux/include/net/atmclip.h 1 Mar 2003 13:59:31 -0000
909 int clip_mkip(struct atm_vcc *vcc,int timeout);
910 int clip_setentry(struct atm_vcc *vcc,u32 ip);
911 int clip_encap(struct atm_vcc *vcc,int mode);
912 -void atm_clip_init(void);
914 +struct atm_clip_ops {
915 + int (*clip_create)(int number);
916 + int (*clip_mkip)(struct atm_vcc *vcc,int timeout);
917 + int (*clip_setentry)(struct atm_vcc *vcc,u32 ip);
918 + int (*clip_encap)(struct atm_vcc *vcc,int mode);
919 + void (*clip_push)(struct atm_vcc *vcc,struct sk_buff *skb);
920 + int (*atm_init_atmarp)(struct atm_vcc *vcc);
921 + struct neigh_table *clip_tbl;
922 + struct module *owner;
926 --- linux-2.4.20/net/atm/clip.c.orig Wed Mar 5 22:54:57 2003
927 +++ linux-2.4.20/net/atm/clip.c Thu Mar 6 00:03:50 2003
929 static struct timer_list idle_timer;
930 static int start_timer = 1;
932 -#include "ipcommon.c"
933 +const unsigned char llc_oui[] = {
934 + 0xaa, /* DSAP: non-ISO */
935 + 0xaa, /* SSAP: non-ISO */
936 + 0x03, /* Ctrl: Unnumbered Information Command PDU */
937 + 0x00, /* OUI: EtherType */
941 static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
943 --- linux-2.4.20/net/atm/ipcommon.c.orig Wed Mar 5 22:54:57 2003
944 +++ linux-2.4.20/net/atm/ipcommon.c Thu Mar 6 00:03:48 2003
949 -const unsigned char llc_oui[] = {
950 - 0xaa, /* DSAP: non-ISO */
951 - 0xaa, /* SSAP: non-ISO */
952 - 0x03, /* Ctrl: Unnumbered Information Command PDU */
953 - 0x00, /* OUI: EtherType */
959 * skb_migrate appends the list at "from" to "to", emptying "from" in the
960 * process. skb_migrate is atomic with respect to all other skb operations on
963 spin_unlock_irqrestore(&from->lock,flags);
966 +EXPORT_SYMBOL(skb_migrate);
967 --- linux-2.4.20/net/Config.in.orig Sat Aug 3 02:39:46 2002
968 +++ linux-2.4.20/net/Config.in Wed Mar 5 03:16:08 2003
972 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
973 - bool 'Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)' CONFIG_ATM
974 - if [ "$CONFIG_ATM" = "y" ]; then
975 - if [ "$CONFIG_INET" = "y" ]; then
976 - bool ' Classical IP over ATM' CONFIG_ATM_CLIP
977 - if [ "$CONFIG_ATM_CLIP" = "y" ]; then
978 - bool ' Do NOT send ICMP if no neighbour' CONFIG_ATM_CLIP_NO_ICMP
981 - tristate ' LAN Emulation (LANE) support' CONFIG_ATM_LANE
982 - if [ "$CONFIG_INET" = "y" -a "$CONFIG_ATM_LANE" != "n" ]; then
983 - tristate ' Multi-Protocol Over ATM (MPOA) support' CONFIG_ATM_MPOA
985 - tristate ' RFC1483/2684 Bridged protocols' CONFIG_ATM_BR2684
986 - if [ "$CONFIG_ATM_BR2684" != "n" ]; then
987 - bool ' Per-VC IP filter kludge' CONFIG_ATM_BR2684_IPFILTER
990 + tristate 'Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)' CONFIG_ATM
991 + dep_tristate ' Classical IP over ATM' CONFIG_ATM_CLIP $CONFIG_ATM $CONFIG_INET
992 + dep_mbool ' Do NOT send ICMP if no neighbour' CONFIG_ATM_CLIP_NO_ICMP $CONFIG_ATM_CLIP
993 + dep_tristate ' LAN Emulation (LANE) support' CONFIG_ATM_LANE $CONFIG_ATM $CONFIG_INET
994 + dep_tristate ' Multi-Protocol Over ATM (MPOA) support' CONFIG_ATM_MPOA $CONFIG_ATM_LANE
995 + dep_tristate ' RFC1483/2684 Bridged protocols' CONFIG_ATM_BR2684 $CONFIG_ATM $CONFIG_INET
996 + dep_mbool ' Per-VC IP filter kludge' CONFIG_ATM_BR2684_IPFILTER $CONFIG_ATM_BR2684
998 tristate '802.1Q VLAN Support' CONFIG_VLAN_8021Q
1000 --- linux/arch/alpha/config.in.orig Wed Mar 5 22:24:02 2003
1001 +++ linux/arch/alpha/config.in Wed Mar 5 22:24:10 2003
1003 bool 'Network device support' CONFIG_NETDEVICES
1004 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1005 source drivers/net/Config.in
1006 - if [ "$CONFIG_ATM" = "y" ]; then
1007 + if [ "$CONFIG_ATM" != "n" ]; then
1008 source drivers/atm/Config.in
1011 --- linux/arch/cris/config.in.orig Wed Mar 5 22:24:24 2003
1012 +++ linux/arch/cris/config.in Wed Mar 5 22:24:31 2003
1014 bool 'Network device support' CONFIG_NETDEVICES
1015 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1016 source drivers/net/Config.in
1017 - if [ "$CONFIG_ATM" = "y" ]; then
1018 + if [ "$CONFIG_ATM" != "n" ]; then
1019 source drivers/atm/Config.in
1022 --- linux/arch/i386/config.in.orig Wed Mar 5 22:24:33 2003
1023 +++ linux/arch/i386/config.in Wed Mar 5 22:24:39 2003
1025 bool 'Network device support' CONFIG_NETDEVICES
1026 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1027 source drivers/net/Config.in
1028 - if [ "$CONFIG_ATM" = "y" ]; then
1029 + if [ "$CONFIG_ATM" != "n" ]; then
1030 source drivers/atm/Config.in
1033 --- linux/arch/parisc/config.in.orig Wed Mar 5 22:25:34 2003
1034 +++ linux/arch/parisc/config.in Wed Mar 5 22:25:40 2003
1037 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1038 source drivers/net/Config.in
1039 - if [ "$CONFIG_ATM" = "y" ]; then
1040 + if [ "$CONFIG_ATM" != "n" ]; then
1041 source drivers/atm/Config.in
1044 --- linux/arch/ppc/config.in.orig Wed Mar 5 22:25:42 2003
1045 +++ linux/arch/ppc/config.in Wed Mar 5 22:25:48 2003
1047 bool 'Network device support' CONFIG_NETDEVICES
1048 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1049 source drivers/net/Config.in
1050 - if [ "$CONFIG_ATM" = "y" ]; then
1051 + if [ "$CONFIG_ATM" != "n" ]; then
1052 source drivers/atm/Config.in
1055 --- linux/arch/ppc64/config.in.orig Wed Mar 5 22:25:50 2003
1056 +++ linux/arch/ppc64/config.in Wed Mar 5 22:25:55 2003
1058 bool 'Network device support' CONFIG_NETDEVICES
1059 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1060 source drivers/net/Config.in
1061 - if [ "$CONFIG_ATM" = "y" ]; then
1062 + if [ "$CONFIG_ATM" != "n" ]; then
1063 source drivers/atm/Config.in
1066 --- linux/arch/sh/config.in.orig Wed Mar 5 22:26:08 2003
1067 +++ linux/arch/sh/config.in Wed Mar 5 22:26:14 2003
1069 bool 'Network device support' CONFIG_NETDEVICES
1070 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1071 source drivers/net/Config.in
1072 - if [ "$CONFIG_ATM" = "y" ]; then
1073 + if [ "$CONFIG_ATM" != "n" ]; then
1074 source drivers/atm/Config.in
1077 --- linux/arch/sparc/config.in.orig Wed Mar 5 22:26:16 2003
1078 +++ linux/arch/sparc/config.in Wed Mar 5 22:26:32 2003
1080 dep_tristate ' PPP BSD-Compress compression' CONFIG_PPP_BSDCOMP m
1081 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
1082 dep_tristate ' PPP over Ethernet (EXPERIMENTAL)' CONFIG_PPPOE $CONFIG_PPP
1083 - if [ "$CONFIG_ATM" = "y" ]; then
1084 + if [ "$CONFIG_ATM" != "n" ]; then
1085 dep_tristate ' PPP over ATM (EXPERIMENTAL)' CONFIG_PPPOATM $CONFIG_PPP
1089 # if [ "$CONFIG_FDDI" = "y" ]; then
1092 - if [ "$CONFIG_ATM" = "y" ]; then
1093 + if [ "$CONFIG_ATM" != "n" ]; then
1094 source drivers/atm/Config.in
1097 --- linux/arch/sparc64/config.in.orig Wed Mar 5 22:26:39 2003
1098 +++ linux/arch/sparc64/config.in Wed Mar 5 22:26:45 2003
1100 bool 'Network device support' CONFIG_NETDEVICES
1101 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1102 source drivers/net/Config.in
1103 - if [ "$CONFIG_ATM" = "y" ]; then
1104 + if [ "$CONFIG_ATM" != "n" ]; then
1105 source drivers/atm/Config.in
1108 --- linux/arch/x86_64/config.in.orig Wed Mar 5 22:26:51 2003
1109 +++ linux/arch/x86_64/config.in Wed Mar 5 22:27:11 2003
1111 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1112 source drivers/net/Config.in
1113 # seems to be largely not 64bit safe
1114 -# if [ "$CONFIG_ATM" = "y" ]; then
1115 +# if [ "$CONFIG_ATM" != "n" ]; then
1116 # source drivers/atm/Config.in
1119 --- linux/arch/mips/config-shared.in.orig Wed Mar 5 22:25:13 2003
1120 +++ linux/arch/mips/config-shared.in Wed Mar 5 22:25:19 2003
1122 bool 'Network device support' CONFIG_NETDEVICES
1123 if [ "$CONFIG_NETDEVICES" = "y" ]; then
1124 source drivers/net/Config.in
1125 - if [ "$CONFIG_ATM" = "y" ]; then
1126 + if [ "$CONFIG_ATM" != "n" ]; then
1127 source drivers/atm/Config.in
1130 --- linux-2.4.20/net/sched/Config.in.orig Thu Mar 6 17:20:59 2003
1131 +++ linux-2.4.20/net/sched/Config.in Thu Mar 6 17:46:02 2003
1133 tristate ' CSZ packet scheduler' CONFIG_NET_SCH_CSZ
1134 #tristate ' H-PFQ packet scheduler' CONFIG_NET_SCH_HPFQ
1135 #tristate ' H-FSC packet scheduler' CONFIG_NET_SCH_HFCS
1136 -if [ "$CONFIG_ATM" = "y" ]; then
1137 - bool ' ATM pseudo-scheduler' CONFIG_NET_SCH_ATM
1139 +dep_tristate ' ATM pseudo-scheduler' CONFIG_NET_SCH_ATM $CONFIG_ATM
1140 tristate ' The simplest PRIO pseudoscheduler' CONFIG_NET_SCH_PRIO
1141 tristate ' WRR packet scheduler' CONFIG_NET_SCH_WRR
1142 tristate ' RED queue' CONFIG_NET_SCH_RED
1144 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
1145 the body of a message to majordomo@vger.kernel.org
1146 More majordomo info at http://vger.kernel.org/majordomo-info.html
1147 Please read the FAQ at http://www.tux.org/lkml/