9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: geoff@collyer.net
To: 9fans@cse.psu.edu
Subject: Re: [9fans] fs kernel ether driver update
Date: Wed,  1 Mar 2006 22:46:19 -0800	[thread overview]
Message-ID: <fee69cdf77a29d950baf07003a227135@collyer.net> (raw)
In-Reply-To: <7303fddbc49bc3ef69e60b41d677c3c8@cat-v.org>

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
---



  reply	other threads:[~2006-03-02  6:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-01  8:25 geoff
2006-03-01  9:03 ` Federico Benavento
2006-03-01  9:15   ` geoff
2006-03-01  9:17     ` Federico Benavento
2006-03-01  9:20       ` geoff
2006-03-01 12:09 ` uriel
2006-03-02  6:46   ` geoff [this message]
2006-03-02  9:35     ` Charles Forsyth
2006-03-01 10:28 geoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fee69cdf77a29d950baf07003a227135@collyer.net \
    --to=geoff@collyer.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).