]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/ether82598.c
ether82563, ether82598, etherx550: round rbsz to multiple of 1K
[plan9front.git] / sys / src / 9 / pc / ether82598.c
index 609b372b225ca8713a505cb28892eab3fa3fd50c..0c60c3afb3c90fddbdca4863aeb26b0f17aede32 100644 (file)
@@ -10,7 +10,7 @@
 #include "io.h"
 #include "../port/error.h"
 #include "../port/netif.h"
-#include "etherif.h"
+#include "../port/etherif.h"
 
 /*
  * // comments note conflicts with 82563-style drivers,
@@ -298,14 +298,14 @@ typedef struct {
        Block   **tb;
 
        uchar   ra[Eaddrlen];
-       uchar   mta[128];
+       u32int  mta[128];
        ulong   stats[nelem(stattab)];
        uint    speeds[3];
 } Ctlr;
 
 /* tweakable paramaters */
 enum {
-       Rbsz    = 12*1024,
+       Mtu     = 12*1024,
        Nrd     = 256,
        Ntd     = 256,
        Nrb     = 256,
@@ -500,7 +500,7 @@ rxinit(Ctlr *c)
 
        c->reg[Fctrl] |= Bam;
        c->reg[Rxcsum] |= Ipcs;
-       c->reg[Srrctl] = (c->rbsz + 1023)/1024;
+       c->reg[Srrctl] = c->rbsz / 1024;
        c->reg[Mhadd] = c->rbsz << 16;
        c->reg[Hlreg0] |= Jumboen;
 
@@ -584,7 +584,7 @@ loop1:
                b->checksum = r->cksum;
        }
 //     r->status = 0;
-       etheriq(e, b, 1);
+       etheriq(e, b);
        c->rdfree--;
        rdh = Next(rdh, m);
        goto loop1;                     /* UGH */
@@ -897,11 +897,12 @@ scan(void)
                        free(c);
                        continue;
                }
+               pcienable(p);
                c->p = p;
                c->io = io;
                c->reg = (u32int*)mem;
                c->regmsi = (u32int*)memmsi;
-               c->rbsz = Rbsz;
+               c->rbsz = ROUND(Mtu, 1024);
                if(reset(c)){
                        print("i82598: can't reset\n");
                        free(c);
@@ -947,18 +948,19 @@ pnp(Ether *e)
        e->irq = c->p->intl;
        e->tbdf = c->p->tbdf;
        e->mbps = 10000;
-       e->maxmtu = c->rbsz;
+       e->maxmtu = Mtu;
 
        e->arg = e;
        e->attach = attach;
        e->ctl = ctl;
        e->ifstat = ifstat;
-       e->interrupt = interrupt;
        e->multicast = multicast;
        e->promiscuous = promiscuous;
        e->shutdown = shutdown;
        e->transmit = transmit;
 
+       intrenable(e->irq, interrupt, e, e->tbdf, e->name);
+
        return 0;
 }