Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Apr 2008 20:25:13 +0300
From:      Oleg <agile.quad@gmail.com>
To:        pyunyh@gmail.com
Cc:        freebsd-net@freebsd.org
Subject:   Re: [bfe] [panic] Serious error: bfe failed to map RX buffer
Message-ID:  <d0fcb8ea0804291025p42874880w929bcb4a4545684b@mail.gmail.com>
In-Reply-To: <20080417003713.GA28522@cdnetworks.co.kr>
References:  <1733112647.20080417004353@gmail.com> <20080417003713.GA28522@cdnetworks.co.kr>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hi, sorry for long delay, was too busy.
So, I recheck return code of bus_dmamap_load(9) and its exactly ENOMEM.
Here are fresh patch with your suggestions (diff with HEAD)

Best Regards,
  Oleg Dolgov.

2008/4/17, Pyun YongHyeon <pyunyh@gmail.com>:
> On Thu, Apr 17, 2008 at 12:43:53AM +0300, quad wrote:
>   > Hi,
>   >
>   >    FreeBSD amd64 7.0-RELEASE, ULE, SMP.
>   >
>   >    On heavy loads bfe network driver after few messages
>   >
>   >    Serious error: bfe failed to map RX buffer
>   >    Serious error: bfe failed to map RX buffer
>   >    Serious error: bfe failed to map RX buffer
>   >    ...
>   >
>   >    make kernel panic.
>   >
>   >    Here patch.
>   >
>
>
> It would be even better if you can show me the return code of
>  bus_dmamap_load(9). If the error code is not ENOMEM it requires
>  more bus_dma(9) clean up(bfe(4) needs lots of bus_dma(9) fixing
>  and I had no time so far.)
>  Since the caller of bfe_list_newbuf() expects 0 or ENOBUFS it would
>  be even better to return ENOBUFS for failure case instead of
>  returning error code of bus_dmamap_load(9).
>
>  --
>  Regards,
>
> Pyun YongHyeon
>

[-- Attachment #2 --]
--- /home/agile/Projects/anoncvs/src/sys/dev/bfe/if_bfe.c	2008-03-18 04:11:40.000000000 +0200
+++ if_bfe.c	2008-04-29 19:55:27.000000000 +0300
@@ -647,11 +647,12 @@
 	struct bfe_data *r;
 	u_int32_t ctrl;
 	int error;
+	int allocated;
 
 	if ((c < 0) || (c >= BFE_RX_LIST_CNT))
 		return (EINVAL);
 
-	if(m == NULL) {
+	if((allocated = (m == NULL))) {
 		m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
 		if(m == NULL)
 			return (ENOBUFS);
@@ -670,8 +671,13 @@
 	r = &sc->bfe_rx_ring[c];
 	error = bus_dmamap_load(sc->bfe_tag, r->bfe_map, mtod(m, void *),
 			MCLBYTES, bfe_dma_map_desc, d, BUS_DMA_NOWAIT);
-	if (error)
-		printf("Serious error: bfe failed to map RX buffer\n");
+	if (error) {
+		if (allocated)
+			m_free(m);
+		if (error != ENOMEM)
+			printf("Serious error: bfe failed to map RX buffer, error %d\n", error);
+		return (ENOBUFS);
+	}
 	bus_dmamap_sync(sc->bfe_tag, r->bfe_map, BUS_DMASYNC_PREWRITE);
 
 	ctrl = ETHER_MAX_LEN + 32;

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d0fcb8ea0804291025p42874880w929bcb4a4545684b>