summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-01-04 21:10:17 +0000
committerdg <dg@FreeBSD.org>1995-01-04 21:10:17 +0000
commita00a49206ba441377adfa7dc0d836641b00d44f9 (patch)
tree95635b4c88b29d06b47cd08e29007d9c5f685033
parentc34fd64cc9123e3fa8aff99b762eb2c3895183de (diff)
downloadFreeBSD-src-a00a49206ba441377adfa7dc0d836641b00d44f9.zip
FreeBSD-src-a00a49206ba441377adfa7dc0d836641b00d44f9.tar.gz
Made a few cosmetic changes, and fixed a bug in handling the case of the
remote DMA not completing correctly (the packet was still queued for xmit).
-rw-r--r--sys/dev/ed/if_ed.c26
-rw-r--r--sys/i386/isa/if_ed.c26
2 files changed, 28 insertions, 24 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index 14710d0..cc6f9ef 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -13,7 +13,7 @@
* the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,
* and a variety of similar clones.
*
- * $Id: if_ed.c,v 1.61 1995/01/01 03:54:34 davidg Exp $
+ * $Id: if_ed.c,v 1.62 1995/01/01 06:38:14 davidg Exp $
*/
#include "ed.h"
@@ -1550,6 +1550,8 @@ outloop:
}
} else {
len = ed_pio_write_mbufs(sc, m, buffer);
+ if (len == 0)
+ goto outloop;
}
sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN);
@@ -2234,15 +2236,15 @@ ed_pio_write_mbufs(sc, m, dst)
struct mbuf *m;
unsigned short dst;
{
- unsigned short len, dma_len;
+ unsigned short total_len, dma_len;
struct mbuf *mp;
int maxwait = 100; /* about 120us */
/* First, count up the total number of bytes to copy */
- for (len = 0, mp = m; mp; mp = mp->m_next)
- len += mp->m_len;
+ for (total_len = 0, mp = m; mp; mp = mp->m_next)
+ total_len += mp->m_len;
- dma_len = len;
+ dma_len = total_len;
if (sc->isa16bit && (dma_len & 1))
dma_len++;
@@ -2287,14 +2289,13 @@ ed_pio_write_mbufs(sc, m, dst)
wantbyte = 0;
while (m) {
- data = mtod(m, caddr_t);
len = m->m_len;
if (len) {
+ data = mtod(m, caddr_t);
/* finish the last word */
if (wantbyte) {
savebyte[1] = *data;
- outw(sc->asic_addr + ED_NOVELL_DATA,
- *((unsigned short *) savebyte));
+ outw(sc->asic_addr + ED_NOVELL_DATA, *(u_short *)savebyte);
data++;
len--;
wantbyte = 0;
@@ -2315,9 +2316,9 @@ ed_pio_write_mbufs(sc, m, dst)
m = m->m_next;
}
/* spit last byte */
- if (wantbyte)
- outw(sc->asic_addr + ED_NOVELL_DATA,
- *((unsigned short *) savebyte));
+ if (wantbyte) {
+ outw(sc->asic_addr + ED_NOVELL_DATA, *(u_short *)savebyte);
+ }
}
/*
@@ -2333,8 +2334,9 @@ ed_pio_write_mbufs(sc, m, dst)
log(LOG_WARNING, "ed%d: remote transmit DMA failed to complete\n",
sc->arpcom.ac_if.if_unit);
ed_reset(sc->arpcom.ac_if.if_unit);
+ return(0);
}
- return (len);
+ return (total_len);
}
/*
diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c
index 14710d0..cc6f9ef 100644
--- a/sys/i386/isa/if_ed.c
+++ b/sys/i386/isa/if_ed.c
@@ -13,7 +13,7 @@
* the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,
* and a variety of similar clones.
*
- * $Id: if_ed.c,v 1.61 1995/01/01 03:54:34 davidg Exp $
+ * $Id: if_ed.c,v 1.62 1995/01/01 06:38:14 davidg Exp $
*/
#include "ed.h"
@@ -1550,6 +1550,8 @@ outloop:
}
} else {
len = ed_pio_write_mbufs(sc, m, buffer);
+ if (len == 0)
+ goto outloop;
}
sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN);
@@ -2234,15 +2236,15 @@ ed_pio_write_mbufs(sc, m, dst)
struct mbuf *m;
unsigned short dst;
{
- unsigned short len, dma_len;
+ unsigned short total_len, dma_len;
struct mbuf *mp;
int maxwait = 100; /* about 120us */
/* First, count up the total number of bytes to copy */
- for (len = 0, mp = m; mp; mp = mp->m_next)
- len += mp->m_len;
+ for (total_len = 0, mp = m; mp; mp = mp->m_next)
+ total_len += mp->m_len;
- dma_len = len;
+ dma_len = total_len;
if (sc->isa16bit && (dma_len & 1))
dma_len++;
@@ -2287,14 +2289,13 @@ ed_pio_write_mbufs(sc, m, dst)
wantbyte = 0;
while (m) {
- data = mtod(m, caddr_t);
len = m->m_len;
if (len) {
+ data = mtod(m, caddr_t);
/* finish the last word */
if (wantbyte) {
savebyte[1] = *data;
- outw(sc->asic_addr + ED_NOVELL_DATA,
- *((unsigned short *) savebyte));
+ outw(sc->asic_addr + ED_NOVELL_DATA, *(u_short *)savebyte);
data++;
len--;
wantbyte = 0;
@@ -2315,9 +2316,9 @@ ed_pio_write_mbufs(sc, m, dst)
m = m->m_next;
}
/* spit last byte */
- if (wantbyte)
- outw(sc->asic_addr + ED_NOVELL_DATA,
- *((unsigned short *) savebyte));
+ if (wantbyte) {
+ outw(sc->asic_addr + ED_NOVELL_DATA, *(u_short *)savebyte);
+ }
}
/*
@@ -2333,8 +2334,9 @@ ed_pio_write_mbufs(sc, m, dst)
log(LOG_WARNING, "ed%d: remote transmit DMA failed to complete\n",
sc->arpcom.ac_if.if_unit);
ed_reset(sc->arpcom.ac_if.if_unit);
+ return(0);
}
- return (len);
+ return (total_len);
}
/*
OpenPOWER on IntegriCloud