summaryrefslogtreecommitdiffstats
path: root/sys/dev/bce
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>2006-11-16 04:04:07 +0000
committerjdp <jdp@FreeBSD.org>2006-11-16 04:04:07 +0000
commit8b8b39ee6f0b7c6eb45607e9dcc17c0197580fdf (patch)
treead452751516ef8c2df61635f84a43397bad9ef74 /sys/dev/bce
parent736f46700d41a6ed15e7b82f1e25aa966d9f0fb9 (diff)
downloadFreeBSD-src-8b8b39ee6f0b7c6eb45607e9dcc17c0197580fdf.zip
FreeBSD-src-8b8b39ee6f0b7c6eb45607e9dcc17c0197580fdf.tar.gz
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
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 2b67c43..7f09135 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);
OpenPOWER on IntegriCloud