aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bce
diff options
context:
space:
mode:
authorJohn Polstra <jdp@FreeBSD.org>2006-11-16 04:04:07 +0000
committerJohn Polstra <jdp@FreeBSD.org>2006-11-16 04:04:07 +0000
commit6e7b2160a4ac20f67196c97d1f9cf61349af343f (patch)
treead452751516ef8c2df61635f84a43397bad9ef74 /sys/dev/bce
parenteba891af5b57651ba3b22f046958d289c0e2a9fe (diff)
downloadsrc-6e7b2160a4ac20f67196c97d1f9cf61349af343f.tar.gz
src-6e7b2160a4ac20f67196c97d1f9cf61349af343f.zip
In bce_start_locked, check the used_tx_bd count rather than the
descriptor's mbuf pointer to see if the transmit ring is full. The mbuf pointer is set only in the last descriptor of a multi-descriptor packet. By relying on the mbuf pointers of the earlier descriptors, the driver would sometimes overwrite a descriptor belonging to a packet that wasn't completed yet. Also, tx_chain_prod wasn't updated inside the loop, causing the wrong descriptor to be checked after the first iteration. The upshot of all this was the loss of some transmitted packets at medium to high packet rates. In bce_tx_encap, remove a couple of old statements that shuffled around the tx_mbuf_map pointers. These now correspond 1-to-1 with the transmit descriptors, and they are not supposed to be changed. Correct a couple of inaccurate comments. MFC after: 1 month
Notes
Notes: svn path=/head/; revision=164327
Diffstat (limited to 'sys/dev/bce')
-rw-r--r--sys/dev/bce/if_bce.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c
index 2b67c43adc05..7f09135b8c7d 100644
--- a/sys/dev/bce/if_bce.c
+++ b/sys/dev/bce/if_bce.c
@@ -4652,17 +4652,14 @@ bce_tx_encap(struct bce_softc *sc, struct mbuf **m_head)
__FUNCTION__, prod, chain_prod, prod_bseq);
/*
- * Ensure that the map for this transmission
+ * Ensure that the mbuf pointer for this transmission
* is placed at the array index of the last
* descriptor in this chain. This is done
* because a single map is used for all
* segments of the mbuf and we don't want to
- * delete the map before all of the segments
+ * unload the map before all of the segments
* have been freed.
*/
- sc->tx_mbuf_map[TX_CHAIN_IDX(sc->tx_prod)] =
- sc->tx_mbuf_map[chain_prod];
- sc->tx_mbuf_map[chain_prod] = map;
sc->tx_mbuf_ptr[chain_prod] = m0;
sc->used_tx_bd += nsegs;
@@ -4673,7 +4670,7 @@ bce_tx_encap(struct bce_softc *sc, struct mbuf **m_head)
DBRUN(BCE_VERBOSE_SEND, bce_dump_tx_mbuf_chain(sc, chain_prod, nsegs));
- /* prod still points the last used tx_bd at this point. */
+ /* prod points to the next free tx_bd at this point. */
sc->tx_prod = prod;
sc->tx_prod_bseq = prod_bseq;
@@ -4711,8 +4708,11 @@ bce_start_locked(struct ifnet *ifp)
"tx_prod_bseq = 0x%08X\n",
__FUNCTION__, tx_prod, tx_chain_prod, sc->tx_prod_bseq);
- /* Keep adding entries while there is space in the ring. */
- while (sc->tx_mbuf_ptr[tx_chain_prod] == NULL) {
+ /*
+ * Keep adding entries while there is space in the ring. We keep
+ * BCE_TX_SLACK_SPACE entries unused at all times.
+ */
+ while (sc->used_tx_bd < USABLE_TX_BD - BCE_TX_SLACK_SPACE) {
/* Check for any frames to send. */
IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);