From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] fs kernel ether driver update Date: Wed, 1 Mar 2006 22:46:19 -0800 From: geoff@collyer.net In-Reply-To: <7303fddbc49bc3ef69e60b41d677c3c8@cat-v.org> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 098204fa-ead1-11e9-9d60-3106f5b1d025 As far as I know, the reason for drivers being different in fs and cpu kernels is divergent, or at least independent, evolution. The fs kernel started as an old cpu kernel. My impression is that Ken wanted to keep fs kernel changes to a minimum to maximise stability of the file servers. The major ethernet drivers in the fs kernel will now compile in the cpu kernel too, and I run these unified drivers in all my kernels. The differences are fairly small: different headers have to be included, some names have to be mapped to other names, the fs kernel needs some of the cpu kernel's infrastructure or emulation thereof (see /sys/src/fs/pc/compat.[ch]) and a few operations have to be expressed a little more abstractly (usually as macros in my implementation). There are a few other differences not papered over as cleanly: maintaining one's own pool of buffers (vs the Mbrcvbuf flag in the fs kernel), and a change in tests against the PCI ccru struct member, which is different sizes in the two kernels. Apparently /sys/src/9/pc/compat.h has changed a little since I posted it in November 2002, so here's the current one: --- /* * compatibility hacks to permit drivers from the cpu/terminal kernel * to be moved to the fs kernel (and eventually 9load) */ #define ETHERIQ etheriq /* * cpu kernel uses bp->rp to point to start of packet and bp->wp to point * just past valid data in the packet. * fs kernel uses bp->data to point to start of packet and bp->data+bp->count * points just past valid data. */ #define SETWPCNT(bp, cnt) (bp)->wp = (bp)->rp + (cnt) #define BLKRESET(bp) (bp)->wp = (bp)->rp = (bp)->lim - Rbsz #define INCRPTR(bp, incr) (bp)->wp += (incr) #define ENDDATA(bp) (bp)->wp #define etheroq(edev) qget((edev)->oq) #define PROCARG(arg) arg #define GETARG(arg) arg ---