7 * the kernel file server read packets directly from
8 * its ethernet(s) and did all the protocol processing.
9 * if the incoming packets were 9p (over il/ip), they
10 * were queued for the server processes to operate upon.
12 * in user mode, we have one process per incoming connection
13 * instead, and those processes get just the data, minus
14 * tcp and ip headers, so they just see a stream of 9p messages,
15 * which they then queue for the server processes.
17 * there used to be more queueing (in the kernel), with separate
18 * processes for ethernet input, il input, 9p processing, il output
19 * and ethernet output, and queues connecting them. we now let
20 * the kernel's network queues, protocol stacks and processes do
23 * partly as a result of this, we can now process 9p messages
24 * transported via tcp, exploit multiple x86 processors, and
25 * were able to shed 70% of the file server's source, by line count.
27 * the upshot is that Ether (now Network) is no longer a perfect fit for
28 * the way network i/o is done now. the notion of `connection'
29 * is being introduced to complement it.
32 typedef struct Network Network;
34 /* a network, not necessarily an ethernet */
42 int annfd; /* fd from announce */
45 static Network netif[Maxnets];
47 char *annstrs[Maxnets];
59 if((nctl = listen(net->anndir, net->lisdir)) < 0){
60 fprint(2, "%s: listen %s failed: %r\n", argv0, net->anndir);
63 if((data = accept(nctl, net->lisdir)) < 0){
64 fprint(2, "%s: accept %s failed: %r\n", argv0, net->lisdir);
69 nci = getnetconninfo(net->lisdir, data);
70 addr = nci == nil ? "unknown" : nci->raddr;
71 if(srvchan(data, addr) == nil){
72 fprint(2, "%s: srvchan failed for: %s\n", argv0, addr);
84 for(net = &netif[0]; net < &netif[Maxnets]; net++){
85 if(net->dialstr == nil || *net->anndir == 0)
87 sprint(net->name, "net%di", net->ctlrno);
88 newproc(neti, net, net->name);
97 for (net = netif; net < netif + Maxnets; net++) {
98 net->dialstr = annstrs[net - netif];
99 if(net->dialstr == nil)
101 if((net->annfd = announce(net->dialstr, net->anndir)) < 0){
102 fprint(2, "can't announce %s: %r", net->dialstr);
107 print("netinit: announced on %s\n", net->dialstr);