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>
22 #include <linux/atmbr2684.h>
28 * Define this to use a version of the code which interacts with the higher
29 * layers in a more intellegent way, by always reserving enough space for
30 * our header at the begining of the packet. However, there may still be
31 * some problems with programs like tcpdump. In 2.5 we'll sort out what
32 * we need to do to get this perfect. For now we just will copy the packet
33 * if we need space for the header
35 /* #define FASTER_VERSION */
38 #define DPRINTK(format, args...) printk(KERN_DEBUG "br2684: " format, ##args)
40 #define DPRINTK(format, args...)
44 static void skb_debug(const struct sk_buff *skb)
47 char buf[NUM2PRINT * 3 + 1]; /* 3 chars per byte */
49 for (i = 0; i < skb->len && i < NUM2PRINT; i++) {
50 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
52 printk(KERN_DEBUG "br2684: skb: %s\n", buf);
55 #define skb_debug(skb) do {} while (0)
58 static unsigned char llc_oui_pid_pad[] =
59 { 0xAA, 0xAA, 0x03, 0x00, 0x80, 0xC2, 0x00, 0x07, 0x00, 0x00 };
63 e_vc = BR2684_ENCAPS_VC,
64 e_llc = BR2684_ENCAPS_LLC,
68 struct atm_vcc *atmvcc;
69 struct br2684_dev *brdev;
70 /* keep old push,pop functions for chaining */
71 void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb);
72 /* void (*old_pop)(struct atm_vcc *vcc,struct sk_buff *skb); */
73 enum br2684_encaps encaps;
74 struct list_head brvccs;
75 #ifdef CONFIG_ATM_BR2684_IPFILTER
76 struct br2684_filter filter;
77 #endif /* CONFIG_ATM_BR2684_IPFILTER */
78 #ifndef FASTER_VERSION
79 unsigned copies_needed, copies_failed;
80 #endif /* FASTER_VERSION */
84 struct net_device net_dev;
85 struct list_head br2684_devs;
87 struct list_head brvccs; /* one device <=> one vcc (before xmas) */
88 struct net_device_stats stats;
93 * This lock should be held for writing any time the list of devices or
94 * their attached vcc's could be altered. It should be held for reading
95 * any time these are being queried. Note that we sometimes need to
96 * do read-locking under interrupt context, so write locking must block
97 * the current CPU's interrupts
99 static rwlock_t devs_lock = RW_LOCK_UNLOCKED;
101 static LIST_HEAD(br2684_devs);
103 static inline struct br2684_dev *BRPRIV(const struct net_device *net_dev)
105 return (struct br2684_dev *) ((char *) (net_dev) -
106 (unsigned long) (&((struct br2684_dev *) 0)->net_dev));
109 static inline struct br2684_dev *list_entry_brdev(const struct list_head *le)
111 return list_entry(le, struct br2684_dev, br2684_devs);
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 br2684_dev *br2684_find_dev(const struct br2684_if_spec *s)
127 struct list_head *lh;
128 struct br2684_dev *brdev;
130 case BR2684_FIND_BYNUM:
131 list_for_each(lh, &br2684_devs) {
132 brdev = list_entry_brdev(lh);
133 if (brdev->number == s->spec.devnum)
137 case BR2684_FIND_BYIFNAME:
138 list_for_each(lh, &br2684_devs) {
139 brdev = list_entry_brdev(lh);
140 if (!strncmp(brdev->net_dev.name, s->spec.ifname,
141 sizeof brdev->net_dev.name))
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, &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 unsigned short br_type_trans(struct sk_buff *skb,
294 struct net_device *dev)
298 eth = skb->mac.ethernet;
300 if (*eth->h_dest & 1) {
301 if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0)
302 skb->pkt_type = PACKET_BROADCAST;
304 skb->pkt_type = PACKET_MULTICAST;
307 else if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))
308 skb->pkt_type = PACKET_OTHERHOST;
310 if (ntohs(eth->h_proto) >= 1536)
316 * This is a magic hack to spot IPX packets. Older Novell breaks
317 * the protocol design and runs IPX over 802.3 without an 802.2 LLC
318 * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
319 * won't work for fault tolerant netware but does for the rest.
321 if (*(unsigned short *) rawp == 0xFFFF)
322 return htons(ETH_P_802_3);
327 return htons(ETH_P_802_2);
329 #endif /* FASTER_VERSION */
332 * We remember when the MAC gets set, so we don't override it later with
333 * the ESI of the ATM card of the first VC
335 static int (*my_eth_mac_addr)(struct net_device *, void *);
336 static int br2684_mac_addr(struct net_device *dev, void *p)
338 int err = my_eth_mac_addr(dev, p);
340 BRPRIV(dev)->mac_was_set = 1;
344 #ifdef CONFIG_ATM_BR2684_IPFILTER
345 /* this IOCTL is experimental. */
346 static int br2684_setfilt(struct atm_vcc *atmvcc, unsigned long arg)
348 struct br2684_vcc *brvcc;
349 struct br2684_filter_set fs;
351 if (copy_from_user(&fs, (void *) arg, sizeof fs))
353 if (fs.ifspec.method != BR2684_FIND_BYNOTHING) {
355 * This is really a per-vcc thing, but we can also search
358 struct br2684_dev *brdev;
359 read_lock(&devs_lock);
360 brdev = br2684_find_dev(&fs.ifspec);
361 if (brdev == NULL || list_empty(&brdev->brvccs) ||
362 brdev->brvccs.next != brdev->brvccs.prev) /* >1 VCC */
365 brvcc = list_entry_brvcc(brdev->brvccs.next);
366 read_unlock(&devs_lock);
370 brvcc = BR2684_VCC(atmvcc);
371 memcpy(&brvcc->filter, &fs.filter, sizeof(brvcc->filter));
375 /* Returns 1 if packet should be dropped */
377 packet_fails_filter(u16 type, struct br2684_vcc *brvcc, struct sk_buff *skb)
379 if (brvcc->filter.netmask == 0)
380 return 0; /* no filter in place */
381 if (type == __constant_htons(ETH_P_IP) &&
382 (((struct iphdr *) (skb->data))->daddr & brvcc->filter.
383 netmask) == brvcc->filter.prefix)
385 if (type == __constant_htons(ETH_P_ARP))
387 /* TODO: we should probably filter ARPs too.. don't want to have
388 * them returning values that don't make sense, or is that ok?
392 #endif /* CONFIG_ATM_BR2684_IPFILTER */
394 static void br2684_close_vcc(struct br2684_vcc *brvcc)
396 DPRINTK("removing VCC %p from dev %p\n", brvcc, brvcc->brdev);
397 write_lock_irq(&devs_lock);
398 list_del(&brvcc->brvccs);
399 write_unlock_irq(&devs_lock);
400 brvcc->atmvcc->user_back = NULL; /* what about vcc->recvq ??? */
401 brvcc->old_push(brvcc->atmvcc, NULL); /* pass on the bad news */
406 /* when AAL5 PDU comes in: */
407 static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
409 struct br2684_vcc *brvcc = BR2684_VCC(atmvcc);
410 struct br2684_dev *brdev = brvcc->brdev;
411 int plen = sizeof(llc_oui_pid_pad) + ETH_HLEN;
413 DPRINTK("br2684_push\n");
415 if (skb == NULL) { /* 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(&brdev->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, &brdev->net_dev);
468 #endif /* CONFIG_BR2684_FAST_TRANS */
470 skb_pull(skb, plen - ETH_HLEN);
471 skb->protocol = eth_type_trans(skb, &brdev->net_dev);
472 #endif /* FASTER_VERSION */
473 #ifdef CONFIG_ATM_BR2684_IPFILTER
474 if (packet_fails_filter(skb->protocol, brvcc, skb)) {
475 brdev->stats.rx_dropped++;
479 #endif /* CONFIG_ATM_BR2684_IPFILTER */
480 skb->dev = &brdev->net_dev;
481 ATM_SKB(skb)->vcc = atmvcc; /* needed ? */
482 DPRINTK("received packet's protocol: %x\n", ntohs(skb->protocol));
484 if (!(brdev->net_dev.flags & IFF_UP)) { /* sigh, interface is down */
485 brdev->stats.rx_dropped++;
489 brdev->stats.rx_packets++;
490 brdev->stats.rx_bytes += skb->len;
491 memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
495 static int br2684_regvcc(struct atm_vcc *atmvcc, unsigned long arg)
497 /* assign a vcc to a dev
498 Note: we do not have explicit unassign, but look at _push()
501 struct br2684_vcc *brvcc;
502 struct sk_buff_head copy;
504 struct br2684_dev *brdev;
505 struct atm_backend_br2684 be;
508 if (copy_from_user(&be, (void *) arg, sizeof be)) {
512 write_lock_irq(&devs_lock);
513 brdev = br2684_find_dev(&be.ifspec);
516 "br2684: tried to attach to non-existant device\n");
520 if (atmvcc->push == NULL) {
524 if (!list_empty(&brdev->brvccs)) { /* Only 1 VCC/dev right now */
528 if (be.fcs_in != BR2684_FCSIN_NO || be.fcs_out != BR2684_FCSOUT_NO ||
529 be.fcs_auto || be.has_vpiid || be.send_padding || (be.encaps !=
530 BR2684_ENCAPS_VC && be.encaps != BR2684_ENCAPS_LLC) ||
535 brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
540 memset(brvcc, 0, sizeof(struct br2684_vcc));
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(brdev->net_dev.dev_addr, esi,
547 brdev->net_dev.addr_len);
549 brdev->net_dev.dev_addr[2] = 1;
551 list_add(&brvcc->brvccs, &brdev->brvccs);
552 write_unlock_irq(&devs_lock);
553 brvcc->brdev = brdev;
554 brvcc->atmvcc = atmvcc;
555 atmvcc->user_back = brvcc;
556 brvcc->encaps = (enum br2684_encaps) be.encaps;
557 brvcc->old_push = atmvcc->push;
559 atmvcc->push = br2684_push;
560 skb_queue_head_init(©);
561 skb_migrate(&atmvcc->sk->receive_queue, ©);
562 while ((skb = skb_dequeue(©))) {
563 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
564 BRPRIV(skb->dev)->stats.rx_packets--;
565 br2684_push(atmvcc, skb);
569 write_unlock_irq(&devs_lock);
574 static int br2684_create(unsigned long arg)
577 struct br2684_dev *brdev;
578 struct atm_newif_br2684 ni;
580 DPRINTK("br2684_create\n");
582 * We track module use by vcc's NOT the devices they're on. We're
583 * protected here against module death by the kernel_lock, but if
584 * we need to sleep we should make sure that the module doesn't
585 * disappear under us.
588 if (copy_from_user(&ni, (void *) arg, sizeof ni)) {
592 if (ni.media != BR2684_MEDIA_ETHERNET || ni.mtu != 1500) {
596 if ((brdev = kmalloc(sizeof(struct br2684_dev), GFP_KERNEL)) == NULL) {
600 memset(brdev, 0, sizeof(struct br2684_dev));
601 INIT_LIST_HEAD(&brdev->brvccs);
603 write_lock_irq(&devs_lock);
604 brdev->number = list_empty(&br2684_devs) ? 1 :
605 list_entry_brdev(br2684_devs.prev)->number + 1;
606 list_add_tail(&brdev->br2684_devs, &br2684_devs);
607 write_unlock_irq(&devs_lock);
609 if (ni.ifname[0] != '\0') {
610 memcpy(brdev->net_dev.name, ni.ifname,
611 sizeof(brdev->net_dev.name));
612 brdev->net_dev.name[sizeof(brdev->net_dev.name) - 1] = '\0';
614 sprintf(brdev->net_dev.name, "nas%d", brdev->number);
615 DPRINTK("registered netdev %s\n", brdev->net_dev.name);
616 ether_setup(&brdev->net_dev);
617 brdev->mac_was_set = 0;
618 #ifdef FASTER_VERSION
619 my_eth_header = brdev->net_dev.hard_header;
620 brdev->net_dev.hard_header = br2684_header;
621 my_eth_header_cache = brdev->net_dev.hard_header_cache;
622 brdev->net_dev.hard_header_cache = br2684_header_cache;
623 brdev->net_dev.hard_header_len = sizeof(llc_oui_pid_pad) + ETH_HLEN; /* 10 + 14 */
625 my_eth_mac_addr = brdev->net_dev.set_mac_address;
626 brdev->net_dev.set_mac_address = br2684_mac_addr;
627 brdev->net_dev.hard_start_xmit = br2684_start_xmit;
628 brdev->net_dev.get_stats = br2684_get_stats;
630 /* open, stop, do_ioctl ? */
631 err = register_netdev(&brdev->net_dev);
634 printk(KERN_ERR "br2684_create: register_netdev failed\n");
635 write_lock_irq(&devs_lock);
636 list_del(&brdev->br2684_devs);
637 write_unlock_irq(&devs_lock);
645 * This handles ioctls actually performed on our vcc - we must return
646 * -ENOIOCTLCMD for any unrecognized ioctl
648 static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd,
654 case ATM_NEWBACKENDIF: {
657 err = get_user(b, (atm_backend_t *) arg);
661 if (b != ATM_BACKEND_BR2684)
663 if (!capable(CAP_NET_ADMIN))
665 if (cmd == ATM_SETBACKEND)
666 return br2684_regvcc(atmvcc, arg);
668 return br2684_create(arg);
670 #ifdef CONFIG_ATM_BR2684_IPFILTER
672 if (atmvcc->push != br2684_push)
674 if (!capable(CAP_NET_ADMIN))
677 err = br2684_setfilt(atmvcc, arg);
680 #endif /* CONFIG_ATM_BR2684_IPFILTER */
685 #ifdef CONFIG_PROC_FS
686 /* Never put more than 256 bytes in at once */
687 static int br2684_proc_engine(loff_t pos, char *buf)
689 struct list_head *lhd, *lhc;
690 struct br2684_dev *brdev;
691 struct br2684_vcc *brvcc;
692 list_for_each(lhd, &br2684_devs) {
693 brdev = list_entry_brdev(lhd);
695 return sprintf(buf, "dev %.16s: num=%d, mac=%02X:%02X:"
696 "%02X:%02X:%02X:%02X (%s)\n", brdev->net_dev.name,
698 brdev->net_dev.dev_addr[0],
699 brdev->net_dev.dev_addr[1],
700 brdev->net_dev.dev_addr[2],
701 brdev->net_dev.dev_addr[3],
702 brdev->net_dev.dev_addr[4],
703 brdev->net_dev.dev_addr[5],
704 brdev->mac_was_set ? "set" : "auto");
705 list_for_each(lhc, &brdev->brvccs) {
706 brvcc = list_entry_brvcc(lhc);
708 return sprintf(buf, " vcc %d.%d.%d: encaps=%s"
709 #ifndef FASTER_VERSION
710 ", failed copies %u/%u"
711 #endif /* FASTER_VERSION */
712 "\n", brvcc->atmvcc->dev->number,
713 brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
714 (brvcc->encaps == e_llc) ? "LLC" : "VC"
715 #ifndef FASTER_VERSION
716 , brvcc->copies_failed
717 , brvcc->copies_needed
718 #endif /* FASTER_VERSION */
720 #ifdef CONFIG_ATM_BR2684_IPFILTER
721 #define b1(var, byte) ((u8 *) &brvcc->filter.var)[byte]
722 #define bs(var) b1(var, 0), b1(var, 1), b1(var, 2), b1(var, 3)
723 if (brvcc->filter.netmask != 0 && pos-- == 0)
724 return sprintf(buf, " filter=%d.%d.%d.%d/"
725 "%d.%d.%d.%d\n", bs(prefix), bs(netmask));
728 #endif /* CONFIG_ATM_BR2684_IPFILTER */
734 static ssize_t br2684_proc_read(struct file *file, char *buf, size_t count,
738 int len = 0, x, left;
741 page = get_free_page(GFP_KERNEL);
744 left = PAGE_SIZE - 256;
747 read_lock(&devs_lock);
749 x = br2684_proc_engine(n, &((char *) page)[len]);
754 * This should only happen if the user passed in
755 * a "count" too small for even one line
768 read_unlock(&devs_lock);
770 if (len > 0 && copy_to_user(buf, (char *) page, len))
776 static struct file_operations br2684_proc_operations = {
777 read: br2684_proc_read,
780 extern struct proc_dir_entry *atm_proc_root; /* from proc.c */
781 #endif /* CONFIG_PROC_FS */
783 /* the following avoids some spurious warnings from the compiler */
784 #define UNUSED __attribute__((unused))
786 static int __init UNUSED br2684_init(void)
788 #ifdef CONFIG_PROC_FS
789 struct proc_dir_entry *p;
790 if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
792 p->proc_fops = &br2684_proc_operations;
793 #endif /* CONFIG_PROC_FS */
794 br2684_ioctl_set(br2684_ioctl);
798 static void __exit UNUSED br2684_exit(void)
800 struct br2684_dev *brdev;
801 br2684_ioctl_set(NULL);
802 #ifdef CONFIG_PROC_FS
803 remove_proc_entry("br2684", atm_proc_root);
804 #endif /* CONFIG_PROC_FS */
805 while (!list_empty(&br2684_devs)) {
806 brdev = list_entry_brdev(br2684_devs.next);
807 unregister_netdev(&brdev->net_dev);
808 list_del(&brdev->br2684_devs);
813 module_init(br2684_init);
814 module_exit(br2684_exit);
816 MODULE_AUTHOR("Marcell GAL");
817 MODULE_DESCRIPTION("RFC2684 bridged protocols over ATM/AAL5");
818 MODULE_LICENSE("GPL");