| plan 9 kernel history: overview | file list | diff list |
1999/0515/alphapc/devether.c (diff list | history)
| 1999/0515/sys/src/9/alphapc/devether.c:130,140 – 2000/0401/sys/src/9/alphapc/devether.c:130,140 (short | long | prev | next) | ||
| 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); | |