strace: Remove the ability to write to Qstrace
[akaros.git] / kern / drivers / net / ether8169.c
index bfc790e..4bdce2d 100644 (file)
@@ -513,14 +513,14 @@ rtl8169ifstat(struct ether* edev, void* a, long n, uint32_t offset)
                udelay(1000*1);
        }
        if(csr32r(ctlr, Dtccr) & Cmd)
-               error(Eio);
+               error(EIO, ERROR_FIXME);
        dtcc = ctlr->dtcc;
 
-       edev->netif.oerrs = dtcc->txer;
-       edev->netif.crcs = dtcc->rxer;
-       edev->netif.frames = dtcc->fae;
-       edev->netif.buffs = dtcc->misspkt;
-       edev->netif.overflows = ctlr->txdu+ctlr->rdu;
+       edev->oerrs = dtcc->txer;
+       edev->crcs = dtcc->rxer;
+       edev->frames = dtcc->fae;
+       edev->buffs = dtcc->misspkt;
+       edev->overflows = ctlr->txdu+ctlr->rdu;
 
        if(n == 0){
                qunlock(&ctlr->slock);
@@ -529,7 +529,7 @@ rtl8169ifstat(struct ether* edev, void* a, long n, uint32_t offset)
        }
 
        if((alloc = kzmalloc(READSTR, 0)) == NULL)
-               error(Enomem);
+               error(ENOMEM, ERROR_FIXME);
        e = alloc+READSTR;
 
        p = seprintf(alloc, e, "TxOk: %llu\n", dtcc->txok);
@@ -619,7 +619,7 @@ rtl8169replenish(struct ctlr* ctlr)
                         * Simple allocation for now.
                         * This better be aligned on 8.
                         */
-                       bp = iallocb(Mps);
+                       bp = block_alloc(Mps, MEM_ATOMIC);
                        if(bp == NULL){
                                printk("no available buffers\n");
                                break;
@@ -713,7 +713,7 @@ rtl8169init(struct ether* edev)
                 */
                printk("untested\n");
                break;
-#if 0        
+#if 0
                r = csr8r(ctlr, Config2) & 0x07;
                if(r == 0x01)                           /* 66MHz PCI */
                        csr32w(ctlr, 0x7C, 0x0007FFFF); /* magic */
@@ -835,13 +835,13 @@ rtl8169attach(struct ether* edev)
                /*
                 * Handle allocation/init errors here.
                 */
-               ctlr->td = kzmalloc_align(sizeof(D) * Ntd, KMALLOC_WAIT, 256);
-               ctlr->tb = kzmalloc(Ntd * sizeof(struct block *), KMALLOC_WAIT);
+               ctlr->td = kzmalloc_align(sizeof(D) * Ntd, MEM_WAIT, 256);
+               ctlr->tb = kzmalloc(Ntd * sizeof(struct block *), MEM_WAIT);
                ctlr->ntd = Ntd;
-               ctlr->rd = kzmalloc_align(sizeof(D) * Nrd, KMALLOC_WAIT, 256);
-               ctlr->rb = kzmalloc(Nrd * sizeof(struct block *), KMALLOC_WAIT);
+               ctlr->rd = kzmalloc_align(sizeof(D) * Nrd, MEM_WAIT, 256);
+               ctlr->rb = kzmalloc(Nrd * sizeof(struct block *), MEM_WAIT);
                ctlr->nrd = Nrd;
-               ctlr->dtcc = kzmalloc_align(sizeof(Dtcc), KMALLOC_WAIT, 64);
+               ctlr->dtcc = kzmalloc_align(sizeof(Dtcc), MEM_WAIT, 64);
                rtl8169init(edev);
                ctlr->init = 1;
        }
@@ -853,11 +853,12 @@ rtl8169attach(struct ether* edev)
        for(timeo = 0; timeo < 350; timeo++){
                if(miistatus(ctlr->mii) == 0)
                        break;
-               udelay_sched(10000);
+               kthread_usleep(10000);
        }
        phy = ctlr->mii->curphy;
        printd("%s: speed %d fd %d link %d rfc %d tfc %d\n",
-               edev->netif.name, phy->speed, phy->fd, phy->link, phy->rfc, phy->tfc);
+               edev->name, phy->speed, phy->fd, phy->link, phy->rfc,
+              phy->tfc);
 }
 
 static void
@@ -880,24 +881,24 @@ rtl8169link(struct ether* edev)
        if(miistatus(ctlr->mii) < 0){
                // TODO : no name here
                printk("%slink n: speed %d fd %d link %d rfc %d tfc %d\n",
-                       edev->netif.name, phy->speed, phy->fd, phy->link,
+                       edev->name, phy->speed, phy->fd, phy->link,
                        phy->rfc, phy->tfc);
-               edev->netif.link = 0;
+               edev->link = 0;
                return;
        }
-       edev->netif.link = 1;
+       edev->link = 1;
 
        limit = 256*1024;
        if(phy->speed == 10){
-               edev->netif.mbps = 10;
+               edev->mbps = 10;
                limit = 65*1024;
        }
        else if(phy->speed == 100)
-               edev->netif.mbps = 100;
+               edev->mbps = 100;
        else if(phy->speed == 1000)
-               edev->netif.mbps = 1000;
+               edev->mbps = 1000;
        printk("%slink y: speed %d fd %d link %d rfc %d tfc %d\n",
-               edev->netif.name, phy->speed, phy->fd, phy->link,
+               edev->name, phy->speed, phy->fd, phy->link,
                phy->rfc, phy->tfc);
 
        if(edev->oq != NULL)
@@ -1120,7 +1121,7 @@ rtl8169pci(void)
 
                port = pcidev->bar[0].pio_base;
 
-               ctlr = kzmalloc(sizeof(struct ctlr), KMALLOC_WAIT);
+               ctlr = kzmalloc(sizeof(struct ctlr), MEM_WAIT);
                spinlock_init_irqsave(&ctlr->ilock);
                spinlock_init_irqsave(&ctlr->tlock);
                spinlock_init_irqsave(&ctlr->rlock);
@@ -1198,7 +1199,7 @@ rtl8169pnp(struct ether* edev)
        edev->ctlr = ctlr;
        edev->port = ctlr->port;
        edev->irq = ctlr->pci->irqline;
-       edev->netif.mbps = 100;
+       edev->mbps = 100;
 
        /*
         * Check if the adapter's station address is to be overridden.
@@ -1221,9 +1222,9 @@ rtl8169pnp(struct ether* edev)
        edev->transmit = rtl8169transmit;
        edev->ifstat = rtl8169ifstat;
 
-       edev->netif.arg = edev;
-       edev->netif.promiscuous = rtl8169promiscuous;
-       edev->netif.multicast = rtl8169multicast;
+       edev->arg = edev;
+       edev->promiscuous = rtl8169promiscuous;
+       edev->multicast = rtl8169multicast;
 //     edev->netif.shutdown = rtl8169shutdown;
 
        rtl8169link(edev);