From ab160495d3a13b0d45e1efe7cfc64a10c82b1665 Mon Sep 17 00:00:00 2001 From: Rafal Jaworowski Date: Tue, 17 Feb 2009 15:39:16 +0000 Subject: [PATCH] Handle mbuf exhaustion scenario in tsec(4). Without this fix the system would hang under heavy networking load. Submitted by: Leon Theunissen leon ! parsec dot co dot za --- sys/dev/tsec/if_tsec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/tsec/if_tsec.c b/sys/dev/tsec/if_tsec.c index bde6aed1e5f..d6d5eddc6c4 100644 --- a/sys/dev/tsec/if_tsec.c +++ b/sys/dev/tsec/if_tsec.c @@ -1332,7 +1332,12 @@ tsec_receive_intr_locked(struct tsec_softc *sc, int count) if (tsec_new_rxbuf(sc->tsec_rx_mtag, rx_data[i].map, &rx_data[i].mbuf, &rx_data[i].paddr)) { ifp->if_ierrors++; - continue; + /* + * We ran out of mbufs; didn't consume current + * descriptor and have to return it to the queue. + */ + TSEC_BACK_CUR_RX_DESC(sc); + break; } /* Attach new buffer to descriptor and clear flags */