From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 20 Jul 1998 20:18:06 -0400 From: Russ Cox rsc@eecs.harvard.edu Subject: [9fans] Multiple ethernet support for Plan 9 Topicbox-Message-UUID: 7b4522c4-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19980721001806.e56p9jE4V4T8RoQG420OjodH0uztHql__--8oJRr80M@z> A couple months ago, I needed multiple ethernet support for a project I was working on, and asked David Butler how things were going. He said he had changed too much in his own kernels to make extracting just the multiple ethernet support easy for him, which is why he hadn't posted it to the list. He sent me the various files that were necessary for the change, and I've compiled boddles and documentation on what the changes actually are. The boddles are at ftp://ftp.dbSystems.com/pub/plan9/multi_ether/ You'll need (pc port boot)^.boddle, which are applied in the obvious places under /sys/src/9. You'll also need ip.boddle, which is applied to /sys/src/cmd/ip. It alerts various programs to the fact that the main ethernet device is now #l0/ether0 instead of #l/ether. Further, you'll want to grab ipconfig.man and lance.man and install them as /sys/man/8/ipconfig and /sys/man/3/lance. You probably don't want to just blindly install the new ip programs into /bin/ip. Instead, install them into /bin/nip and include the following in termrc and cpurc, at least until you're sure the new kernel works for you: if(test -d '#l/ether0') { echo 'Using multiple-ethernet binaries...' bind /$objtype/bin/nip /$objtype/bin/ip bind /$objtype/bin/nip/cs /$objtype/bin/ndb/cs } In addition to the boddles, you'll have to change line 795 (or thereabouts) in /sys/src/cmd/ndb/cs.c to be sprint(buf, "%s/ether0", mntpt); changing ether into ether0. A brief overview of the changes is attached. The definitive reference, however, is the boddles. If you have problems installing the changes or getting it to work, it's probably best to mail both me and David, and one of us will probably be able to help you. Enjoy. Russ --- boddle overview: what's being changed --- --- changes are by gdb unless otherwise noted --- ARP 9/port/devarp.c Sets up an arpq for each different ethernet device, instead of having one giant arpq. Also changes sleaze (see stip.c description) associated with passing interface number in ethernet headers between layers. Now the interface number is in d[4] instead of s[0], which speeds up access because it is now word-aligned. grep sleaze /sys/src/9/port/*.c to understand this paragraph. 9/port/stip.c Changes sleaze. See comments for devarp.c cmd/ip/arpd.c Adds an optional ipaddr argument, in case the ip address is not clear from the network db. Updated to deal with new devarp that splits the arp queues (push arpd N). 9/port/ipdat.h remove Queue* arpq. Changes Nipd from 34 to 8; probably not reasonable if you're running pppserver. ETHER 9/pc/devether.c Changes from a global struct Ctlr *softctrl; to struct Ctlr softctrl[NCARDS], and updates all references to include subscript. Allocates a separate Qinfo structure for each Ctlr, so that they can be named "etherN". Reduces NCARDTYPES from 32 to 8, probably to save some space. 9/port/devlance.c Just fix ether -> ether0 9/pc/ether.h Changes intr routine to take (Ureg*, void*) instead of (Ctlr*), so that it can be hooked directly with setvec. Drops one level of indirection. Ups transmit/receive buffers to 32 each, from 16 and 4 respectively. Changes types/card (Ntype) from 9 to 6, probably to save space. 9/pc/ether509.c Much updated. Supports 100baseT, it appears. rsc added the necessary bits for 3C562 PCMCIA cards as well, although devi82365.c needs to be updated to make the 562 work. IP 9/port/devip.c Changes logic so that writing to a TCP connection in Close_wait is not an error. This was handled by a previous boddle from plan9.bell-labs.com. Changes iplocalfill to handle more than one IP address. 9/boot/ip.c Just fix ether -> ether0 Makes authtcp() return authil() instead of -1. RELATED COMMANDS cmd/ip/bootp.c Cuts out myip calculation, which is never used. cmd/ip/ipconfig.c Fix ether -> ether0 Also checks #P/ipifc to see if a given ether device actually needs to be initialized. cmd/ip/rarp.c Fix ether -> ether0 Give rarpd its own log file, instead of cluttering ipboot. cmd/ip/snoopy.c Just fix ether -> ether0