From 6f8b2f54a9ac9802e94e8846cd87e08eb67ad37d Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 13 Jul 1995 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1995-07-13 --- pc/devether.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/pc/devether.c b/pc/devether.c index c39812da6c26952b2afcc5d14c0486945d8fe951..a6ebe18c391e9cb9c1f8b7e9dd4c28a56e94decd 100644 --- a/pc/devether.c +++ b/pc/devether.c @@ -103,15 +103,36 @@ etherwstat(Chan *c, char *dp) void etherrloop(Ether *ctlr, Etherpkt *pkt, long len, int tome) { + Block *bp; ushort type; + int i; Netfile *f, **fp, **ep; type = (pkt->type[0]<<8)|pkt->type[1]; ep = &ctlr->f[Ntypes]; for(fp = ctlr->f; fp < ep; fp++){ - if((f = *fp) && ((tome && f->type==type) || f->type < 0)) - if(qproduce(f->in, pkt->d, len) < 0) - ctlr->soverflows++; + if((f = *fp) && ((tome && f->type==type) || f->type < 0)){ + if(f->type > -2){ + if(qproduce(f->in, pkt->d, len) < 0) + ctlr->soverflows++; + } else { + if(qwindow(f->in) <= 0) + continue; + if(len > 60) + len = 60; + bp = iallocb(len); + if(bp == 0) + continue; + memmove(bp->wp, pkt->d, len); + i = TK2MS(m->ticks); + bp->wp[60] = i>>24; + bp->wp[61] = i>>16; + bp->wp[62] = i>>8; + bp->wp[63] = i; + bp->wp += 64; + qpass(f->in, bp); + } + } } }