2 Experimental ethernet netdevice using ATM AAL5 as underlying carrier
3 (RFC1483 obsoleted by RFC2684) for Linux 2.4
4 Author: Marcell GAL, 2000, XDSL Ltd, Hungary
7 #include <linux/module.h>
8 #include <linux/init.h>
9 #include <linux/kernel.h>
10 #include <linux/list.h>
11 #include <linux/netdevice.h>
12 #include <linux/skbuff.h>
13 #include <linux/etherdevice.h>
14 #include <linux/rtnetlink.h>
16 #include <asm/uaccess.h>
18 #include <linux/atm.h>
19 #include <linux/atmdev.h>
20 #include <linux/capability.h>
21 #include <linux/seq_file.h>
23 #include <linux/atmbr2684.h>
29 * Define this to use a version of the code which interacts with the higher
30 * layers in a more intellegent way, by always reserving enough space for
31 * our header at the begining of the packet. However, there may still be
32 * some problems with programs like tcpdump. In 2.5 we'll sort out what
33 * we need to do to get this perfect. For now we just will copy the packet
34 * if we need space for the header
36 /* #define FASTER_VERSION */
39 #define DPRINTK(format, args...) printk(KERN_DEBUG "br2684: " format, ##args)
41 #define DPRINTK(format, args...)
45 static void skb_debug(const struct sk_buff *skb)
48 char buf[NUM2PRINT * 3 + 1]; /* 3 chars per byte */
50 for (i = 0; i < skb->len && i < NUM2PRINT; i++) {
51 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
53 printk(KERN_DEBUG "br2684: skb: %s\n", buf);
56 #define skb_debug(skb) do {} while (0)
59 static unsigned char llc_oui_pid_pad[] =
60 { 0xAA, 0xAA, 0x03, 0x00, 0x80, 0xC2, 0x00, 0x07, 0x00, 0x00 };
64 e_vc = BR2684_ENCAPS_VC,
65 e_llc = BR2684_ENCAPS_LLC,
69 struct atm_vcc *atmvcc;
70 struct net_device *device;
71 /* keep old push,pop functions for chaining */
72 void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb);
73 /* void (*old_pop)(struct atm_vcc *vcc,struct sk_buff *skb); */
74 enum br2684_encaps encaps;
75 struct list_head brvccs;
76 #ifdef CONFIG_ATM_BR2684_IPFILTER
77 struct br2684_filter filter;
78 #endif /* CONFIG_ATM_BR2684_IPFILTER */
79 #ifndef FASTER_VERSION
80 unsigned copies_needed, copies_failed;
81 #endif /* FASTER_VERSION */
85 struct net_device *net_dev;
86 struct list_head br2684_devs;
88 struct list_head brvccs; /* one device <=> one vcc (before xmas) */
89 struct net_device_stats stats;
94 * This lock should be held for writing any time the list of devices or
95 * their attached vcc's could be altered. It should be held for reading
96 * any time these are being queried. Note that we sometimes need to
97 * do read-locking under interrupt context, so write locking must block
98 * the current CPU's interrupts
100 static DEFINE_RWLOCK(devs_lock);
102 static LIST_HEAD(br2684_devs);
104 static inline struct br2684_dev *BRPRIV(const struct net_device *net_dev)
106 return (struct br2684_dev *) net_dev->priv;
109 static inline struct net_device *list_entry_brdev(const struct list_head *le)
111 return list_entry(le, struct br2684_dev, br2684_devs)->net_dev;
114 static inline struct br2684_vcc *BR2684_VCC(const struct atm_vcc *atmvcc)
116 return (struct br2684_vcc *) (atmvcc->user_back);
119 static inline struct br2684_vcc *list_entry_brvcc(const struct list_head *le)
121 return list_entry(le, struct br2684_vcc, brvccs);
124 /* Caller should hold read_lock(&devs_lock) */
125 static struct net_device *br2684_find_dev(const struct br2684_if_spec *s)
127 struct list_head *lh;
128 struct net_device *net_dev;
130 case BR2684_FIND_BYNUM:
131 list_for_each(lh, &br2684_devs) {
132 net_dev = list_entry_brdev(lh);
133 if (BRPRIV(net_dev)->number == s->spec.devnum)
137 case BR2684_FIND_BYIFNAME:
138 list_for_each(lh, &br2684_devs) {
139 net_dev = list_entry_brdev(lh);
140 if (!strncmp(net_dev->name, s->spec.ifname, IFNAMSIZ))
149 * Send a packet out a particular vcc. Not to useful right now, but paves
150 * the way for multiple vcc's per itf. Returns true if we can send,
153 static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
154 struct br2684_vcc *brvcc)
156 struct atm_vcc *atmvcc;
157 #ifdef FASTER_VERSION
158 if (brvcc->encaps == e_llc)
159 memcpy(skb_push(skb, 8), llc_oui_pid_pad, 8);
160 /* last 2 bytes of llc_oui_pid_pad are managed by header routines;
161 yes, you got it: 8 + 2 = sizeof(llc_oui_pid_pad)
164 int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
165 if (skb_headroom(skb) < minheadroom) {
166 struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
167 brvcc->copies_needed++;
170 brvcc->copies_failed++;
175 skb_push(skb, minheadroom);
176 if (brvcc->encaps == e_llc)
177 memcpy(skb->data, llc_oui_pid_pad, 10);
179 memset(skb->data, 0, 2);
180 #endif /* FASTER_VERSION */
183 ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
184 DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev);
185 if (!atm_may_send(atmvcc, skb->truesize)) {
186 /* we free this here for now, because we cannot know in a higher
187 layer whether the skb point it supplied wasn't freed yet.
193 atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc);
194 ATM_SKB(skb)->atm_options = atmvcc->atm_options;
195 brdev->stats.tx_packets++;
196 brdev->stats.tx_bytes += skb->len;
197 atmvcc->send(atmvcc, skb);
201 static inline struct br2684_vcc *pick_outgoing_vcc(struct sk_buff *skb,
202 struct br2684_dev *brdev)
204 return list_empty(&brdev->brvccs) ? NULL :
205 list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */
208 static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
210 struct br2684_dev *brdev = BRPRIV(dev);
211 struct br2684_vcc *brvcc;
213 DPRINTK("br2684_start_xmit, skb->dst=%p\n", skb->dst);
214 read_lock(&devs_lock);
215 brvcc = pick_outgoing_vcc(skb, brdev);
217 DPRINTK("no vcc attached to dev %s\n", dev->name);
218 brdev->stats.tx_errors++;
219 brdev->stats.tx_carrier_errors++;
220 /* netif_stop_queue(dev); */
222 read_unlock(&devs_lock);
225 if (!br2684_xmit_vcc(skb, brdev, brvcc)) {
227 * We should probably use netif_*_queue() here, but that
228 * involves added complication. We need to walk before
231 /* don't free here! this pointer might be no longer valid!
234 brdev->stats.tx_errors++;
235 brdev->stats.tx_fifo_errors++;
237 read_unlock(&devs_lock);
241 static struct net_device_stats *br2684_get_stats(struct net_device *dev)
243 DPRINTK("br2684_get_stats\n");
244 return &BRPRIV(dev)->stats;
247 #ifdef FASTER_VERSION
249 * These mirror eth_header and eth_header_cache. They are not usually
250 * exported for use in modules, so we grab them from net_device
251 * after ether_setup() is done with it. Bit of a hack.
253 static int (*my_eth_header)(struct sk_buff *, struct net_device *,
254 unsigned short, void *, void *, unsigned);
255 static int (*my_eth_header_cache)(struct neighbour *, struct hh_cache *);
258 br2684_header(struct sk_buff *skb, struct net_device *dev,
259 unsigned short type, void *daddr, void *saddr, unsigned len)
262 int t = my_eth_header(skb, dev, type, daddr, saddr, len);
264 pad_before_eth = (u16 *) skb_push(skb, 2);
266 return dev->hard_header_len; /* or return 16; ? */
272 br2684_header_cache(struct neighbour *neigh, struct hh_cache *hh)
274 /* hh_data is 16 bytes long. if encaps is ether-llc we need 24, so
275 xmit will add the additional header part in that case */
276 u16 *pad_before_eth = (u16 *)(hh->hh_data);
277 int t = my_eth_header_cache(neigh, hh);
278 DPRINTK("br2684_header_cache, neigh=%p, hh_cache=%p\n", neigh, hh);
283 hh->hh_len = PADLEN + ETH_HLEN;
289 * This is similar to eth_type_trans, which cannot be used because of
290 * our dev->hard_header_len
292 static inline __be16 br_type_trans(struct sk_buff *skb, struct net_device *dev)
298 if (is_multicast_ether_addr(eth->h_dest)) {
299 if (!compare_ether_addr(eth->h_dest, dev->broadcast))
300 skb->pkt_type = PACKET_BROADCAST;
302 skb->pkt_type = PACKET_MULTICAST;
305 else if (compare_ether_addr(eth->h_dest, dev->dev_addr))
306 skb->pkt_type = PACKET_OTHERHOST;
308 if (ntohs(eth->h_proto) >= 1536)
314 * This is a magic hack to spot IPX packets. Older Novell breaks
315 * the protocol design and runs IPX over 802.3 without an 802.2 LLC
316 * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
317 * won't work for fault tolerant netware but does for the rest.
319 if (*(unsigned short *) rawp == 0xFFFF)
320 return htons(ETH_P_802_3);
325 return htons(ETH_P_802_2);
327 #endif /* FASTER_VERSION */
330 * We remember when the MAC gets set, so we don't override it later with
331 * the ESI of the ATM card of the first VC
333 static int (*my_eth_mac_addr)(struct net_device *, void *);
334 static int br2684_mac_addr(struct net_device *dev, void *p)
336 int err = my_eth_mac_addr(dev, p);
338 BRPRIV(dev)->mac_was_set = 1;
342 #ifdef CONFIG_ATM_BR2684_IPFILTER
343 /* this IOCTL is experimental. */
344 static int br2684_setfilt(struct atm_vcc *atmvcc, void __user *arg)
346 struct br2684_vcc *brvcc;
347 struct br2684_filter_set fs;
349 if (copy_from_user(&fs, arg, sizeof fs))
351 if (fs.ifspec.method != BR2684_FIND_BYNOTHING) {
353 * This is really a per-vcc thing, but we can also search
356 struct br2684_dev *brdev;
357 read_lock(&devs_lock);
358 brdev = BRPRIV(br2684_find_dev(&fs.ifspec));
359 if (brdev == NULL || list_empty(&brdev->brvccs) ||
360 brdev->brvccs.next != brdev->brvccs.prev) /* >1 VCC */
363 brvcc = list_entry_brvcc(brdev->brvccs.next);
364 read_unlock(&devs_lock);
368 brvcc = BR2684_VCC(atmvcc);
369 memcpy(&brvcc->filter, &fs.filter, sizeof(brvcc->filter));
373 /* Returns 1 if packet should be dropped */
375 packet_fails_filter(u16 type, struct br2684_vcc *brvcc, struct sk_buff *skb)
377 if (brvcc->filter.netmask == 0)
378 return 0; /* no filter in place */
379 if (type == __constant_htons(ETH_P_IP) &&
380 (((struct iphdr *) (skb->data))->daddr & brvcc->filter.
381 netmask) == brvcc->filter.prefix)
383 if (type == __constant_htons(ETH_P_ARP))
385 /* TODO: we should probably filter ARPs too.. don't want to have
386 * them returning values that don't make sense, or is that ok?
390 #endif /* CONFIG_ATM_BR2684_IPFILTER */
392 static void br2684_close_vcc(struct br2684_vcc *brvcc)
394 DPRINTK("removing VCC %p from dev %p\n", brvcc, brvcc->device);
395 write_lock_irq(&devs_lock);
396 list_del(&brvcc->brvccs);
397 write_unlock_irq(&devs_lock);
398 brvcc->atmvcc->user_back = NULL; /* what about vcc->recvq ??? */
399 brvcc->old_push(brvcc->atmvcc, NULL); /* pass on the bad news */
401 module_put(THIS_MODULE);
404 /* when AAL5 PDU comes in: */
405 static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
407 struct br2684_vcc *brvcc = BR2684_VCC(atmvcc);
408 struct net_device *net_dev = brvcc->device;
409 struct br2684_dev *brdev = BRPRIV(net_dev);
410 int plen = sizeof(llc_oui_pid_pad) + ETH_HLEN;
412 DPRINTK("br2684_push\n");
414 if (unlikely(skb == NULL)) {
415 /* skb==NULL means VCC is being destroyed */
416 br2684_close_vcc(brvcc);
417 if (list_empty(&brdev->brvccs)) {
418 read_lock(&devs_lock);
419 list_del(&brdev->br2684_devs);
420 read_unlock(&devs_lock);
421 unregister_netdev(net_dev);
422 free_netdev(net_dev);
428 atm_return(atmvcc, skb->truesize);
429 DPRINTK("skb from brdev %p\n", brdev);
430 if (brvcc->encaps == e_llc) {
431 /* let us waste some time for checking the encapsulation.
432 Note, that only 7 char is checked so frames with a valid FCS
433 are also accepted (but FCS is not checked of course) */
434 if (memcmp(skb->data, llc_oui_pid_pad, 7)) {
435 brdev->stats.rx_errors++;
440 /* Strip FCS if present */
441 if (skb->len > 7 && skb->data[7] == 0x01)
442 __skb_trim(skb, skb->len - 4);
444 plen = PADLEN + ETH_HLEN; /* pad, dstmac,srcmac, ethtype */
445 /* first 2 chars should be 0 */
446 if (*((u16 *) (skb->data)) != 0) {
447 brdev->stats.rx_errors++;
452 if (skb->len < plen) {
453 brdev->stats.rx_errors++;
454 dev_kfree_skb(skb); /* dev_ not needed? */
458 #ifdef FASTER_VERSION
459 /* FIXME: tcpdump shows that pointer to mac header is 2 bytes earlier,
460 than should be. What else should I set? */
462 skb->mac.raw = ((char *) (skb->data)) - ETH_HLEN;
463 skb->pkt_type = PACKET_HOST;
464 #ifdef CONFIG_BR2684_FAST_TRANS
465 skb->protocol = ((u16 *) skb->data)[-1];
466 #else /* some protocols might require this: */
467 skb->protocol = br_type_trans(skb, net_dev);
468 #endif /* CONFIG_BR2684_FAST_TRANS */
470 skb_pull(skb, plen - ETH_HLEN);
471 skb->protocol = eth_type_trans(skb, net_dev);
472 #endif /* FASTER_VERSION */
473 #ifdef CONFIG_ATM_BR2684_IPFILTER
474 if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) {
475 brdev->stats.rx_dropped++;
479 #endif /* CONFIG_ATM_BR2684_IPFILTER */
481 ATM_SKB(skb)->vcc = atmvcc; /* needed ? */
482 DPRINTK("received packet's protocol: %x\n", ntohs(skb->protocol));
484 if (unlikely(!(net_dev->flags & IFF_UP))) {
485 /* sigh, interface is down */
486 brdev->stats.rx_dropped++;
490 brdev->stats.rx_packets++;
491 brdev->stats.rx_bytes += skb->len;
492 memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
496 static int br2684_regvcc(struct atm_vcc *atmvcc, void __user *arg)
498 /* assign a vcc to a dev
499 Note: we do not have explicit unassign, but look at _push()
502 struct br2684_vcc *brvcc;
503 struct sk_buff_head copy;
505 struct br2684_dev *brdev;
506 struct net_device *net_dev;
507 struct atm_backend_br2684 be;
509 if (copy_from_user(&be, arg, sizeof be))
511 brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
514 memset(brvcc, 0, sizeof(struct br2684_vcc));
515 write_lock_irq(&devs_lock);
516 net_dev = br2684_find_dev(&be.ifspec);
517 if (net_dev == NULL) {
519 "br2684: tried to attach to non-existant device\n");
523 brdev = BRPRIV(net_dev);
524 if (atmvcc->push == NULL) {
528 if (!list_empty(&brdev->brvccs)) {
529 /* Only 1 VCC/dev right now */
533 if (be.fcs_in != BR2684_FCSIN_NO || be.fcs_out != BR2684_FCSOUT_NO ||
534 be.fcs_auto || be.has_vpiid || be.send_padding || (be.encaps !=
535 BR2684_ENCAPS_VC && be.encaps != BR2684_ENCAPS_LLC) ||
540 DPRINTK("br2684_regvcc vcc=%p, encaps=%d, brvcc=%p\n", atmvcc, be.encaps,
542 if (list_empty(&brdev->brvccs) && !brdev->mac_was_set) {
543 unsigned char *esi = atmvcc->dev->esi;
544 if (esi[0] | esi[1] | esi[2] | esi[3] | esi[4] | esi[5])
545 memcpy(net_dev->dev_addr, esi, net_dev->addr_len);
547 net_dev->dev_addr[2] = 1;
549 list_add(&brvcc->brvccs, &brdev->brvccs);
550 write_unlock_irq(&devs_lock);
551 brvcc->device = net_dev;
552 brvcc->atmvcc = atmvcc;
553 atmvcc->user_back = brvcc;
554 brvcc->encaps = (enum br2684_encaps) be.encaps;
555 brvcc->old_push = atmvcc->push;
557 atmvcc->push = br2684_push;
558 skb_queue_head_init(©);
559 skb_migrate(&sk_atm(atmvcc)->sk_receive_queue, ©);
560 while ((skb = skb_dequeue(©)) != NULL) {
561 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
562 BRPRIV(skb->dev)->stats.rx_packets--;
563 br2684_push(atmvcc, skb);
565 __module_get(THIS_MODULE);
568 write_unlock_irq(&devs_lock);
573 static void br2684_setup(struct net_device *netdev)
575 struct br2684_dev *brdev = BRPRIV(netdev);
578 brdev->net_dev = netdev;
580 #ifdef FASTER_VERSION
581 my_eth_header = netdev->hard_header;
582 netdev->hard_header = br2684_header;
583 my_eth_header_cache = netdev->hard_header_cache;
584 netdev->hard_header_cache = br2684_header_cache;
585 netdev->hard_header_len = sizeof(llc_oui_pid_pad) + ETH_HLEN; /* 10 + 14 */
587 my_eth_mac_addr = netdev->set_mac_address;
588 netdev->set_mac_address = br2684_mac_addr;
589 netdev->hard_start_xmit = br2684_start_xmit;
590 netdev->get_stats = br2684_get_stats;
592 INIT_LIST_HEAD(&brdev->brvccs);
595 static int br2684_create(void __user *arg)
598 struct net_device *netdev;
599 struct br2684_dev *brdev;
600 struct atm_newif_br2684 ni;
602 DPRINTK("br2684_create\n");
604 if (copy_from_user(&ni, arg, sizeof ni)) {
607 if (ni.media != BR2684_MEDIA_ETHERNET || ni.mtu != 1500) {
611 netdev = alloc_netdev(sizeof(struct br2684_dev),
612 ni.ifname[0] ? ni.ifname : "nas%d",
617 brdev = BRPRIV(netdev);
619 DPRINTK("registered netdev %s\n", netdev->name);
620 /* open, stop, do_ioctl ? */
621 err = register_netdev(netdev);
623 printk(KERN_ERR "br2684_create: register_netdev failed\n");
628 write_lock_irq(&devs_lock);
629 brdev->number = list_empty(&br2684_devs) ? 1 :
630 BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1;
631 list_add_tail(&brdev->br2684_devs, &br2684_devs);
632 write_unlock_irq(&devs_lock);
637 * This handles ioctls actually performed on our vcc - we must return
638 * -ENOIOCTLCMD for any unrecognized ioctl
640 static int br2684_ioctl(struct socket *sock, unsigned int cmd,
643 struct atm_vcc *atmvcc = ATM_SD(sock);
644 void __user *argp = (void __user *)arg;
649 case ATM_NEWBACKENDIF: {
651 err = get_user(b, (atm_backend_t __user *) argp);
654 if (b != ATM_BACKEND_BR2684)
656 if (!capable(CAP_NET_ADMIN))
658 if (cmd == ATM_SETBACKEND)
659 return br2684_regvcc(atmvcc, argp);
661 return br2684_create(argp);
663 #ifdef CONFIG_ATM_BR2684_IPFILTER
665 if (atmvcc->push != br2684_push)
667 if (!capable(CAP_NET_ADMIN))
669 err = br2684_setfilt(atmvcc, argp);
671 #endif /* CONFIG_ATM_BR2684_IPFILTER */
676 static struct atm_ioctl br2684_ioctl_ops = {
677 .owner = THIS_MODULE,
678 .ioctl = br2684_ioctl,
682 #ifdef CONFIG_PROC_FS
683 static void *br2684_seq_start(struct seq_file *seq, loff_t *pos)
686 struct br2684_dev *brd;
688 read_lock(&devs_lock);
690 list_for_each_entry(brd, &br2684_devs, br2684_devs) {
698 static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos)
700 struct br2684_dev *brd = v;
704 brd = list_entry(brd->br2684_devs.next,
705 struct br2684_dev, br2684_devs);
706 return (&brd->br2684_devs != &br2684_devs) ? brd : NULL;
709 static void br2684_seq_stop(struct seq_file *seq, void *v)
711 read_unlock(&devs_lock);
714 static int br2684_seq_show(struct seq_file *seq, void *v)
716 const struct br2684_dev *brdev = v;
717 const struct net_device *net_dev = brdev->net_dev;
718 const struct br2684_vcc *brvcc;
720 seq_printf(seq, "dev %.16s: num=%d, mac=%02X:%02X:"
721 "%02X:%02X:%02X:%02X (%s)\n", net_dev->name,
723 net_dev->dev_addr[0],
724 net_dev->dev_addr[1],
725 net_dev->dev_addr[2],
726 net_dev->dev_addr[3],
727 net_dev->dev_addr[4],
728 net_dev->dev_addr[5],
729 brdev->mac_was_set ? "set" : "auto");
731 list_for_each_entry(brvcc, &brdev->brvccs, brvccs) {
732 seq_printf(seq, " vcc %d.%d.%d: encaps=%s"
733 #ifndef FASTER_VERSION
734 ", failed copies %u/%u"
735 #endif /* FASTER_VERSION */
736 "\n", brvcc->atmvcc->dev->number,
737 brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
738 (brvcc->encaps == e_llc) ? "LLC" : "VC"
739 #ifndef FASTER_VERSION
740 , brvcc->copies_failed
741 , brvcc->copies_needed
742 #endif /* FASTER_VERSION */
744 #ifdef CONFIG_ATM_BR2684_IPFILTER
745 #define b1(var, byte) ((u8 *) &brvcc->filter.var)[byte]
746 #define bs(var) b1(var, 0), b1(var, 1), b1(var, 2), b1(var, 3)
747 if (brvcc->filter.netmask != 0)
748 seq_printf(seq, " filter=%d.%d.%d.%d/"
750 bs(prefix), bs(netmask));
753 #endif /* CONFIG_ATM_BR2684_IPFILTER */
758 static struct seq_operations br2684_seq_ops = {
759 .start = br2684_seq_start,
760 .next = br2684_seq_next,
761 .stop = br2684_seq_stop,
762 .show = br2684_seq_show,
765 static int br2684_proc_open(struct inode *inode, struct file *file)
767 return seq_open(file, &br2684_seq_ops);
770 static struct file_operations br2684_proc_ops = {
771 .owner = THIS_MODULE,
772 .open = br2684_proc_open,
775 .release = seq_release,
778 extern struct proc_dir_entry *atm_proc_root; /* from proc.c */
781 static int __init br2684_init(void)
783 #ifdef CONFIG_PROC_FS
784 struct proc_dir_entry *p;
785 if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
787 p->proc_fops = &br2684_proc_ops;
789 register_atm_ioctl(&br2684_ioctl_ops);
793 static void __exit br2684_exit(void)
795 struct net_device *net_dev;
796 struct br2684_dev *brdev;
797 struct br2684_vcc *brvcc;
798 deregister_atm_ioctl(&br2684_ioctl_ops);
800 #ifdef CONFIG_PROC_FS
801 remove_proc_entry("br2684", atm_proc_root);
804 while (!list_empty(&br2684_devs)) {
805 net_dev = list_entry_brdev(br2684_devs.next);
806 brdev = BRPRIV(net_dev);
807 while (!list_empty(&brdev->brvccs)) {
808 brvcc = list_entry_brvcc(brdev->brvccs.next);
809 br2684_close_vcc(brvcc);
812 list_del(&brdev->br2684_devs);
813 unregister_netdev(net_dev);
814 free_netdev(net_dev);
818 module_init(br2684_init);
819 module_exit(br2684_exit);
821 MODULE_AUTHOR("Marcell GAL");
822 MODULE_DESCRIPTION("RFC2684 bridged protocols over ATM/AAL5");
823 MODULE_LICENSE("GPL");