summaryrefslogtreecommitdiffstats
path: root/sys/dev/ti/if_tireg.h
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2006-01-03 06:14:07 +0000
committeryongari <yongari@FreeBSD.org>2006-01-03 06:14:07 +0000
commitd2cea5305fb9934620b0b2ddaccb11e6d59f8462 (patch)
treec77b81746e8a610fb9c8fb2379a3a69489f2371c /sys/dev/ti/if_tireg.h
parentbe8db3dd12d8def6ec9dd7b61f9888340e2322ce (diff)
downloadFreeBSD-src-d2cea5305fb9934620b0b2ddaccb11e6d59f8462.zip
FreeBSD-src-d2cea5305fb9934620b0b2ddaccb11e6d59f8462.tar.gz
- Tx side bus_dmamap_load_mbuf_sg(9) support. This reduces bookkeeping
requiried to keep consistent softc state before/after callback function invocation and supposed to be sligntly faster than previous one as it wouldn't incur callback overhead. With this change callback function was gone. - Decrease TI_MAXTXSEGS to 32 from 128. It seems that most mbuf chain length is less than 32 and it would be re-packed with m_defrag(9) if its chain length is larger than TI_MAXTXSEGS. This would protect ti(4) against possible kernel stack overflow when txsegs[] is put on stack. Alternatively, we can embed the txsegs[] into softc. However, that would waste memory and make Tx/Rx speration hard when we want to sperate Tx/Rx handlers to optimize locking. - Fix dma map tracking used in Tx path. Previously it used the dma map of the last mbuf chain in ti_txeof() which was incorrect as ti(4) used dma map of the first mbuf chain when it loads a mbuf chain with bus_dmamap_load_mbuf(9). Correct the bug by introducing queues that keep track of active/inactive dma maps/mbuf chain. - Use ti_txcnt to check whether driver need to set watchdog timer instead of blidnly clearing the timer in ti_txeof(). - Remove the 3rd arg. of ti_encap(). Since ti(4) now caches the last descriptor index(ti_tx_saved_prodidx) used in Tx there is no need to pass it as a fuction arg. - Change data type of producer/consumer index to int from u_int16_t in order to remove implicit type conversions in Tx/Rx handlers. - Check interface queue before getting a mbuf chain to reduce locking overhead. - Check number of available Tx descriptores to be 16 or higher in ti_start(). This wouldn't protect Tx descriptor shortage but it would reduce number of bus_dmamap_unload(9) calls in ti_encap() when we are about to running out of Tx descriptors. - Command NIC to send packets ony when the driver really has packets enqueued. Previously it always set TI_MB_SENDPROD_IDX which would command NIC to DMA Tx descriptors into NIC local memory regardless of Tx descriptor changes. Reviewed by: scottl
Diffstat (limited to 'sys/dev/ti/if_tireg.h')
-rw-r--r--sys/dev/ti/if_tireg.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/sys/dev/ti/if_tireg.h b/sys/dev/ti/if_tireg.h
index 97f7077..5f0bda9 100644
--- a/sys/dev/ti/if_tireg.h
+++ b/sys/dev/ti/if_tireg.h
@@ -399,7 +399,7 @@
#define TI_MINI_RX_RING_CNT 1024
#define TI_RETURN_RING_CNT 2048
-#define TI_MAXTXSEGS 128
+#define TI_MAXTXSEGS 32
/*
* Possible TX ring sizes.
@@ -904,6 +904,14 @@ struct ti_event_desc {
#define TI_RESID (TI_JPAGESZ - (TI_JLEN * TI_JSLOTS) % TI_JPAGESZ)
#define TI_JMEM ((TI_JLEN * TI_JSLOTS) + TI_RESID)
+struct ti_txdesc {
+ struct mbuf *tx_m;
+ bus_dmamap_t tx_dmamap;
+ STAILQ_ENTRY(ti_txdesc) tx_q;
+};
+
+STAILQ_HEAD(ti_txdq, ti_txdesc);
+
/*
* Ring structures. Most of these reside in host memory and we tell
* the NIC where they are via the ring control blocks. The exceptions
@@ -942,8 +950,9 @@ struct ti_ring_data {
* not the other way around.
*/
struct ti_chain_data {
- struct mbuf *ti_tx_chain[TI_TX_RING_CNT];
- bus_dmamap_t ti_tx_maps[TI_TX_RING_CNT];
+ struct ti_txdesc ti_txdesc[TI_TX_RING_CNT];
+ struct ti_txdq ti_txfreeq;
+ struct ti_txdq ti_txbusyq;
struct mbuf *ti_rx_std_chain[TI_STD_RX_RING_CNT];
bus_dmamap_t ti_rx_std_maps[TI_STD_RX_RING_CNT];
struct mbuf *ti_rx_jumbo_chain[TI_JUMBO_RX_RING_CNT];
@@ -1009,14 +1018,14 @@ struct ti_softc {
#define ti_ev_prodidx ti_rdata->ti_ev_prodidx_r
#define ti_return_prodidx ti_rdata->ti_return_prodidx_r
#define ti_tx_considx ti_rdata->ti_tx_considx_r
- u_int16_t ti_tx_saved_prodidx;
- u_int16_t ti_tx_saved_considx;
- u_int16_t ti_rx_saved_considx;
- u_int16_t ti_ev_saved_considx;
- u_int16_t ti_cmd_saved_prodidx;
- 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 */
+ int ti_tx_saved_prodidx;
+ int ti_tx_saved_considx;
+ int ti_rx_saved_considx;
+ int ti_ev_saved_considx;
+ int ti_cmd_saved_prodidx;
+ int ti_std; /* current std ring head */
+ int ti_mini; /* current mini ring head */
+ int ti_jumbo; /* current jumo ring head */
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;
OpenPOWER on IntegriCloud