From a502208f213c67e6b355f35d4581523a3120b148 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 7 Feb 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-02-07 --- ip/udp.c | 2 +- pc/etherwavelan.c | 17 +++++++++++------ port/latin1.h | 2 +- port/portfns.h | 2 +- port/proc.c | 8 ++++---- port/qio.c | 7 ++++++- port/sysfile.c | 2 +- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ip/udp.c b/ip/udp.c index 003fc1a76006f4e80b56580d6451eb10422bb5df..45b5b02894a31f813c6957c8510d519dbffd280b 100644 --- a/ip/udp.c +++ b/ip/udp.c @@ -120,7 +120,7 @@ udpannounce(Conv *c, char** argv, int argc) static void udpcreate(Conv *c) { - c->rq = qopen(128*1024, 1, 0, 0); + c->rq = qopen(256*1024, 1, 0, 0); c->wq = qopen(128*1024, 0, 0, 0); } diff --git a/pc/etherwavelan.c b/pc/etherwavelan.c index ec13a1ac364eb153e00402e2481893369fc4c058..e074f0625c761f3dc2692276832a21c57ccb93b0 100644 --- a/pc/etherwavelan.c +++ b/pc/etherwavelan.c @@ -256,6 +256,8 @@ struct Stats ulong ninfo; ulong nidrop; ulong nwatchdogs; // transmit time outs, actually + int ticks; + int tickintr; }; struct Ctlr @@ -817,7 +819,6 @@ w_timer(void* arg) { Ether* ether = (Ether*) arg; Ctlr* ctlr = (Ctlr*)ether->ctlr; - int tick=0; for(;;){ tsleep(&ctlr->timer, return0, 0, 50); @@ -826,7 +827,7 @@ w_timer(void* arg) break; if (ctlr->attached == 0) continue; - tick++; + ctlr->ticks++; ilock(&ctlr->Lock); @@ -845,10 +846,12 @@ w_timer(void* arg) // the card frames in the wrong way; due to the // lack of documentation I cannot know. - if (csr_ins(ctlr, WR_EvSts)&WEvs) + if (csr_ins(ctlr, WR_EvSts)&WEvs){ + ctlr->tickintr++; w_intr(ether); + } - if (tick % 10 == 0) { + if ((ctlr->ticks % 10) == 0) { if (ctlr->txtmout && --ctlr->txtmout == 0){ ctlr->nwatchdogs++; w_txdone(ctlr, WTxErrEv|1); // 1: keep it busy @@ -858,7 +861,7 @@ w_timer(void* arg) if (ctlr->txbusy) w_txstart(ether,1); } - if (tick % 120 == 0) + if ((ctlr->ticks % 120) == 0) if (ctlr->txbusy == 0) w_cmd(ctlr, WCmdAskStats, WTyp_Stats); } @@ -922,6 +925,8 @@ ifstat(Ether* ether, void* a, long n, ulong offset) PRINTSTAT("InfoEvs: %lud\n", ctlr->ninfo); PRINTSTAT("InfoDrop: %lud\n", ctlr->nidrop); PRINTSTAT("WatchDogs: %lud\n", ctlr->nwatchdogs); + PRINTSTAT("Ticks: %ud\n", ctlr->ticks); + PRINTSTAT("TickIntr: %ud\n", ctlr->tickintr); k = ((ctlr->attached) ? "attached" : "not attached"); PRINTSTAT("Card %s", k); k = ((ctlr->txbusy)? ", txbusy" : ""); @@ -1226,7 +1231,7 @@ reset(Ether* ether) if(ctlr->hascrypt = ltv_ins(ctlr, WTyp_HasCrypt)) ctlr->crypt = 1; *ctlr->netname = *ctlr->wantname = 0; - strcpy(ctlr->nodename, "wvlancard"); + strcpy(ctlr->nodename, "Plan 9 STA"); for(i = 0; i < ether->nopt; i++){ // diff --git a/port/latin1.h b/port/latin1.h index d122e00723d822c9ecf65e506fe9886f32fe6ba6..fe3c6d2fd9d4e957b2df8be980b0a6e3245f19e7 100644 --- a/port/latin1.h +++ b/port/latin1.h @@ -74,7 +74,7 @@ "c", "$Oagu", L"¢©∩≅∪", "dv", "z", L"dž", "d", "-adegz", L"ð↓‡°†ʣ", - "e", "lmns", L"⋯—–∅", + "e", "$lmns", L"€⋯—–∅", "f", "a", L"∀", "g", "$-r", L"¤ǥ∇", "h", "-v", L"ℏƕ", diff --git a/port/portfns.h b/port/portfns.h index f51001541a19f1241364282331c22238f0ba0706..9adb028b9368938bc5c0a9fb7f306397e6410e0b 100644 --- a/port/portfns.h +++ b/port/portfns.h @@ -320,7 +320,7 @@ long userwrite(char*, int); void validaddr(ulong, ulong, int); void vcacheinval(Page*, ulong); void* vmemchr(void*, int, int); -int wakeup(Rendez*); +Proc* wakeup(Rendez*); int walk(Chan**, char*, int); int walkname(Chan**, char*, int); void wlock(RWlock*); diff --git a/port/proc.c b/port/proc.c index 8aeea37e0cc7a1c5e39a3fdefd3e2d9fd17dee5d..56b85d2ee405159def324808d2828b95b2eeb15f 100644 --- a/port/proc.c +++ b/port/proc.c @@ -534,11 +534,11 @@ tsleep(Rendez *r, int (*fn)(void*), void *arg, int ms) * Richard Miller has a better solution that doesn't require both to * be held simultaneously, but I'm a paranoid - presotto. */ -int +Proc* wakeup(Rendez *r) { - Proc *p; - int s, rv; + Proc *p, *rv; + int s; rv = 0; s = splhi(); @@ -553,7 +553,7 @@ wakeup(Rendez *r) r->p = nil; p->r = nil; ready(p); - rv = 1; + rv = p; unlock(&p->rlock); } diff --git a/port/qio.c b/port/qio.c index 46741d2398b5c2264ece744b23bb4b50221a6311..ac392c1c3e45289987cc06ad827146a926a6a0db 100644 --- a/port/qio.c +++ b/port/qio.c @@ -1028,6 +1028,7 @@ long qbwrite(Queue *q, Block *b) { int n, dowakeup; + Proc *p; dowakeup = 0; n = BLEN(b); @@ -1080,7 +1081,11 @@ qbwrite(Queue *q, Block *b) if(dowakeup){ if(q->kick) q->kick(q->arg); - wakeup(&q->rr); + p = wakeup(&q->rr); + + /* if we just wokeup a higher priority process, let it run */ + if(p != nil && p->priority > up->priority) + sched(); } /* diff --git a/port/sysfile.c b/port/sysfile.c index 4984dd32c31bea032fe908ef2d2ba289c7422916..04cbc59fb5b529af7bb575018389bbaf02cfc24f 100644 --- a/port/sysfile.c +++ b/port/sysfile.c @@ -584,7 +584,7 @@ sysoseek(ulong *arg) } o; ulong a[5]; - o.v = arg[1]; + o.v = (long)arg[1]; a[0] = (ulong)&o.v; a[1] = arg[0]; a[2] = o.u[0];