Speedup if_start routine a little. TX threshold logic needs some more

kicking but these changes get me around 1000 KB/sec.
This commit is contained in:
Matthew N. Dodd 2000-01-12 06:42:49 +00:00
parent 2ff4e76374
commit c7c26de958
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55834
2 changed files with 26 additions and 10 deletions

View File

@ -436,9 +436,9 @@ static void
ep_if_start(ifp)
struct ifnet *ifp;
{
register struct ep_softc *sc = ifp->if_softc;
register u_int len;
register struct mbuf *m;
struct ep_softc *sc = ifp->if_softc;
u_int len;
struct mbuf *m;
struct mbuf *top;
int s, pad;
@ -446,17 +446,15 @@ ep_if_start(ifp)
return;
}
s = splimp();
while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
if (ifp->if_flags & IFF_OACTIVE) {
splx(s);
return;
}
startagain:
/* Sneak a peek at the next packet */
m = ifp->if_snd.ifq_head;
if (m == 0) {
splx(s);
return;
}
for (len = 0, top = m; m; m = m->m_next)
@ -485,30 +483,40 @@ startagain:
splx(s);
return;
}
} else {
outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | EP_THRESH_DISABLE);
}
IF_DEQUEUE(&ifp->if_snd, m);
s = splhigh();
outw(BASE + EP_W1_TX_PIO_WR_1, len);
outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); /* Second dword meaningless */
for (top = m; m != 0; m = m->m_next)
if (EP_FTST(sc, F_ACCESS_32_BITS)) {
if (EP_FTST(sc, F_ACCESS_32_BITS)) {
for (top = m; m != 0; m = m->m_next) {
outsl(BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t),
m->m_len / 4);
if (m->m_len & 3)
outsb(BASE + EP_W1_TX_PIO_WR_1,
mtod(m, caddr_t) + (m->m_len & (~3)),
m->m_len & 3);
} else {
}
} else {
for (top = m; m != 0; m = m->m_next) {
outsw(BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t), m->m_len / 2);
if (m->m_len & 1)
outb(BASE + EP_W1_TX_PIO_WR_1,
*(mtod(m, caddr_t) + m->m_len - 1));
}
}
while (pad--)
outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */
splx(s);
if (ifp->if_bpf) {
bpf_mtap(ifp, top);
}
@ -530,7 +538,6 @@ readcheck:
if (ifp->if_snd.ifq_head) {
outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | 8);
}
splx(s);
return;
}
goto startagain;

View File

@ -231,6 +231,15 @@
*
****************************************/
/*
* Command parameter that disables threshold interrupts
* PIO (3c509) cards use 2044. The fifo word-oriented and 2044--2047 work.
* "busmastering" cards need 8188.
* The implicit two-bit upshift done by busmastering cards means
* a value of 2047 disables threshold interrupts on both.
*/
#define EP_THRESH_DISABLE 2047
/*
* Command register. All windows.
*