2 * An implementation of the Acorn Econet and AUN protocols.
3 * Philip Blundell <philb@gnu.org>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
12 #include <linux/config.h>
13 #include <linux/module.h>
15 #include <linux/types.h>
16 #include <linux/kernel.h>
17 #include <linux/sched.h>
18 #include <linux/string.h>
20 #include <linux/socket.h>
21 #include <linux/sockios.h>
23 #include <linux/errno.h>
24 #include <linux/interrupt.h>
25 #include <linux/if_ether.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/route.h>
29 #include <linux/inet.h>
30 #include <linux/etherdevice.h>
31 #include <linux/if_arp.h>
32 #include <linux/wireless.h>
33 #include <linux/skbuff.h>
35 #include <net/inet_common.h>
36 #include <linux/stat.h>
37 #include <linux/init.h>
38 #include <linux/if_ec.h>
41 #include <linux/spinlock.h>
43 #include <asm/uaccess.h>
44 #include <asm/system.h>
45 #include <asm/bitops.h>
47 static struct proto_ops econet_ops;
48 static struct hlist_head econet_sklist;
49 static rwlock_t econet_lock = RW_LOCK_UNLOCKED;
51 /* Since there are only 256 possible network numbers (or fewer, depends
52 how you count) it makes sense to use a simple lookup table. */
53 static struct net_device *net2dev_map[256];
55 #define EC_PORT_IP 0xd2
57 #ifdef CONFIG_ECONET_AUNUDP
58 static spinlock_t aun_queue_lock;
59 static struct socket *udpsock;
60 #define AUN_PORT 0x8000
65 unsigned char code; /* AUN magic protocol byte */
72 static unsigned long aun_seq;
74 /* Queue of packets waiting to be transmitted. */
75 static struct sk_buff_head aun_queue;
76 static struct timer_list ab_cleanup_timer;
78 #endif /* CONFIG_ECONET_AUNUDP */
80 /* Per-packet information */
83 struct sockaddr_ec sec;
84 unsigned long cookie; /* Supplied by user. */
85 #ifdef CONFIG_ECONET_AUNUDP
87 unsigned long seq; /* Sequencing */
88 unsigned long timeout; /* Timeout */
89 unsigned long start; /* jiffies */
91 #ifdef CONFIG_ECONET_NATIVE
92 void (*sent)(struct sk_buff *, int result);
96 static void econet_remove_socket(struct hlist_head *list, struct sock *sk)
98 write_lock_bh(&econet_lock);
100 write_unlock_bh(&econet_lock);
103 static void econet_insert_socket(struct hlist_head *list, struct sock *sk)
105 write_lock_bh(&econet_lock);
106 sk_add_node(sk, list);
107 write_unlock_bh(&econet_lock);
111 * Pull a packet from our receive queue and hand it to the user.
112 * If necessary we block.
115 static int econet_recvmsg(struct kiocb *iocb, struct socket *sock,
116 struct msghdr *msg, size_t len, int flags)
118 struct sock *sk = sock->sk;
123 msg->msg_namelen = sizeof(struct sockaddr_ec);
126 * Call the generic datagram receiver. This handles all sorts
127 * of horrible races and re-entrancy so we can forget about it
128 * in the protocol layers.
130 * Now it will return ENETDOWN, if device have just gone down,
131 * but then it will block.
134 skb=skb_recv_datagram(sk,flags,flags&MSG_DONTWAIT,&err);
137 * An error occurred so return it. Because skb_recv_datagram()
138 * handles the blocking we don't see and worry about blocking
146 * You lose any data beyond the buffer you gave. If it worries a
147 * user program they can ask the device for its MTU anyway.
154 msg->msg_flags|=MSG_TRUNC;
157 /* We can't use skb_copy_datagram here */
158 err = memcpy_toiovec(msg->msg_iov, skb->data, copied);
161 sk->sk_stamp = skb->stamp;
164 memcpy(msg->msg_name, skb->cb, msg->msg_namelen);
167 * Free or return the buffer as appropriate. Again this
168 * hides all the races and re-entrancy issues from us.
173 skb_free_datagram(sk, skb);
179 * Bind an Econet socket.
182 static int econet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
184 struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr;
185 struct sock *sk=sock->sk;
186 struct econet_opt *eo = ec_sk(sk);
192 if (addr_len < sizeof(struct sockaddr_ec) ||
193 sec->sec_family != AF_ECONET)
197 eo->port = sec->port;
198 eo->station = sec->addr.station;
199 eo->net = sec->addr.net;
205 * Queue a transmit result for the user to be told about.
208 static void tx_result(struct sock *sk, unsigned long cookie, int result)
210 struct sk_buff *skb = alloc_skb(0, GFP_ATOMIC);
212 struct sockaddr_ec *sec;
216 printk(KERN_DEBUG "ec: memory squeeze, transmit result dropped.\n");
220 eb = (struct ec_cb *)&skb->cb;
221 sec = (struct sockaddr_ec *)&eb->sec;
222 memset(sec, 0, sizeof(struct sockaddr_ec));
223 sec->cookie = cookie;
224 sec->type = ECTYPE_TRANSMIT_STATUS | result;
225 sec->sec_family = AF_ECONET;
227 if (sock_queue_rcv_skb(sk, skb) < 0)
231 #ifdef CONFIG_ECONET_NATIVE
233 * Called by the Econet hardware driver when a packet transmit
234 * has completed. Tell the user.
237 static void ec_tx_done(struct sk_buff *skb, int result)
239 struct ec_cb *eb = (struct ec_cb *)&skb->cb;
240 tx_result(skb->sk, eb->cookie, result);
245 * Send a packet. We have to work out which device it's going out on
246 * and hence whether to use real Econet or the UDP emulation.
249 static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
250 struct msghdr *msg, size_t len)
252 struct sock *sk = sock->sk;
253 struct sockaddr_ec *saddr=(struct sockaddr_ec *)msg->msg_name;
254 struct net_device *dev;
257 unsigned char port, cb;
260 #ifdef CONFIG_ECONET_NATIVE
261 unsigned short proto = 0;
263 #ifdef CONFIG_ECONET_AUNUDP
264 struct msghdr udpmsg;
265 struct iovec iov[msg->msg_iovlen+1];
267 struct sockaddr_in udpdest;
268 __kernel_size_t size;
277 if (msg->msg_flags&~MSG_DONTWAIT)
281 * Get and verify the address.
285 struct econet_opt *eo = ec_sk(sk);
287 addr.station = eo->station;
292 if (msg->msg_namelen < sizeof(struct sockaddr_ec))
294 addr.station = saddr->addr.station;
295 addr.net = saddr->addr.net;
300 /* Look for a device with the right network number. */
301 dev = net2dev_map[addr.net];
303 /* If not directly reachable, use some default */
306 dev = net2dev_map[0];
307 /* No interfaces at all? */
312 if (len + 15 > dev->mtu)
315 if (dev->type == ARPHRD_ECONET)
317 /* Real hardware Econet. We're not worthy etc. */
318 #ifdef CONFIG_ECONET_NATIVE
321 skb = sock_alloc_send_skb(sk, len+LL_RESERVED_SPACE(dev),
322 msg->msg_flags & MSG_DONTWAIT, &err);
326 skb_reserve(skb, LL_RESERVED_SPACE(dev));
327 skb->nh.raw = skb->data;
329 eb = (struct ec_cb *)&skb->cb;
331 /* BUG: saddr may be NULL */
332 eb->cookie = saddr->cookie;
334 eb->sent = ec_tx_done;
336 if (dev->hard_header) {
338 struct ec_framehdr *fh;
340 res = dev->hard_header(skb, dev, ntohs(proto),
342 /* Poke in our control byte and
343 port number. Hack, hack. */
344 fh = (struct ec_framehdr *)(skb->data);
347 if (sock->type != SOCK_DGRAM) {
348 skb->tail = skb->data;
354 /* Copy the data. Returns -EFAULT on error */
355 err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
356 skb->protocol = proto;
358 skb->priority = sk->sk_priority;
363 if (!(dev->flags & IFF_UP))
385 #ifdef CONFIG_ECONET_AUNUDP
386 /* AUN virtual Econet. */
389 return -ENETDOWN; /* No socket - can't send */
391 /* Make up a UDP datagram and hand it off to some higher intellect. */
393 memset(&udpdest, 0, sizeof(udpdest));
394 udpdest.sin_family = AF_INET;
395 udpdest.sin_port = htons(AUN_PORT);
397 /* At the moment we use the stupid Acorn scheme of Econet address
398 y.x maps to IP a.b.c.x. This should be replaced with something
399 more flexible and more aware of subnet masks. */
401 struct in_device *idev = in_dev_get(dev);
402 unsigned long network = 0;
404 read_lock(&idev->lock);
406 network = ntohl(idev->ifa_list->ifa_address) &
407 0xffffff00; /* !!! */
408 read_unlock(&idev->lock);
411 udpdest.sin_addr.s_addr = htonl(network | addr.station);
416 ah.code = 2; /* magic */
419 /* tack our header on the front of the iovec */
420 size = sizeof(struct aunhdr);
421 iov[0].iov_base = (void *)&ah;
422 iov[0].iov_len = size;
423 for (i = 0; i < msg->msg_iovlen; i++) {
424 void *base = msg->msg_iov[i].iov_base;
425 size_t len = msg->msg_iov[i].iov_len;
426 /* Check it now since we switch to KERNEL_DS later. */
427 if ((err = verify_area(VERIFY_READ, base, len)) < 0)
429 iov[i+1].iov_base = base;
430 iov[i+1].iov_len = len;
434 /* Get a skbuff (no data, just holds our cb information) */
435 if ((skb = sock_alloc_send_skb(sk, 0,
436 msg->msg_flags & MSG_DONTWAIT, &err)) == NULL)
439 eb = (struct ec_cb *)&skb->cb;
441 eb->cookie = saddr->cookie;
442 eb->timeout = (5*HZ);
445 eb->seq = (aun_seq++);
448 skb_queue_tail(&aun_queue, skb);
450 udpmsg.msg_name = (void *)&udpdest;
451 udpmsg.msg_namelen = sizeof(udpdest);
452 udpmsg.msg_iov = &iov[0];
453 udpmsg.msg_iovlen = msg->msg_iovlen + 1;
454 udpmsg.msg_control = NULL;
455 udpmsg.msg_controllen = 0;
458 oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */
459 err = sock_sendmsg(udpsock, &udpmsg, size);
468 * Look up the address of a socket.
471 static int econet_getname(struct socket *sock, struct sockaddr *uaddr,
472 int *uaddr_len, int peer)
474 struct sock *sk = sock->sk;
475 struct econet_opt *eo = ec_sk(sk);
476 struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr;
481 sec->sec_family = AF_ECONET;
482 sec->port = eo->port;
483 sec->addr.station = eo->station;
484 sec->addr.net = eo->net;
486 *uaddr_len = sizeof(*sec);
490 static void econet_destroy_timer(unsigned long data)
492 struct sock *sk=(struct sock *)data;
494 if (!atomic_read(&sk->sk_wmem_alloc) &&
495 !atomic_read(&sk->sk_rmem_alloc)) {
500 sk->sk_timer.expires = jiffies + 10 * HZ;
501 add_timer(&sk->sk_timer);
502 printk(KERN_DEBUG "econet socket destroy delayed\n");
506 * Close an econet socket.
509 static int econet_release(struct socket *sock)
511 struct sock *sk = sock->sk;
516 econet_remove_socket(&econet_sklist, sk);
519 * Now the socket is dead. No more input will appear.
522 sk->sk_state_change(sk); /* It is useless. Just for sanity. */
525 sk->sk_socket = NULL;
526 sock_set_flag(sk, SOCK_DEAD);
530 skb_queue_purge(&sk->sk_receive_queue);
532 if (atomic_read(&sk->sk_rmem_alloc) ||
533 atomic_read(&sk->sk_wmem_alloc)) {
534 sk->sk_timer.data = (unsigned long)sk;
535 sk->sk_timer.expires = jiffies + HZ;
536 sk->sk_timer.function = econet_destroy_timer;
537 add_timer(&sk->sk_timer);
546 * Create an Econet socket
549 static int econet_create(struct socket *sock, int protocol)
552 struct econet_opt *eo;
555 /* Econet only provides datagram services. */
556 if (sock->type != SOCK_DGRAM)
557 return -ESOCKTNOSUPPORT;
559 sock->state = SS_UNCONNECTED;
562 sk = sk_alloc(PF_ECONET, GFP_KERNEL, 1, NULL);
567 sock->ops = &econet_ops;
568 sock_init_data(sock,sk);
569 sk_set_owner(sk, THIS_MODULE);
571 eo = sk->sk_protinfo = kmalloc(sizeof(*eo), GFP_KERNEL);
574 memset(eo, 0, sizeof(*eo));
576 sk->sk_family = PF_ECONET;
579 econet_insert_socket(&econet_sklist, sk);
589 * Handle Econet specific ioctls
592 static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void *arg)
595 struct ec_device *edev;
596 struct net_device *dev;
597 struct sockaddr_ec *sec;
600 * Fetch the caller's info block into kernel space
603 if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
606 if ((dev = dev_get_by_name(ifr.ifr_name)) == NULL)
609 sec = (struct sockaddr_ec *)&ifr.ifr_addr;
617 /* Magic up a new one. */
618 edev = kmalloc(sizeof(struct ec_device), GFP_KERNEL);
620 printk("af_ec: memory squeeze.\n");
624 memset(edev, 0, sizeof(struct ec_device));
628 net2dev_map[edev->net] = NULL;
629 edev->station = sec->addr.station;
630 edev->net = sec->addr.net;
631 net2dev_map[sec->addr.net] = dev;
633 net2dev_map[0] = dev;
644 memset(sec, 0, sizeof(struct sockaddr_ec));
645 sec->addr.station = edev->station;
646 sec->addr.net = edev->net;
647 sec->sec_family = AF_ECONET;
649 if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
659 * Handle generic ioctls
662 static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
664 struct sock *sk = sock->sk;
668 return sock_get_timestamp(sk,(struct timeval *)arg);
672 return ec_dev_ioctl(sock, cmd, (void *)arg);
676 return dev_ioctl(cmd,(void *) arg);
682 static struct net_proto_family econet_family_ops = {
684 .create = econet_create,
685 .owner = THIS_MODULE,
688 static struct proto_ops SOCKOPS_WRAPPED(econet_ops) = {
690 .owner = THIS_MODULE,
691 .release = econet_release,
693 .connect = sock_no_connect,
694 .socketpair = sock_no_socketpair,
695 .accept = sock_no_accept,
696 .getname = econet_getname,
697 .poll = datagram_poll,
698 .ioctl = econet_ioctl,
699 .listen = sock_no_listen,
700 .shutdown = sock_no_shutdown,
701 .setsockopt = sock_no_setsockopt,
702 .getsockopt = sock_no_getsockopt,
703 .sendmsg = econet_sendmsg,
704 .recvmsg = econet_recvmsg,
705 .mmap = sock_no_mmap,
706 .sendpage = sock_no_sendpage,
709 #include <linux/smp_lock.h>
710 SOCKOPS_WRAP(econet, PF_ECONET);
713 * Find the listening socket, if any, for the given data.
716 static struct sock *ec_listening_socket(unsigned char port, unsigned char
717 station, unsigned char net)
720 struct hlist_node *node;
722 sk_for_each(sk, node, &econet_sklist) {
723 struct econet_opt *opt = ec_sk(sk);
724 if ((opt->port == port || opt->port == 0) &&
725 (opt->station == station || opt->station == 0) &&
726 (opt->net == net || opt->net == 0))
735 * Queue a received packet for a socket.
738 static int ec_queue_packet(struct sock *sk, struct sk_buff *skb,
739 unsigned char stn, unsigned char net,
740 unsigned char cb, unsigned char port)
742 struct ec_cb *eb = (struct ec_cb *)&skb->cb;
743 struct sockaddr_ec *sec = (struct sockaddr_ec *)&eb->sec;
745 memset(sec, 0, sizeof(struct sockaddr_ec));
746 sec->sec_family = AF_ECONET;
747 sec->type = ECTYPE_PACKET_RECEIVED;
751 sec->addr.station = stn;
753 return sock_queue_rcv_skb(sk, skb);
756 #ifdef CONFIG_ECONET_AUNUDP
759 * Send an AUN protocol response.
762 static void aun_send_response(__u32 addr, unsigned long seq, int code, int cb)
764 struct sockaddr_in sin;
767 struct msghdr udpmsg;
771 memset(&sin, 0, sizeof(sin));
772 sin.sin_family = AF_INET;
773 sin.sin_port = htons(AUN_PORT);
774 sin.sin_addr.s_addr = addr;
782 iov.iov_base = (void *)&ah;
783 iov.iov_len = sizeof(ah);
785 udpmsg.msg_name = (void *)&sin;
786 udpmsg.msg_namelen = sizeof(sin);
787 udpmsg.msg_iov = &iov;
788 udpmsg.msg_iovlen = 1;
789 udpmsg.msg_control = NULL;
790 udpmsg.msg_controllen = 0;
793 oldfs = get_fs(); set_fs(KERNEL_DS);
794 err = sock_sendmsg(udpsock, &udpmsg, sizeof(ah));
800 * Handle incoming AUN packets. Work out if anybody wants them,
801 * and send positive or negative acknowledgements as appropriate.
804 static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len)
806 struct iphdr *ip = skb->nh.iph;
807 unsigned char stn = ntohl(ip->saddr) & 0xff;
809 struct sk_buff *newskb;
810 struct ec_device *edev = skb->dev->ec_ptr;
815 if ((sk = ec_listening_socket(ah->port, stn, edev->net)) == NULL)
816 goto bad; /* Nobody wants it */
818 newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15,
822 printk(KERN_DEBUG "AUN: memory squeeze, dropping packet.\n");
823 /* Send nack and hope sender tries again */
827 memcpy(skb_put(newskb, len - sizeof(struct aunhdr)), (void *)(ah+1),
828 len - sizeof(struct aunhdr));
830 if (ec_queue_packet(sk, newskb, stn, edev->net, ah->cb, ah->port))
832 /* Socket is bankrupt. */
837 aun_send_response(ip->saddr, ah->handle, 3, 0);
841 aun_send_response(ip->saddr, ah->handle, 4, 0);
845 * Handle incoming AUN transmit acknowledgements. If the sequence
846 * number matches something in our backlog then kill it and tell
847 * the user. If the remote took too long to reply then we may have
848 * dropped the packet already.
851 static void aun_tx_ack(unsigned long seq, int result)
857 spin_lock_irqsave(&aun_queue_lock, flags);
858 skb = skb_peek(&aun_queue);
859 while (skb && skb != (struct sk_buff *)&aun_queue)
861 struct sk_buff *newskb = skb->next;
862 eb = (struct ec_cb *)&skb->cb;
868 spin_unlock_irqrestore(&aun_queue_lock, flags);
869 printk(KERN_DEBUG "AUN: unknown sequence %ld\n", seq);
873 tx_result(skb->sk, eb->cookie, result);
875 spin_unlock_irqrestore(&aun_queue_lock, flags);
880 * Deal with received AUN frames - sort out what type of thing it is
881 * and hand it to the right function.
884 static void aun_data_available(struct sock *sk, int slen)
893 while ((skb = skb_recv_datagram(sk, 0, 1, &err)) == NULL) {
894 if (err == -EAGAIN) {
895 printk(KERN_ERR "AUN: no data available?!");
898 printk(KERN_DEBUG "AUN: recvfrom() error %d\n", -err);
901 data = skb->h.raw + sizeof(struct udphdr);
902 ah = (struct aunhdr *)data;
903 len = skb->len - sizeof(struct udphdr);
909 aun_incoming(skb, ah, len);
912 aun_tx_ack(ah->handle, ECTYPE_TRANSMIT_OK);
915 aun_tx_ack(ah->handle, ECTYPE_TRANSMIT_NOT_LISTENING);
918 /* This isn't quite right yet. */
920 aun_send_response(ip->saddr, ah->handle, 6, ah->cb);
924 printk(KERN_DEBUG "unknown AUN packet (type %d)\n", data[0]);
927 skb_free_datagram(sk, skb);
931 * Called by the timer to manage the AUN transmit queue. If a packet
932 * was sent to a dead or nonexistent host then we will never get an
933 * acknowledgement back. After a few seconds we need to spot this and
937 static void ab_cleanup(unsigned long h)
942 spin_lock_irqsave(&aun_queue_lock, flags);
943 skb = skb_peek(&aun_queue);
944 while (skb && skb != (struct sk_buff *)&aun_queue)
946 struct sk_buff *newskb = skb->next;
947 struct ec_cb *eb = (struct ec_cb *)&skb->cb;
948 if ((jiffies - eb->start) > eb->timeout)
950 tx_result(skb->sk, eb->cookie,
951 ECTYPE_TRANSMIT_NOT_PRESENT);
957 spin_unlock_irqrestore(&aun_queue_lock, flags);
959 mod_timer(&ab_cleanup_timer, jiffies + (HZ*2));
962 static int __init aun_udp_initialise(void)
965 struct sockaddr_in sin;
967 skb_queue_head_init(&aun_queue);
968 spin_lock_init(&aun_queue_lock);
969 init_timer(&ab_cleanup_timer);
970 ab_cleanup_timer.expires = jiffies + (HZ*2);
971 ab_cleanup_timer.function = ab_cleanup;
972 add_timer(&ab_cleanup_timer);
974 memset(&sin, 0, sizeof(sin));
975 sin.sin_port = htons(AUN_PORT);
977 /* We can count ourselves lucky Acorn machines are too dim to
979 if ((error = sock_create_kern(PF_INET, SOCK_DGRAM, 0, &udpsock)) < 0)
981 printk("AUN: socket error %d\n", -error);
985 udpsock->sk->sk_reuse = 1;
986 udpsock->sk->sk_allocation = GFP_ATOMIC; /* we're going to call it
989 error = udpsock->ops->bind(udpsock, (struct sockaddr *)&sin,
993 printk("AUN: bind error %d\n", -error);
997 udpsock->sk->sk_data_ready = aun_data_available;
1002 sock_release(udpsock);
1008 #ifdef CONFIG_ECONET_NATIVE
1011 * Receive an Econet frame from a device.
1014 static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
1016 struct ec_framehdr *hdr;
1018 struct ec_device *edev = dev->ec_ptr;
1020 if (skb->pkt_type == PACKET_OTHERHOST)
1026 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
1029 if (!pskb_may_pull(skb, sizeof(struct ec_framehdr)))
1032 hdr = (struct ec_framehdr *) skb->data;
1034 /* First check for encapsulated IP */
1035 if (hdr->port == EC_PORT_IP) {
1036 skb->protocol = htons(ETH_P_IP);
1037 skb_pull(skb, sizeof(struct ec_framehdr));
1042 sk = ec_listening_socket(hdr->port, hdr->src_stn, hdr->src_net);
1046 if (ec_queue_packet(sk, skb, edev->net, hdr->src_stn, hdr->cb,
1057 static struct packet_type econet_packet_type = {
1058 .type = __constant_htons(ETH_P_ECONET),
1062 static void econet_hw_initialise(void)
1064 dev_add_pack(&econet_packet_type);
1069 static int econet_notifier(struct notifier_block *this, unsigned long msg, void *data)
1071 struct net_device *dev = (struct net_device *)data;
1072 struct ec_device *edev;
1075 case NETDEV_UNREGISTER:
1076 /* A device has gone down - kill any data we hold for it. */
1080 if (net2dev_map[0] == dev)
1082 net2dev_map[edev->net] = NULL;
1092 static struct notifier_block econet_netdev_notifier = {
1093 .notifier_call =econet_notifier,
1096 static void __exit econet_proto_exit(void)
1098 #ifdef CONFIG_ECONET_AUNUDP
1099 del_timer(&ab_cleanup_timer);
1101 sock_release(udpsock);
1103 unregister_netdevice_notifier(&econet_netdev_notifier);
1104 sock_unregister(econet_family_ops.family);
1107 static int __init econet_proto_init(void)
1109 sock_register(&econet_family_ops);
1110 #ifdef CONFIG_ECONET_AUNUDP
1111 spin_lock_init(&aun_queue_lock);
1112 aun_udp_initialise();
1114 #ifdef CONFIG_ECONET_NATIVE
1115 econet_hw_initialise();
1117 register_netdevice_notifier(&econet_netdev_notifier);
1121 module_init(econet_proto_init);
1122 module_exit(econet_proto_exit);
1124 MODULE_LICENSE("GPL");
1125 MODULE_ALIAS_NETPROTO(PF_ECONET);