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/capability.h>
22 #include <linux/seq_file.h>
24 #include <linux/atmbr2684.h>
30 * Define this to use a version of the code which interacts with the higher
31 * layers in a more intellegent way, by always reserving enough space for
32 * our header at the begining of the packet. However, there may still be
33 * some problems with programs like tcpdump. In 2.5 we'll sort out what
34 * we need to do to get this perfect. For now we just will copy the packet
35 * if we need space for the header
37 /* #define FASTER_VERSION */
40 #define DPRINTK(format, args...) printk(KERN_DEBUG "br2684: " format, ##args)
42 #define DPRINTK(format, args...)
46 static void skb_debug(const struct sk_buff *skb)
49 char buf[NUM2PRINT * 3 + 1]; /* 3 chars per byte */
51 for (i = 0; i < skb->len && i < NUM2PRINT; i++) {
52 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
54 printk(KERN_DEBUG "br2684: skb: %s\n", buf);
57 #define skb_debug(skb) do {} while (0)
60 static unsigned char llc_oui_pid_pad[] =
61 { 0xAA, 0xAA, 0x03, 0x00, 0x80, 0xC2, 0x00, 0x07, 0x00, 0x00 };
65 e_vc = BR2684_ENCAPS_VC,
66 e_llc = BR2684_ENCAPS_LLC,
70 struct atm_vcc *atmvcc;
71 struct net_device *device;
72 /* keep old push,pop functions for chaining */
73 void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb);
74 /* void (*old_pop)(struct atm_vcc *vcc,struct sk_buff *skb); */
75 enum br2684_encaps encaps;
76 struct list_head brvccs;
77 #ifdef CONFIG_ATM_BR2684_IPFILTER
78 struct br2684_filter filter;
79 #endif /* CONFIG_ATM_BR2684_IPFILTER */
80 #ifndef FASTER_VERSION
81 unsigned copies_needed, copies_failed;
82 #endif /* FASTER_VERSION */
86 struct net_device *net_dev;
87 struct list_head br2684_devs;
89 struct list_head brvccs; /* one device <=> one vcc (before xmas) */
90 struct net_device_stats stats;
95 * This lock should be held for writing any time the list of devices or
96 * their attached vcc's could be altered. It should be held for reading
97 * any time these are being queried. Note that we sometimes need to
98 * do read-locking under interrupt context, so write locking must block
99 * the current CPU's interrupts
101 static DEFINE_RWLOCK(devs_lock);
103 static LIST_HEAD(br2684_devs);
105 static inline struct br2684_dev *BRPRIV(const struct net_device *net_dev)
107 return (struct br2684_dev *) net_dev->priv;
110 static inline struct net_device *list_entry_brdev(const struct list_head *le)
112 return list_entry(le, struct br2684_dev, br2684_devs)->net_dev;
115 static inline struct br2684_vcc *BR2684_VCC(const struct atm_vcc *atmvcc)
117 return (struct br2684_vcc *) (atmvcc->user_back);
120 static inline struct br2684_vcc *list_entry_brvcc(const struct list_head *le)
122 return list_entry(le, struct br2684_vcc, brvccs);
125 /* Caller should hold read_lock(&devs_lock) */
126 static struct net_device *br2684_find_dev(const struct br2684_if_spec *s)
128 struct list_head *lh;
129 struct net_device *net_dev;
131 case BR2684_FIND_BYNUM:
132 list_for_each(lh, &br2684_devs) {
133 net_dev = list_entry_brdev(lh);
134 if (BRPRIV(net_dev)->number == s->spec.devnum)
138 case BR2684_FIND_BYIFNAME:
139 list_for_each(lh, &br2684_devs) {
140 net_dev = list_entry_brdev(lh);
141 if (!strncmp(net_dev->name, s->spec.ifname, IFNAMSIZ))
150 * Send a packet out a particular vcc. Not to useful right now, but paves
151 * the way for multiple vcc's per itf. Returns true if we can send,
154 static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
155 struct br2684_vcc *brvcc)
157 struct atm_vcc *atmvcc;
158 #ifdef FASTER_VERSION
159 if (brvcc->encaps == e_llc)
160 memcpy(skb_push(skb, 8), llc_oui_pid_pad, 8);
161 /* last 2 bytes of llc_oui_pid_pad are managed by header routines;
162 yes, you got it: 8 + 2 = sizeof(llc_oui_pid_pad)
165 int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
166 if (skb_headroom(skb) < minheadroom) {
167 struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
168 brvcc->copies_needed++;
171 brvcc->copies_failed++;
176 skb_push(skb, minheadroom);
177 if (brvcc->encaps == e_llc)
178 memcpy(skb->data, llc_oui_pid_pad, 10);
180 memset(skb->data, 0, 2);
181 #endif /* FASTER_VERSION */
184 ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
185 DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev);
186 if (!atm_may_send(atmvcc, skb->truesize)) {
187 /* we free this here for now, because we cannot know in a higher
188 layer whether the skb point it supplied wasn't freed yet.
194 atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc);
195 ATM_SKB(skb)->atm_options = atmvcc->atm_options;
196 brdev->stats.tx_packets++;
197 brdev->stats.tx_bytes += skb->len;
198 atmvcc->send(atmvcc, skb);
202 static inline struct br2684_vcc *pick_outgoing_vcc(struct sk_buff *skb,
203 struct br2684_dev *brdev)
205 return list_empty(&brdev->brvccs) ? NULL :
206 list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */
209 static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
211 struct br2684_dev *brdev = BRPRIV(dev);
212 struct br2684_vcc *brvcc;
214 DPRINTK("br2684_start_xmit, skb->dst=%p\n", skb->dst);
215 read_lock(&devs_lock);
216 brvcc = pick_outgoing_vcc(skb, brdev);
218 DPRINTK("no vcc attached to dev %s\n", dev->name);
219 brdev->stats.tx_errors++;
220 brdev->stats.tx_carrier_errors++;
221 /* netif_stop_queue(dev); */
223 read_unlock(&devs_lock);
226 if (!br2684_xmit_vcc(skb, brdev, brvcc)) {
228 * We should probably use netif_*_queue() here, but that
229 * involves added complication. We need to walk before
232 /* don't free here! this pointer might be no longer valid!
235 brdev->stats.tx_errors++;
236 brdev->stats.tx_fifo_errors++;
238 read_unlock(&devs_lock);
242 static struct net_device_stats *br2684_get_stats(struct net_device *dev)
244 DPRINTK("br2684_get_stats\n");
245 return &BRPRIV(dev)->stats;
248 #ifdef FASTER_VERSION
250 * These mirror eth_header and eth_header_cache. They are not usually
251 * exported for use in modules, so we grab them from net_device
252 * after ether_setup() is done with it. Bit of a hack.
254 static int (*my_eth_header)(struct sk_buff *, struct net_device *,
255 unsigned short, void *, void *, unsigned);
256 static int (*my_eth_header_cache)(struct neighbour *, struct hh_cache *);
259 br2684_header(struct sk_buff *skb, struct net_device *dev,
260 unsigned short type, void *daddr, void *saddr, unsigned len)
263 int t = my_eth_header(skb, dev, type, daddr, saddr, len);
265 pad_before_eth = (u16 *) skb_push(skb, 2);
267 return dev->hard_header_len; /* or return 16; ? */
273 br2684_header_cache(struct neighbour *neigh, struct hh_cache *hh)
275 /* hh_data is 16 bytes long. if encaps is ether-llc we need 24, so
276 xmit will add the additional header part in that case */
277 u16 *pad_before_eth = (u16 *)(hh->hh_data);
278 int t = my_eth_header_cache(neigh, hh);
279 DPRINTK("br2684_header_cache, neigh=%p, hh_cache=%p\n", neigh, hh);
284 hh->hh_len = PADLEN + ETH_HLEN;
290 * This is similar to eth_type_trans, which cannot be used because of
291 * our dev->hard_header_len
293 static inline __be16 br_type_trans(struct sk_buff *skb, struct net_device *dev)
299 if (is_multicast_ether_addr(eth->h_dest)) {
300 if (!compare_ether_addr(eth->h_dest, dev->broadcast))
301 skb->pkt_type = PACKET_BROADCAST;
303 skb->pkt_type = PACKET_MULTICAST;
306 else if (compare_ether_addr(eth->h_dest, dev->dev_addr))
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");