| plan 9 kernel history: overview | file list | diff list |
1999/0515/alphapc/devether.c (diff list | history)
| 1999/0415/sys/src/9/alphapc/devether.c:356,362 – 1999/0515/sys/src/9/alphapc/devether.c:356,362 (short | long) | ||
| 1999/0415 | ether->irq = 9; intrenable(VectorPCI+ether->irq, ether->interrupt, ether, ether->tbdf); | |
| 1999/0515 | i = sprint(buf, "#l%d: %s: %dMbps port 0x%luX irq %ld", | |
| 1999/0415 | ctlrno, ether->type, ether->mbps, ether->port, ether->irq); if(ether->mem) i += sprint(buf+i, " addr 0x%luX", PADDR(ether->mem)); | |
| 1999/0515/sys/src/9/alphapc/devether.c:130,140 – 2000/0401/sys/src/9/alphapc/devether.c:130,140 (short | long) | ||
| 1999/0415 | } Block* | |
| 2000/0401 | etheriq(Ether* ether, Block* bp, int fromwire) | |
| 1999/0415 | { Etherpkt *pkt; ushort type; | |
| 2000/0401 | int len, multi, tome, fromme; | |
| 1999/0415 | Netfile **ep, *f, **fp, *fx; Block *xbp; | |
| 1999/0515/sys/src/9/alphapc/devether.c:146,155 – 2000/0401/sys/src/9/alphapc/devether.c:146,156 | ||
| 1999/0415 | fx = 0; ep = ðer->f[Ntypes]; | |
| 2000/0401 | multi = pkt->d[0] & 1; | |
| 1999/0415 | /* check for valid multcast addresses */ | |
| 2000/0401 | if(multi && memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) && ether->prom == 0){ | |
| 1999/0415 | if(!activemulti(ether, pkt->d, sizeof(pkt->d))){ | |
| 2000/0401 | if(fromwire){ | |
| 1999/0415 | freeb(bp); bp = 0; } | |
| 1999/0515/sys/src/9/alphapc/devether.c:157,172 – 2000/0401/sys/src/9/alphapc/devether.c:158,182 | ||
| 1999/0415 | } } | |
| 2000/0401 | /* is it for me? */ tome = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0; fromme = memcmp(pkt->s, ether->ea, sizeof(pkt->s)) == 0; | |
| 1999/0415 | /* * Multiplex the packet to all the connections which want it. | |
| 2000/0401 | * If the packet is not to be used subsequently (fromwire != 0), | |
| 1999/0415 | * attempt to simply pass it into one of the connections, thereby * saving a copy of the data (usual case hopefully). */ for(fp = ether->f; fp < ep; fp++){ | |
| 2000/0401 | if(f = *fp) if(f->type == type || f->type < 0) if(tome || multi || f->prom){ /* Don't want to hear bridged packets */ if(f->bridge && !fromwire && !fromme) continue; if(!f->headersonly){ if(fromwire && fx == 0) | |
| 1999/0415 | fx = f; else if(xbp = iallocb(len)){ memmove(xbp->wp, pkt, len); | |
| 1999/0515/sys/src/9/alphapc/devether.c:182,191 – 2000/0401/sys/src/9/alphapc/devether.c:192,202 | ||
| 1999/0415 | } if(fx){ | |
| 2000/0401 | if(qpass(fx->in, bp) < 0) ether->soverflows++; | |
| 1999/0415 | return 0; } | |
| 2000/0401 | if(fromwire){ | |
| 1999/0415 | freeb(bp); return 0; } | |
| 1999/0515/sys/src/9/alphapc/devether.c:207,219 – 2000/0401/sys/src/9/alphapc/devether.c:218,232 | ||
| 1999/0415 | * in promiscuous mode. * If it's a loopback packet indicate to etheriq that the data isn't * needed and return, etheriq will pass-on or free the block. | |
| 2000/0401 | * To enable bridging to work, only packets that were originated * by this interface are fed back. | |
| 1999/0415 | */ pkt = (Etherpkt*)bp->rp; len = BLEN(bp); | |
| 2000/0401 | loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0; | |
| 1999/0415 | if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){ s = splhi(); | |
| 2000/0401 | etheriq(ether, bp, 0); | |
| 1999/0415 | splx(s); } | |
| 1999/0515/sys/src/9/alphapc/devether.c:220,226 – 2000/0401/sys/src/9/alphapc/devether.c:233,240 | ||
| 1999/0415 | if(!loopback){ qbwrite(ether->oq, bp); ether->transmit(ether); | |
| 2000/0401 | } else freeb(bp); | |
| 1999/0415 | return len; } | |
| 1999/0515/sys/src/9/alphapc/devether.c:354,362 – 2000/0401/sys/src/9/alphapc/devether.c:368,377 | ||
| 1999/0415 | */ if(ether->irq == 2) ether->irq = 9; | |
| 2000/0401 | snprint(name, sizeof(name), "ether%d", ctlrno); intrenable(ether->irq, ether->interrupt, ether, ether->tbdf, name); | |
| 1999/0415 | ||
| 1999/0515 |
| |
| 2000/0401 | i = sprint(buf, "#l%d: %s: %dMbps port 0x%luX irq %lud", | |
| 1999/0415 | ctlrno, ether->type, ether->mbps, ether->port, ether->irq); if(ether->mem) i += sprint(buf+i, " addr 0x%luX", PADDR(ether->mem)); | |
| 1999/0515/sys/src/9/alphapc/devether.c:368,374 – 2000/0401/sys/src/9/alphapc/devether.c:383,388 | ||
| 1999/0415 | sprint(buf+i, "\n"); print(buf); | |
| 2000/0401/sys/src/9/alphapc/devether.c:110,121 – 2000/0713/sys/src/9/alphapc/devether.c:110,121 (short | long) | ||
| 1999/0415 | if(qwindow(f->in) <= 0) return; | |
| 2000/0713 | if(len > 58) n = 58; | |
| 1999/0415 | else n = len; | |
| 2000/0713 | bp = iallocb(64); if(bp == nil) | |
| 1999/0415 | return; memmove(bp->wp, pkt->d, n); i = TK2MS(MACHP(0)->ticks); | |
| 2000/0713/sys/src/9/alphapc/devether.c:366,372 – 2001/0228/sys/src/9/alphapc/devether.c:366,372 (short | long) | ||
| 1999/0415 | * controllers together. A device set to IRQ2 will appear on * the second interrupt controller as IRQ9. */ | |
| 2001/0228 | if(ether->irq == 2 && BUSTYPE(ether->tbdf) != BusPCI) | |
| 1999/0415 | ether->irq = 9; | |
| 2000/0401 | snprint(name, sizeof(name), "ether%d", ctlrno); intrenable(ether->irq, ether->interrupt, ether, ether->tbdf, name); | |
| 2001/0228/sys/src/9/alphapc/devether.c:35,50 – 2001/0727/sys/src/9/alphapc/devether.c:35,50 (short | long) | ||
| 1999/0415 | return chan; } | |
| 2001/0727 | static Walkqid* etherwalk(Chan* chan, Chan* nchan, char** name, int nname) | |
| 1999/0415 | { | |
| 2001/0727 | return netifwalk(etherxx[chan->dev], chan, nchan, name, nname); | |
| 1999/0415 | } | |
| 2001/0727 | static int etherstat(Chan* chan, uchar* dp, int n) | |
| 1999/0415 | { | |
| 2001/0727 | return netifstat(etherxx[chan->dev], chan, dp, n); | |
| 1999/0415 | } static Chan* | |
| 2001/0228/sys/src/9/alphapc/devether.c:71,77 – 2001/0727/sys/src/9/alphapc/devether.c:71,77 | ||
| 1999/0415 | ulong offset = off; ether = etherxx[chan->dev]; | |
| 2001/0727 | if((chan->qid.type & QTDIR) == 0 && ether->ifstat){ | |
| 1999/0415 | /* * With some controllers it is necessary to reach * into the chip to extract statistics. | |
| 2001/0228/sys/src/9/alphapc/devether.c:96,105 – 2001/0727/sys/src/9/alphapc/devether.c:96,105 | ||
| 1999/0415 | { } | |
| 2001/0727 | static int etherwstat(Chan* chan, uchar* dp, int n) | |
| 1999/0415 | { | |
| 2001/0727 | return netifwstat(etherxx[chan->dev], chan, dp, n); | |
| 1999/0415 | } static void | |
| 2001/0228/sys/src/9/alphapc/devether.c:338,344 – 2001/0727/sys/src/9/alphapc/devether.c:338,344 | ||
| 1999/0415 | { Ether *ether; int i, n, ctlrno; | |
| 2001/0727 | char name[32], buf[128]; | |
| 1999/0415 | for(ether = 0, ctlrno = 0; ctlrno < MaxEther; ctlrno++){ if(ether == 0) | |
| 2001/0228/sys/src/9/alphapc/devether.c:347,352 – 2001/0727/sys/src/9/alphapc/devether.c:347,354 | ||
| 1999/0415 | ether->ctlrno = ctlrno; ether->tbdf = BUSUNKNOWN; ether->mbps = 10; | |
| 2001/0727 | ether->minmtu = ETHERMINTU; ether->maxmtu = ETHERMAXTU; | |
| 1999/0415 | if(isaconfig("ether", ctlrno, ether) == 0) continue; for(n = 0; cards[n].type; n++){ | |
| 2001/0228/sys/src/9/alphapc/devether.c:435,441 – 2001/0727/sys/src/9/alphapc/devether.c:437,442 | ||
| 1999/0415 | etherreset, devinit, etherattach, | |
| 2001/0727/sys/src/9/alphapc/devether.c:91,101 – 2001/1204/sys/src/9/alphapc/devether.c:91,96 (short | long) | ||
| 1999/0415 | return netifbread(etherxx[chan->dev], chan, n, offset); } | |
| 2001/0727 | static int etherwstat(Chan* chan, uchar* dp, int n) | |
| 1999/0415 | { | |
| 2001/0727/sys/src/9/alphapc/devether.c:446,451 – 2001/1204/sys/src/9/alphapc/devether.c:441,446 | ||
| 1999/0415 | etherbread, etherwrite, etherbwrite, | |
| 2001/1204 | devremove, | |
| 1999/0415 | etherwstat, }; | |
| 2001/1204/sys/src/9/alphapc/devether.c:431,436 – 2002/0109/sys/src/9/alphapc/devether.c:431,437 (short | long) | ||
| 1999/0415 | etherreset, devinit, | |
| 2002/0109 | devshutdown, | |
| 1999/0415 | etherattach, etherwalk, etherstat, | |
| 2002/0109/sys/src/9/alphapc/devether.c:383,394 – 2002/0711/sys/src/9/alphapc/devether.c:383,394 (short | long) | ||
| 1999/0415 | if(ether->mbps == 100){ netifinit(ether, name, Ntypes, 256*1024); if(ether->oq == 0) | |
| 2002/0711 | ether->oq = qopen(256*1024, Qmsg, 0, 0); | |
| 1999/0415 | } else{ netifinit(ether, name, Ntypes, 65*1024); if(ether->oq == 0) | |
| 2002/0711 | ether->oq = qopen(65*1024, Qmsg, 0, 0); | |
| 1999/0415 | } if(ether->oq == 0) panic("etherreset %s", name); | |
| 2002/0711/sys/src/9/alphapc/devether.c:241,248 – 2002/0712/sys/src/9/alphapc/devether.c:241,255 (short | long) | ||
| 1999/0415 | Block *bp; ether = etherxx[chan->dev]; | |
| 2002/0712 | if(NETTYPE(chan->qid.path) != Ndataqid){ if(n == sizeof("nonblocking")-1 && strncmp((char*)buf, "nonblocking", n) == 0){ qnoblock(ether->oq, 1); return n; } | |
| 1999/0415 | return netifwrite(ether, chan, buf, n); | |
| 2002/0712 | } | |
| 1999/0415 | if(n > ETHERMAXTU) error(Etoobig); | |
| 2002/0712/sys/src/9/alphapc/devether.c:10,16 – 2002/1130/sys/src/9/alphapc/devether.c:10,16 (short | long) | ||
| 1999/0415 | #include "etherif.h" | |
| 2002/1130 | static volatile Ether *etherxx[MaxEther]; | |
| 1999/0415 | Chan* etherattach(char* spec) | |
| 2002/0712/sys/src/9/alphapc/devether.c:176,182 – 2002/1130/sys/src/9/alphapc/devether.c:176,183 | ||
| 1999/0415 | else if(xbp = iallocb(len)){ memmove(xbp->wp, pkt, len); xbp->wp += len; | |
| 2002/1130 | if(qpass(f->in, xbp) < 0) ether->soverflows++; | |
| 1999/0415 | } else ether->soverflows++; | |
| 2002/0712/sys/src/9/alphapc/devether.c:239,259 – 2002/1130/sys/src/9/alphapc/devether.c:240,265 | ||
| 1999/0415 | { Ether *ether; Block *bp; | |
| 2002/1130 | int nn; | |
| 1999/0415 | ether = etherxx[chan->dev]; | |
| 2002/0712 |
| |
| 2002/1130 | if(NETTYPE(chan->qid.path) != Ndataqid) { nn = netifwrite(ether, chan, buf, n); if(nn >= 0) return nn; | |
| 2002/0712 | if(n == sizeof("nonblocking")-1 && strncmp((char*)buf, "nonblocking", n) == 0){ qnoblock(ether->oq, 1); return n; } | |
| 2002/1130 | if(ether->ctl!=nil) return ether->ctl(ether,buf,n); | |
| 2002/0712 | ||
| 1999/0415 |
| |
| 2002/1130 | error(Ebadctl); | |
| 2002/0712 | } | |
| 1999/0415 |
| |
| 2002/1130 | if(n > ether->maxmtu) | |
| 1999/0415 | error(Etoobig); | |
| 2002/1130 | if(n < ether->minmtu) | |
| 1999/0415 | error(Etoosmall); bp = allocb(n); | |
| 2002/0712/sys/src/9/alphapc/devether.c:276,293 – 2002/1130/sys/src/9/alphapc/devether.c:282,304 | ||
| 1999/0415 | long n; n = BLEN(bp); | |
| 2002/1130 | if(waserror()) { freeb(bp); nexterror(); } n = etherwrite(chan, bp->rp, n, 0); poperror(); | |
| 1999/0415 | freeb(bp); return n; } | |
| 2002/1130 | ether = etherxx[chan->dev]; | |
| 1999/0415 |
| |
| 2002/1130 | if(n > ether->maxmtu){ | |
| 1999/0415 | freeb(bp); | |
| 2002/1130 | error(Etoobig); | |
| 1999/0415 | } | |
| 2002/1130 | if(n < ether->minmtu){ | |
| 1999/0415 | freeb(bp); error(Etoosmall); } | |
| 2002/0712/sys/src/9/alphapc/devether.c:320,326 – 2002/1130/sys/src/9/alphapc/devether.c:331,337 | ||
| 1999/0415 | int i; p = from; | |
| 2002/1130 | for(i = 0; i < Eaddrlen; i++){ | |
| 1999/0415 | if(*p == 0) return -1; nip[0] = *p++; | |
| 2002/0712/sys/src/9/alphapc/devether.c:340,346 – 2002/1130/sys/src/9/alphapc/devether.c:351,357 | ||
| 1999/0415 | { Ether *ether; int i, n, ctlrno; | |
| 2001/0727 |
| |
| 2002/1130 | char name[32], buf[256]; | |
| 1999/0415 | for(ether = 0, ctlrno = 0; ctlrno < MaxEther; ctlrno++){ if(ether == 0) | |
| 2002/0712/sys/src/9/alphapc/devether.c:359,367 – 2002/1130/sys/src/9/alphapc/devether.c:370,378 | ||
| 1999/0415 | for(i = 0; i < ether->nopt; i++){ if(strncmp(ether->opt[i], "ea=", 3)) continue; | |
| 2002/1130 | if(parseether(ether->ea, ðer->opt[i][3])) | |
| 1999/0415 | memset(ether->ea, 0, Eaddrlen); | |
| 2002/1130 | } | |
| 1999/0415 | if(cards[n].reset(ether)) break; | |
| 2002/0712/sys/src/9/alphapc/devether.c:373,382 – 2002/1130/sys/src/9/alphapc/devether.c:384,400 | ||
| 2001/0228 | if(ether->irq == 2 && BUSTYPE(ether->tbdf) != BusPCI) | |
| 1999/0415 | ether->irq = 9; | |
| 2000/0401 | snprint(name, sizeof(name), "ether%d", ctlrno); | |
| 2002/1130 | /* * If ether->irq is 0, it is a hack to indicate no * interrupt used by ethersink. */ if(ether->irq > 0) intrenable(ether->irq, ether->interrupt, ether, ether->tbdf, name); | |
| 1999/0415 | ||
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2002/1130 | i = sprint(buf, "#l%d (%s): %s: %dMbps port 0x%luX irq %lud", ctlrno, name, ether->type, ether->mbps, ether->port, ether->irq); | |
| 1999/0415 | if(ether->mem) i += sprint(buf+i, " addr 0x%luX", PADDR(ether->mem)); if(ether->size) | |
| 2002/0712/sys/src/9/alphapc/devether.c:411,416 – 2002/1130/sys/src/9/alphapc/devether.c:429,454 | ||
| 1999/0415 | if(ether) free(ether); } | |
| 2002/1130 | /* imported from ../pc; not ready for use yet */ static void ethershutdown(void) { Ether *ether; int i; for(i = 0; i < MaxEther; i++){ ether = etherxx[i]; if(ether == nil) continue; if(ether->shutdown == nil) { print("#l%d: no shutdown fuction\n", i); continue; } (*ether->shutdown)(ether); } } | |
| 1999/0415 | #define POLY 0xedb88320 | |
| 2002/1130/sys/src/9/alphapc/devether.c:1,492 – 2003/0301/sys/src/9/alphapc/devether.c:1 (short | long) | ||
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2001/0727 |
| |
| 1999/0415 |
| |
| 2001/0727 |
| |
| 1999/0415 |
| |
| 2001/0727 |
| |
| 1999/0415 |
| |
| 2001/0727 |
| |
| 1999/0415 |
| |
| 2001/0727 |
| |
| 1999/0415 |
| |
| 2001/0727 |
| |
| 1999/0415 |
| |
| 2001/0727 |
| |
| 1999/0415 |
| |
| 2000/0713 |
| |
| 1999/0415 |
| |
| 2000/0713 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 2002/0712 |
| |
| 2002/1130 |
| |
| 2002/0712 | ||
| 2002/1130 |
| |
| 2002/0712 |
| |
| 1999/0415 | ||
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 | ||
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2001/0727 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2001/0228 |
| |
| 1999/0415 |
| |
| 2000/0401 |
| |
| 2002/1130 |
| |
| 1999/0415 | ||
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/0711 |
| |
| 1999/0415 |
| |
| 2002/0711 |
| |
| 1999/0415 |
| |
| 2002/1130 |
| |
| 1999/0415 |
| |
| 2002/0109 |
| |
| 1999/0415 |
| |
| 2001/1204 |
| |
| 1999/0415 |
| |
| 2003/0301 | #include "../pc/devether.c" | |