summaryrefslogtreecommitdiffstats
path: root/sys/dev/bce
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2006-10-19 06:58:01 +0000
committerscottl <scottl@FreeBSD.org>2006-10-19 06:58:01 +0000
commitac5b874a804ef9b603529b5f1c2a41c5a7c9ca52 (patch)
treeea9f463f2d5cd5ae34343c7ee4359268613e03ed /sys/dev/bce
parent10f8629992d410f293ced647bea78aa7728341a4 (diff)
downloadFreeBSD-src-ac5b874a804ef9b603529b5f1c2a41c5a7c9ca52.zip
FreeBSD-src-ac5b874a804ef9b603529b5f1c2a41c5a7c9ca52.tar.gz
Remove some spurious debugging, and use more complete error handling for
tx load and fragmentation problems.
Diffstat (limited to 'sys/dev/bce')
-rw-r--r--sys/dev/bce/if_bce.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c
index 393faf2..1822e24 100644
--- a/sys/dev/bce/if_bce.c
+++ b/sys/dev/bce/if_bce.c
@@ -4563,28 +4563,38 @@ bce_tx_encap(struct bce_softc *sc, struct mbuf **m_head)
if (error == EFBIG) {
/* Try to defrag the mbuf if there are too many segments. */
- printf("bce: need to defrag\n");
DBPRINT(sc, BCE_WARN, "%s(): fragmented mbuf (%d pieces)\n",
__FUNCTION__, map_arg.maxsegs);
m0 = m_defrag(*m_head, M_DONTWAIT);
- if (m0 != NULL) {
- *m_head = m0;
- error = bus_dmamap_load_mbuf_sg(sc->tx_mbuf_tag,
- map, m0, segs, &nsegs, BUS_DMA_NOWAIT);
- }
+ if (m0 == NULL) {
+ m_freem(*m_head);
+ *m_head = NULL;
+ return (ENOBUFS);
+ }
+
+ *m_head = m0;
+ error = bus_dmamap_load_mbuf_sg(sc->tx_mbuf_tag, map, m0,
+ segs, &nsegs, BUS_DMA_NOWAIT);
/* Still getting an error after a defrag. */
- if (error) {
- printf("bce: defrag failed\n");
+ if (error == ENOMEM) {
+ return (error);
+ } else if (error != 0) {
BCE_PRINTF(sc,
"%s(%d): Error mapping mbuf into TX chain!\n",
__FILE__, __LINE__);
+ m_freem(m0);
+ *m_head = NULL;
return (ENOBUFS);
}
-
- } else if (error != 0)
+ } else if (error == ENOMEM) {
+ return (error);
+ } else if (error != 0) {
+ m_freem(m0);
+ *m_head = NULL;
return (error);
+ }
/* prod points to an empty tx_bd at this point. */
OpenPOWER on IntegriCloud