]> Joshua Wise's Git repositories - netwatch.git/commitdiff
Lolol, boxing and unboxing?
authorJoshua Wise <joshua@nyus.joshuawise.com>
Thu, 4 Dec 2008 22:58:36 +0000 (17:58 -0500)
committerJoshua Wise <joshua@nyus.joshuawise.com>
Thu, 4 Dec 2008 22:58:36 +0000 (17:58 -0500)
net/3c90x.c
net/etherboot-compat.h
net/net.c
net/net.h

index 64dd65549d96ca977e8cead947278cf713a7f4c9..3a6c958ee9dde5f3c9489332342cc45dc103a74b 100644 (file)
@@ -224,8 +224,10 @@ typedef struct
     {
     unsigned int       DnNextPtr;
     unsigned int       FrameStartHeader;
-    unsigned int       DataAddr;
-    unsigned int       DataLength;
+    struct {
+      unsigned int addr;
+      unsigned int len;
+    } __attribute ((aligned(8))) segments[64];
     }
     TXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */
 
@@ -473,17 +475,16 @@ static void a3c90x_reset(void)
  *** pkt - the pointer to the packet data itself.
  ***/
 static void
-a3c90x_transmit(unsigned int size, const char *pkt)
+a3c90x_transmit(struct pbuf *p)
 {
        unsigned char status;
        static unsigned int stillwaiting = 0;
+       unsigned int n, len;
 
        if (stillwaiting)
        {
-               outputf("Waiting for network completion...");
                while (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_TXCOMPLETE) && oneshot_running())
                        ;
-               outputf("Done");
                if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_TXCOMPLETE))
                {
                        outputf("3c90x: tx timeout? txstat %02x", inb(INF_3C90X.IOAddr + regTxStatus_b));
@@ -498,11 +499,20 @@ a3c90x_transmit(unsigned int size, const char *pkt)
 
        /** Setup the DPD (download descriptor) **/
        INF_3C90X.TransmitDPD.DnNextPtr = 0;
+       len = 0;
+       n = 0;
+       for (; p; p = p->next)
+       {
+               INF_3C90X.TransmitDPD.segments[n].addr = (unsigned int)p->payload;
+               INF_3C90X.TransmitDPD.segments[n].len = p->len | (p->next ? 0 : (1 << 31));
+               len += p->len;
+               n++;
+       }
        /** set notification for transmission completion (bit 15) **/
-       INF_3C90X.TransmitDPD.FrameStartHeader = (size) | 0x8000;
-       INF_3C90X.TransmitDPD.DataAddr = v2p((void*)pkt);
-       INF_3C90X.TransmitDPD.DataLength = size + (1<<31);
+       INF_3C90X.TransmitDPD.FrameStartHeader = (len) | 0x8000;
        
+       outputf("3c90x: Sending %d byte %d seg packet", len, n);
+
        /** Send the packet **/
        outl(INF_3C90X.IOAddr + regDnListPtr_l, v2p(&(INF_3C90X.TransmitDPD)));
        _issue_command(INF_3C90X.IOAddr, cmdStallCtl, 3 /* Unstall download */);
index e769ce8727232ee5dfa825ebef0c457644f32618..6982a2187932debc2a1ef72c6a45741c5d383208 100644 (file)
@@ -2,6 +2,7 @@
 #define _ETHERBOOT_COMPAT_H
 
 #include <paging.h>
+#include "lwip/pbuf.h"
 
 #define ETH_ALEN       6
 
@@ -19,7 +20,7 @@ struct nic {
        unsigned char hwaddr[6];
 
        int (*poll) (struct nic *nic, int retrieve);
-       void (*transmit) (unsigned int size, const char *pkt);
+       void (*transmit) (struct pbuf *p);
 };
 
 #define virt_to_bus(x) memory_v2p((void *)(x))
index 7fa7c467164715abcb3c279eeafea4d6ed67bda1..598ea757b45e218fcf8e3c0c0c5dd36cce081745 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -96,19 +96,16 @@ void eth_poll()
 static err_t _transmit(struct netif *netif, struct pbuf *p)
 {
        struct nic *nic = netif->state;
-       struct pbuf *q;
-       unsigned char pkt[1600];
-       unsigned int len = 0;
 
-       for(q = p; q != NULL; q = q->next)
+/*     for(q = p; q != NULL; q = q->next)
        {
                memcpy(pkt + len, q->payload, q->len);
                len += q->len;
-       }
+       }*/
 
-       outputf("NIC: Transmit packet: %d bytes", len);
+       outputf("NIC: Transmit packet");
 
-       nic->transmit(len, pkt);
+       nic->transmit(p);
 
        LINK_STATS_INC(link.xmit);
 
index c665216622e4047ae7e2c5e32b54316e4c1f4f28..7b522f0f2d40b1e0a64f5fa3a671feb93aec4d74 100644 (file)
--- a/net/net.h
+++ b/net/net.h
@@ -1,5 +1,5 @@
-#ifndef _3C905_H
-#define _3C905_H
+#ifndef _NET_H
+#define _NET_H
 
 #include "etherboot-compat.h"
 
This page took 0.031159 seconds and 4 git commands to generate.