[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / um / drivers / daemon_kern.c
blob30d285b266af5cea7736d98c9c690d41f50f7de7
1 /*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
3 * James Leu (jleu@mindspring.net).
4 * Copyright (C) 2001 by various other people who didn't put their name here.
5 * Licensed under the GPL.
6 */
8 #include "linux/kernel.h"
9 #include "linux/init.h"
10 #include "linux/netdevice.h"
11 #include "linux/etherdevice.h"
12 #include "net_kern.h"
13 #include "net_user.h"
14 #include "daemon.h"
16 struct daemon_init {
17 char *sock_type;
18 char *ctl_sock;
21 void daemon_init(struct net_device *dev, void *data)
23 struct uml_net_private *pri;
24 struct daemon_data *dpri;
25 struct daemon_init *init = data;
27 pri = dev->priv;
28 dpri = (struct daemon_data *) pri->user;
29 dpri->sock_type = init->sock_type;
30 dpri->ctl_sock = init->ctl_sock;
31 dpri->fd = -1;
32 dpri->control = -1;
33 dpri->dev = dev;
35 printk("daemon backend (uml_switch version %d) - %s:%s",
36 SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock);
37 printk("\n");
40 static int daemon_read(int fd, struct sk_buff **skb,
41 struct uml_net_private *lp)
43 *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER);
44 if(*skb == NULL) return(-ENOMEM);
45 return(net_recvfrom(fd, (*skb)->mac.raw,
46 (*skb)->dev->mtu + ETH_HEADER_OTHER));
49 static int daemon_write(int fd, struct sk_buff **skb,
50 struct uml_net_private *lp)
52 return(daemon_user_write(fd, (*skb)->data, (*skb)->len,
53 (struct daemon_data *) &lp->user));
56 static struct net_kern_info daemon_kern_info = {
57 .init = daemon_init,
58 .protocol = eth_protocol,
59 .read = daemon_read,
60 .write = daemon_write,
63 int daemon_setup(char *str, char **mac_out, void *data)
65 struct daemon_init *init = data;
66 char *remain;
68 *init = ((struct daemon_init)
69 { .sock_type = "unix",
70 .ctl_sock = "/tmp/uml.ctl" });
72 remain = split_if_spec(str, mac_out, &init->sock_type, &init->ctl_sock,
73 NULL);
74 if(remain != NULL)
75 printk(KERN_WARNING "daemon_setup : Ignoring data socket "
76 "specification\n");
78 return(1);
81 static struct transport daemon_transport = {
82 .list = LIST_HEAD_INIT(daemon_transport.list),
83 .name = "daemon",
84 .setup = daemon_setup,
85 .user = &daemon_user_info,
86 .kern = &daemon_kern_info,
87 .private_size = sizeof(struct daemon_data),
88 .setup_size = sizeof(struct daemon_init),
91 static int register_daemon(void)
93 register_transport(&daemon_transport);
94 return(1);
97 __initcall(register_daemon);
100 * Overrides for Emacs so that we follow Linus's tabbing style.
101 * Emacs will notice this stuff at the end of the file and automatically
102 * adjust the settings for this buffer only. This must remain at the end
103 * of the file.
104 * ---------------------------------------------------------------------------
105 * Local variables:
106 * c-file-style: "linux"
107 * End: