summaryrefslogtreecommitdiffstats
path: root/sys/dev/ti
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1999-07-05 20:19:41 +0000
committerwpaul <wpaul@FreeBSD.org>1999-07-05 20:19:41 +0000
commit7dc88e732223fa4c5fbb800fee54b7f1ca85748b (patch)
treefd3e056cfc0e86d66dd7738e427169eb9e80e870 /sys/dev/ti
parent9e2349cc5f67f792f1067ad68eb1597b0c161cc7 (diff)
downloadFreeBSD-src-7dc88e732223fa4c5fbb800fee54b7f1ca85748b.zip
FreeBSD-src-7dc88e732223fa4c5fbb800fee54b7f1ca85748b.tar.gz
Remove ti_refill_rx_rings() and associated stuff; replace dirty RX buffers
in ti_rxeof() instead. This doesn't really seem to provide much in the way of a performance boost, and I'm pretty sure it can cause mbuf leakage in some extreme cases.
Diffstat (limited to 'sys/dev/ti')
-rw-r--r--sys/dev/ti/if_ti.c95
-rw-r--r--sys/dev/ti/if_tireg.h11
2 files changed, 29 insertions, 77 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index a4af011..99d8b7a 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_ti.c,v 1.6 1999/05/24 14:56:55 wpaul Exp $
+ * $Id: if_ti.c,v 1.114 1999/07/05 19:20:31 wpaul Exp $
*/
/*
@@ -128,7 +128,7 @@
#if !defined(lint)
static const char rcsid[] =
- "$Id: if_ti.c,v 1.6 1999/05/24 14:56:55 wpaul Exp $";
+ "$Id: if_ti.c,v 1.114 1999/07/05 19:20:31 wpaul Exp $";
#endif
/*
@@ -198,7 +198,6 @@ static int ti_init_rx_ring_jumbo __P((struct ti_softc *));
static void ti_free_rx_ring_jumbo __P((struct ti_softc *));
static int ti_init_rx_ring_mini __P((struct ti_softc *));
static void ti_free_rx_ring_mini __P((struct ti_softc *));
-static void ti_refill_rx_rings __P((struct ti_softc *));
static void ti_free_tx_ring __P((struct ti_softc *));
static int ti_init_tx_ring __P((struct ti_softc *));
@@ -770,8 +769,7 @@ static int ti_newbuf_std(sc, i, m)
}
}
- m_new->m_len -= ETHER_ALIGN;
- m_new->m_data += ETHER_ALIGN;
+ m_adj(m_new, ETHER_ALIGN);
sc->ti_cdata.ti_rx_std_chain[i] = m_new;
r = &sc->ti_rdata->ti_rx_std_ring[i];
TI_HOSTADDR(r->ti_addr) = vtophys(mtod(m_new, caddr_t));
@@ -809,8 +807,7 @@ static int ti_newbuf_mini(sc, i, m)
return(ENOBUFS);
}
}
- m_new->m_len -= ETHER_ALIGN;
- m_new->m_data += ETHER_ALIGN;
+ m_adj(m_new, ETHER_ALIGN);
r = &sc->ti_rdata->ti_rx_mini_ring[i];
sc->ti_cdata.ti_rx_mini_chain[i] = m_new;
TI_HOSTADDR(r->ti_addr) = vtophys(mtod(m_new, caddr_t));
@@ -901,8 +898,7 @@ static int ti_init_rx_ring_std(sc)
};
TI_UPDATE_STDPROD(sc, i - 1);
- sc->ti_std_old = sc->ti_std = i - 1;
- sc->ti_std_cnt = 0;
+ sc->ti_std = i - 1;
return(0);
}
@@ -936,8 +932,7 @@ static int ti_init_rx_ring_jumbo(sc)
};
TI_UPDATE_JUMBOPROD(sc, i - 1);
- sc->ti_jumbo_old = sc->ti_jumbo = i - 1;
- sc->ti_jumbo_cnt = 0;
+ sc->ti_jumbo = i - 1;
return(0);
}
@@ -970,8 +965,7 @@ static int ti_init_rx_ring_mini(sc)
};
TI_UPDATE_MINIPROD(sc, i - 1);
- sc->ti_mini_old = sc->ti_mini = i - 1;
- sc->ti_mini_cnt = 0;
+ sc->ti_mini = i - 1;
return(0);
}
@@ -993,55 +987,6 @@ static void ti_free_rx_ring_mini(sc)
return;
}
-/*
- * In order to reduce the amount of work we have to do in the interrupt
- * handler, we delay putting new buffers in the receive rings until a
- * certain amount have been used. This lets us hand over descriptors to
- * the NIC in fairly large chunks instead of one (or a few) at a time,
- * and it lets tx_rxeof() run a bit faster some of the time.
- */
-static void ti_refill_rx_rings(sc)
- struct ti_softc *sc;
-{
- register int i;
- struct ti_cmd_desc cmd;
-
- if (sc->ti_std_cnt > 15) {
- for (i = sc->ti_std_old; i != sc->ti_std;
- TI_INC(i, TI_STD_RX_RING_CNT)) {
- if (ti_newbuf_std(sc, i, NULL) == ENOBUFS)
- break;
- };
- TI_UPDATE_STDPROD(sc, i);
- sc->ti_std_old = i;
- sc->ti_std_cnt = 0;
- }
-
- if (sc->ti_jumbo_cnt > 15) {
- for (i = sc->ti_jumbo_old; i != sc->ti_jumbo;
- TI_INC(i, TI_JUMBO_RX_RING_CNT)) {
- if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS)
- break;
- };
- TI_UPDATE_JUMBOPROD(sc, i);
- sc->ti_jumbo_old = i;
- sc->ti_jumbo_cnt = 0;
- }
-
- if (sc->ti_mini_cnt > 15) {
- for (i = sc->ti_mini_old; i != sc->ti_mini;
- TI_INC(i, TI_MINI_RX_RING_CNT)) {
- if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS)
- break;
- };
- TI_UPDATE_MINIPROD(sc, i);
- sc->ti_mini_old = i;
- sc->ti_mini_cnt = 0;
- }
-
- return;
-}
-
static void ti_free_tx_ring(sc)
struct ti_softc *sc;
{
@@ -1762,6 +1707,7 @@ static void ti_rxeof(sc)
struct ti_softc *sc;
{
struct ifnet *ifp;
+ struct ti_cmd_desc cmd;
ifp = &sc->arpcom.ac_if;
@@ -1797,10 +1743,13 @@ static void ti_rxeof(sc)
if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
ifp->if_ierrors++;
ti_newbuf_jumbo(sc, sc->ti_jumbo, m);
- TI_INC(sc->ti_jumbo_old, TI_JUMBO_RX_RING_CNT);
continue;
}
- sc->ti_jumbo_cnt++;
+ if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) == ENOBUFS) {
+ ifp->if_ierrors++;
+ ti_newbuf_jumbo(sc, sc->ti_jumbo, m);
+ continue;
+ }
} else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) {
TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT);
m = sc->ti_cdata.ti_rx_mini_chain[rxidx];
@@ -1808,10 +1757,13 @@ static void ti_rxeof(sc)
if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
ifp->if_ierrors++;
ti_newbuf_mini(sc, sc->ti_mini, m);
- TI_INC(sc->ti_mini_old, TI_MINI_RX_RING_CNT);
continue;
}
- sc->ti_mini_cnt++;
+ if (ti_newbuf_mini(sc, sc->ti_mini, NULL) == ENOBUFS) {
+ ifp->if_ierrors++;
+ ti_newbuf_mini(sc, sc->ti_mini, m);
+ continue;
+ }
} else {
TI_INC(sc->ti_std, TI_STD_RX_RING_CNT);
m = sc->ti_cdata.ti_rx_std_chain[rxidx];
@@ -1819,10 +1771,13 @@ static void ti_rxeof(sc)
if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
ifp->if_ierrors++;
ti_newbuf_std(sc, sc->ti_std, m);
- TI_INC(sc->ti_std_old, TI_STD_RX_RING_CNT);
continue;
}
- sc->ti_std_cnt++;
+ if (ti_newbuf_std(sc, sc->ti_std, NULL) == ENOBUFS) {
+ ifp->if_ierrors++;
+ ti_newbuf_std(sc, sc->ti_std, m);
+ continue;
+ }
}
m->m_pkthdr.len = m->m_len = cur_rx->ti_len;
@@ -1878,7 +1833,9 @@ static void ti_rxeof(sc)
CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX,
sc->ti_rx_saved_considx);
- ti_refill_rx_rings(sc);
+ TI_UPDATE_STDPROD(sc, sc->ti_std);
+ TI_UPDATE_MINIPROD(sc, sc->ti_mini);
+ TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo);
return;
}
diff --git a/sys/dev/ti/if_tireg.h b/sys/dev/ti/if_tireg.h
index c79336a..31121bc 100644
--- a/sys/dev/ti/if_tireg.h
+++ b/sys/dev/ti/if_tireg.h
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_tireg.h,v 1.3 1999/05/26 23:01:50 gallatin Exp $
+ * $Id: if_tireg.h,v 1.46 1999/07/05 19:20:31 wpaul Exp $
*/
/*
@@ -1135,12 +1135,6 @@ struct ti_softc {
u_int16_t ti_std; /* current std ring head */
u_int16_t ti_mini; /* current mini ring head */
u_int16_t ti_jumbo; /* current jumo ring head */
- u_int16_t ti_std_old;
- u_int16_t ti_mini_old;
- u_int16_t ti_jumbo_old;
- u_int16_t ti_std_cnt;
- u_int16_t ti_mini_cnt;
- u_int16_t ti_jumbo_cnt;
SLIST_HEAD(__ti_mchead, ti_mc_entry) ti_mc_listhead;
SLIST_HEAD(__ti_jfreehead, ti_jpool_entry) ti_jfree_listhead;
SLIST_HEAD(__ti_jinusehead, ti_jpool_entry) ti_jinuse_listhead;
@@ -1185,6 +1179,7 @@ struct ti_softc {
#ifdef __alpha__
#undef vtophys
-#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va)
+#define vtophys(va) (pmap_kextract(((vm_offset_t) (va))) \
+ + 1*1024*1024*1024)
#endif
OpenPOWER on IntegriCloud