* crc is exactly 32 bits * deal with 40gbe (keep queues from getting too large) * print better ether information * pass flags along when doing loopback, or when copying blocks. * allow drivers to set up their own vector (for msi-x) Reference: /n/atom/patch/applied/ethermsihooks Date: Sun Aug 16 19:31:26 CES 2015 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/k10/devether.c Sun Aug 16 19:30:22 2015 +++ /sys/src/nix/k10/devether.c Sun Aug 16 19:30:23 2015 @@ -150,6 +150,7 @@ fx = f; else if(xbp = iallocb(len)){ memmove(xbp->wp, pkt, len); + xbp->flag = bp->flag; xbp->wp += len; if(qpass(f->iq, xbp) < 0) ether->soverflows++; @@ -166,7 +167,7 @@ } if(fromwire){ freeb(bp); - return 0; + return nil; } return bp; @@ -193,12 +194,14 @@ len = BLEN(bp); loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0; if(loopback){ + bp->flag |= Btcpck|Budpck|Bipck|Bpktck; etheriq(ether, bp, -1); return len; } if(memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom) etheriq(ether, bp, 0); + qbwrite(ether->oq, bp); /* botch: might block; should track overflows */ if(ether->transmit != nil) ether->transmit(ether); @@ -375,17 +378,21 @@ * If ether->irq is <0, it is a hack to indicate no interrupt * used by ethersink. */ - if(ether->irq >= 0) + if(ether->vector != nil) + vintrenable(ether->vector, name); + else if(ether->irq >= 0) ether->vector = intrenable(ether->irq, ether->interrupt, ether, ether->tbdf, name); - print("#l%d: %s: %dMbps port %#p tu %d %E\n", - ctlrno, cards[cardno].type, ether->mbps, ether->port, ether->mtu, ether->ea); + print("#l%d: %s: %dMbps port %#p tbdf %T tu %d %E\n", + ctlrno, cards[cardno].type, ether->mbps, ether->port, ether->tbdf, ether->mtu, ether->ea); j = ether->mbps; + if(j > 10000) + j = 10000; if(j > 1000) j *= 10; for(i = 0; j >= 100; i++) j /= 10; - i = 128*1024<oq == nil) ether->oq = qopen(i, Qmsg, 0, 0); --- /sys/src/nix/k10/etherif.h Sun Aug 16 19:30:25 2015 +++ /sys/src/nix/k10/etherif.h Sun Aug 16 19:30:26 2015 @@ -40,7 +40,7 @@ Block* etheriq(Ether*, Block*, int); void addethercard(char*, int(*)(Ether*)); -uint ethercrc(uchar*, int); +u32int ethercrc(uchar*, int); int parseether(uchar*, char*); int ethercfgmatch(Ether*, Pcidev*, uintmem);