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/config.h>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/list.h>
12 #include <linux/netdevice.h>
13 #include <linux/skbuff.h>
14 #include <linux/etherdevice.h>
15 #include <linux/rtnetlink.h>
17 #include <asm/uaccess.h>
19 #include <linux/atm.h>
20 #include <linux/atmdev.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 unsigned short br_type_trans(struct sk_buff *skb,
293 struct net_device *dev)
299 if (*eth->h_dest & 1) {
300 if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0)
301 skb->pkt_type = PACKET_BROADCAST;
303 skb->pkt_type = PACKET_MULTICAST;
306 else if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))
307 skb->pkt_type = PACKET_OTHERHOST;
309 if (ntohs(eth->h_proto) >= 1536)
315 * This is a magic hack to spot IPX packets. Older Novell breaks
316 * the protocol design and runs IPX over 802.3 without an 802.2 LLC
317 * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
318 * won't work for fault tolerant netware but does for the rest.
320 if (*(unsigned short *) rawp == 0xFFFF)
321 return htons(ETH_P_802_3);
326 return htons(ETH_P_802_2);
328 #endif /* FASTER_VERSION */
331 * We remember when the MAC gets set, so we don't override it later with
332 * the ESI of the ATM card of the first VC
334 static int (*my_eth_mac_addr)(struct net_device *, void *);
335 static int br2684_mac_addr(struct net_device *dev, void *p)
337 int err = my_eth_mac_addr(dev, p);
339 BRPRIV(dev)->mac_was_set = 1;
343 #ifdef CONFIG_ATM_BR2684_IPFILTER
344 /* this IOCTL is experimental. */
345 static int br2684_setfilt(struct atm_vcc *atmvcc, void __user *arg)
347 struct br2684_vcc *brvcc;
348 struct br2684_filter_set fs;
350 if (copy_from_user(&fs, arg, sizeof fs))
352 if (fs.ifspec.method != BR2684_FIND_BYNOTHING) {
354 * This is really a per-vcc thing, but we can also search
357 struct br2684_dev *brdev;
358 read_lock(&devs_lock);
359 brdev = BRPRIV(br2684_find_dev(&fs.ifspec));
360 if (brdev == NULL || list_empty(&brdev->brvccs) ||
361 brdev->brvccs.next != brdev->brvccs.prev) /* >1 VCC */
364 brvcc = list_entry_brvcc(brdev->brvccs.next);
365 read_unlock(&devs_lock);
369 brvcc = BR2684_VCC(atmvcc);
370 memcpy(&brvcc->filter, &fs.filter, sizeof(brvcc->filter));
374 /* Returns 1 if packet should be dropped */
376 packet_fails_filter(u16 type, struct br2684_vcc *brvcc, struct sk_buff *skb)
378 if (brvcc->filter.netmask == 0)
379 return 0; /* no filter in place */
380 if (type == __constant_htons(ETH_P_IP) &&
381 (((struct iphdr *) (skb->data))->daddr & brvcc->filter.
382 netmask) == brvcc->filter.prefix)
384 if (type == __constant_htons(ETH_P_ARP))
386 /* TODO: we should probably filter ARPs too.. don't want to have
387 * them returning values that don't make sense, or is that ok?
391 #endif /* CONFIG_ATM_BR2684_IPFILTER */
393 static void br2684_close_vcc(struct br2684_vcc *brvcc)
395 DPRINTK("removing VCC %p from dev %p\n", brvcc, brvcc->device);
396 write_lock_irq(&devs_lock);
397 list_del(&brvcc->brvccs);
398 write_unlock_irq(&devs_lock);
399 brvcc->atmvcc->user_back = NULL; /* what about vcc->recvq ??? */
400 brvcc->old_push(brvcc->atmvcc, NULL); /* pass on the bad news */
402 module_put(THIS_MODULE);
405 /* when AAL5 PDU comes in: */
406 static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
408 struct br2684_vcc *brvcc = BR2684_VCC(atmvcc);
409 struct net_device *net_dev = brvcc->device;
410 struct br2684_dev *brdev = BRPRIV(net_dev);
411 int plen = sizeof(llc_oui_pid_pad) + ETH_HLEN;
413 DPRINTK("br2684_push\n");
415 if (unlikely(skb == NULL)) {
416 /* skb==NULL means VCC is being destroyed */
417 br2684_close_vcc(brvcc);
418 if (list_empty(&brdev->brvccs)) {
419 read_lock(&devs_lock);
420 list_del(&brdev->br2684_devs);
421 read_unlock(&devs_lock);
422 unregister_netdev(net_dev);
423 free_netdev(net_dev);
429 atm_return(atmvcc, skb->truesize);
430 DPRINTK("skb from brdev %p\n", brdev);
431 if (brvcc->encaps == e_llc) {
432 /* let us waste some time for checking the encapsulation.
433 Note, that only 7 char is checked so frames with a valid FCS
434 are also accepted (but FCS is not checked of course) */
435 if (memcmp(skb->data, llc_oui_pid_pad, 7)) {
436 brdev->stats.rx_errors++;
441 /* Strip FCS if present */
442 if (skb->len > 7 && skb->data[7] == 0x01)
443 __skb_trim(skb, skb->len - 4);
445 plen = PADLEN + ETH_HLEN; /* pad, dstmac,srcmac, ethtype */
446 /* first 2 chars should be 0 */
447 if (*((u16 *) (skb->data)) != 0) {
448 brdev->stats.rx_errors++;
453 if (skb->len < plen) {
454 brdev->stats.rx_errors++;
455 dev_kfree_skb(skb); /* dev_ not needed? */
459 #ifdef FASTER_VERSION
460 /* FIXME: tcpdump shows that pointer to mac header is 2 bytes earlier,
461 than should be. What else should I set? */
463 skb->mac.raw = ((char *) (skb->data)) - ETH_HLEN;
464 skb->pkt_type = PACKET_HOST;
465 #ifdef CONFIG_BR2684_FAST_TRANS
466 skb->protocol = ((u16 *) skb->data)[-1];
467 #else /* some protocols might require this: */
468 skb->protocol = br_type_trans(skb, net_dev);
469 #endif /* CONFIG_BR2684_FAST_TRANS */
471 skb_pull(skb, plen - ETH_HLEN);
472 skb->protocol = eth_type_trans(skb, net_dev);
473 #endif /* FASTER_VERSION */
474 #ifdef CONFIG_ATM_BR2684_IPFILTER
475 if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) {
476 brdev->stats.rx_dropped++;
480 #endif /* CONFIG_ATM_BR2684_IPFILTER */
482 ATM_SKB(skb)->vcc = atmvcc; /* needed ? */
483 DPRINTK("received packet's protocol: %x\n", ntohs(skb->protocol));
485 if (unlikely(!(net_dev->flags & IFF_UP))) {
486 /* sigh, interface is down */
487 brdev->stats.rx_dropped++;
491 brdev->stats.rx_packets++;
492 brdev->stats.rx_bytes += skb->len;
493 memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
497 static int br2684_regvcc(struct atm_vcc *atmvcc, void __user *arg)
499 /* assign a vcc to a dev
500 Note: we do not have explicit unassign, but look at _push()
503 struct br2684_vcc *brvcc;
504 struct sk_buff_head copy;
506 struct br2684_dev *brdev;
507 struct net_device *net_dev;
508 struct atm_backend_br2684 be;
510 if (copy_from_user(&be, arg, sizeof be))
512 brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
515 memset(brvcc, 0, sizeof(struct br2684_vcc));
516 write_lock_irq(&devs_lock);
517 net_dev = br2684_find_dev(&be.ifspec);
518 if (net_dev == NULL) {
520 "br2684: tried to attach to non-existant device\n");
524 brdev = BRPRIV(net_dev);
525 if (atmvcc->push == NULL) {
529 if (!list_empty(&brdev->brvccs)) {
530 /* Only 1 VCC/dev right now */
534 if (be.fcs_in != BR2684_FCSIN_NO || be.fcs_out != BR2684_FCSOUT_NO ||
535 be.fcs_auto || be.has_vpiid || be.send_padding || (be.encaps !=
536 BR2684_ENCAPS_VC && be.encaps != BR2684_ENCAPS_LLC) ||
541 DPRINTK("br2684_regvcc vcc=%p, encaps=%d, brvcc=%p\n", atmvcc, be.encaps,
543 if (list_empty(&brdev->brvccs) && !brdev->mac_was_set) {
544 unsigned char *esi = atmvcc->dev->esi;
545 if (esi[0] | esi[1] | esi[2] | esi[3] | esi[4] | esi[5])
546 memcpy(net_dev->dev_addr, esi, net_dev->addr_len);
548 net_dev->dev_addr[2] = 1;
550 list_add(&brvcc->brvccs, &brdev->brvccs);
551 write_unlock_irq(&devs_lock);
552 brvcc->device = net_dev;
553 brvcc->atmvcc = atmvcc;
554 atmvcc->user_back = brvcc;
555 brvcc->encaps = (enum br2684_encaps) be.encaps;
556 brvcc->old_push = atmvcc->push;
558 atmvcc->push = br2684_push;
559 skb_queue_head_init(©);
560 skb_migrate(&sk_atm(atmvcc)->sk_receive_queue, ©);
561 while ((skb = skb_dequeue(©)) != NULL) {
562 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
563 BRPRIV(skb->dev)->stats.rx_packets--;
564 br2684_push(atmvcc, skb);
566 __module_get(THIS_MODULE);
569 write_unlock_irq(&devs_lock);
574 static void br2684_setup(struct net_device *netdev)
576 struct br2684_dev *brdev = BRPRIV(netdev);
579 brdev->net_dev = netdev;
581 #ifdef FASTER_VERSION
582 my_eth_header = netdev->hard_header;
583 netdev->hard_header = br2684_header;
584 my_eth_header_cache = netdev->hard_header_cache;
585 netdev->hard_header_cache = br2684_header_cache;
586 netdev->hard_header_len = sizeof(llc_oui_pid_pad) + ETH_HLEN; /* 10 + 14 */
588 my_eth_mac_addr = netdev->set_mac_address;
589 netdev->set_mac_address = br2684_mac_addr;
590 netdev->hard_start_xmit = br2684_start_xmit;
591 netdev->get_stats = br2684_get_stats;
593 INIT_LIST_HEAD(&brdev->brvccs);
596 static int br2684_create(void __user *arg)
599 struct net_device *netdev;
600 struct br2684_dev *brdev;
601 struct atm_newif_br2684 ni;
603 DPRINTK("br2684_create\n");
605 if (copy_from_user(&ni, arg, sizeof ni)) {
608 if (ni.media != BR2684_MEDIA_ETHERNET || ni.mtu != 1500) {
612 netdev = alloc_netdev(sizeof(struct br2684_dev),
613 ni.ifname[0] ? ni.ifname : "nas%d",
618 brdev = BRPRIV(netdev);
620 DPRINTK("registered netdev %s\n", netdev->name);
621 /* open, stop, do_ioctl ? */
622 err = register_netdev(netdev);
624 printk(KERN_ERR "br2684_create: register_netdev failed\n");
629 write_lock_irq(&devs_lock);
630 brdev->number = list_empty(&br2684_devs) ? 1 :
631 BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1;
632 list_add_tail(&brdev->br2684_devs, &br2684_devs);
633 write_unlock_irq(&devs_lock);
638 * This handles ioctls actually performed on our vcc - we must return
639 * -ENOIOCTLCMD for any unrecognized ioctl
641 static int br2684_ioctl(struct socket *sock, unsigned int cmd,
644 struct atm_vcc *atmvcc = ATM_SD(sock);
645 void __user *argp = (void __user *)arg;
650 case ATM_NEWBACKENDIF: {
652 err = get_user(b, (atm_backend_t __user *) argp);
655 if (b != ATM_BACKEND_BR2684)
657 if (!capable(CAP_NET_ADMIN))
659 if (cmd == ATM_SETBACKEND)
660 return br2684_regvcc(atmvcc, argp);
662 return br2684_create(argp);
664 #ifdef CONFIG_ATM_BR2684_IPFILTER
666 if (atmvcc->push != br2684_push)
668 if (!capable(CAP_NET_ADMIN))
670 err = br2684_setfilt(atmvcc, argp);
672 #endif /* CONFIG_ATM_BR2684_IPFILTER */
677 static struct atm_ioctl br2684_ioctl_ops = {
678 .owner = THIS_MODULE,
679 .ioctl = br2684_ioctl,
683 #ifdef CONFIG_PROC_FS
684 static void *br2684_seq_start(struct seq_file *seq, loff_t *pos)
687 struct br2684_dev *brd;
689 read_lock(&devs_lock);
691 list_for_each_entry(brd, &br2684_devs, br2684_devs) {
699 static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos)
701 struct br2684_dev *brd = v;
705 brd = list_entry(brd->br2684_devs.next,
706 struct br2684_dev, br2684_devs);
707 return (&brd->br2684_devs != &br2684_devs) ? brd : NULL;
710 static void br2684_seq_stop(struct seq_file *seq, void *v)
712 read_unlock(&devs_lock);
715 static int br2684_seq_show(struct seq_file *seq, void *v)
717 const struct br2684_dev *brdev = v;
718 const struct net_device *net_dev = brdev->net_dev;
719 const struct br2684_vcc *brvcc;
721 seq_printf(seq, "dev %.16s: num=%d, mac=%02X:%02X:"
722 "%02X:%02X:%02X:%02X (%s)\n", net_dev->name,
724 net_dev->dev_addr[0],
725 net_dev->dev_addr[1],
726 net_dev->dev_addr[2],
727 net_dev->dev_addr[3],
728 net_dev->dev_addr[4],
729 net_dev->dev_addr[5],
730 brdev->mac_was_set ? "set" : "auto");
732 list_for_each_entry(brvcc, &brdev->brvccs, brvccs) {
733 seq_printf(seq, " vcc %d.%d.%d: encaps=%s"
734 #ifndef FASTER_VERSION
735 ", failed copies %u/%u"
736 #endif /* FASTER_VERSION */
737 "\n", brvcc->atmvcc->dev->number,
738 brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
739 (brvcc->encaps == e_llc) ? "LLC" : "VC"
740 #ifndef FASTER_VERSION
741 , brvcc->copies_failed
742 , brvcc->copies_needed
743 #endif /* FASTER_VERSION */
745 #ifdef CONFIG_ATM_BR2684_IPFILTER
746 #define b1(var, byte) ((u8 *) &brvcc->filter.var)[byte]
747 #define bs(var) b1(var, 0), b1(var, 1), b1(var, 2), b1(var, 3)
748 if (brvcc->filter.netmask != 0)
749 seq_printf(seq, " filter=%d.%d.%d.%d/"
751 bs(prefix), bs(netmask));
754 #endif /* CONFIG_ATM_BR2684_IPFILTER */
759 static struct seq_operations br2684_seq_ops = {
760 .start = br2684_seq_start,
761 .next = br2684_seq_next,
762 .stop = br2684_seq_stop,
763 .show = br2684_seq_show,
766 static int br2684_proc_open(struct inode *inode, struct file *file)
768 return seq_open(file, &br2684_seq_ops);
771 static struct file_operations br2684_proc_ops = {
772 .owner = THIS_MODULE,
773 .open = br2684_proc_open,
776 .release = seq_release,
779 extern struct proc_dir_entry *atm_proc_root; /* from proc.c */
782 static int __init br2684_init(void)
784 #ifdef CONFIG_PROC_FS
785 struct proc_dir_entry *p;
786 if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
788 p->proc_fops = &br2684_proc_ops;
790 register_atm_ioctl(&br2684_ioctl_ops);
794 static void __exit br2684_exit(void)
796 struct net_device *net_dev;
797 struct br2684_dev *brdev;
798 struct br2684_vcc *brvcc;
799 deregister_atm_ioctl(&br2684_ioctl_ops);
801 #ifdef CONFIG_PROC_FS
802 remove_proc_entry("br2684", atm_proc_root);
805 while (!list_empty(&br2684_devs)) {
806 net_dev = list_entry_brdev(br2684_devs.next);
807 brdev = BRPRIV(net_dev);
808 while (!list_empty(&brdev->brvccs)) {
809 brvcc = list_entry_brvcc(brdev->brvccs.next);
810 br2684_close_vcc(brvcc);
813 list_del(&brdev->br2684_devs);
814 unregister_netdev(net_dev);
815 free_netdev(net_dev);
819 module_init(br2684_init);
820 module_exit(br2684_exit);
822 MODULE_AUTHOR("Marcell GAL");
823 MODULE_DESCRIPTION("RFC2684 bridged protocols over ATM/AAL5");
824 MODULE_LICENSE("GPL");