Date: Fri, 3 Sep 2010 11:21:33 -0700 From: Stanislav Sedov <stas@FreeBSD.org> To: Paul Heyman <PHeyman@adaranet.com> Cc: "jmallett@FreeBSD.org" <jmallett@FreeBSD.org>, Patrick Mahan <PMahan@adaranet.com>, "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org> Subject: Re: Now partially booting on our CN58XX eval board Message-ID: <20100903112133.dfcae3e5.stas@FreeBSD.org> In-Reply-To: <32AB5C9615CC494997D9ABB1DB12783C024C8C5A64@SJ-EXCH-1.adaranet.com> References: <4C81066B.9040902@multi-media-tech.com> <32AB5C9615CC494997D9ABB1DB12783C024C8C5A64@SJ-EXCH-1.adaranet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 3 Sep 2010 08:17:16 -0700 Paul Heyman <PHeyman@adaranet.com> mentioned: > Juli > > Thanks for the pointer regarding limiting the bootmem to 512M. I modified what gets passed to cvmx_bootmem_phy_alloc in the max_addr parameter. > > That gets us past the panic and brings the kernel up to a prompt. > No failure conditions observed on the console > >From the shell prompt all seems well. > > But when we try and ping in or out we seem to get a panic from the ethernet controller. > It does not happen all of the time. It usually take 50 - 200 pings to cause the problem. > I have isolated it to a few places in cvm_oct_tasklet_rx function in ethernet-rx.c. > > 1. At line 293 . it looks like the entire packet is stored in the work entry. I can see the panic in the code, but on the console it also indicates a NULL ptr being passed to cvmx_phys_to_ptr. Not sure if the NULL pointer is caused by the panic. This is what is on the console > > root@-2-/root# WARNING: > cvmx_phys_to_ptr() passed a zero address > panic: cvm_oct_tasklet_rx: not yet implemented; copy in small packet. > KDB: enter: panic > [ thread pid 0 tid 100016 ] > Stopped at kdb_enter+0x50: lui at,0x8358 > db> > > 2. At line 406 of the same file. Calling cvm_oct_mem_fill_fpa results in a TLB miss (store). > Hey, Paul! Try the following patch. It fixed the problem for me, but I had no time to commit it yet. Index: sys/mips/cavium/octe/cavium-ethernet.h =================================================================== --- sys/mips/cavium/octe/cavium-ethernet.h (revision 208288) +++ sys/mips/cavium/octe/cavium-ethernet.h (working copy) @@ -119,6 +119,8 @@ struct ifmedia media; int if_flags; + + struct mtx tx_mtx; } cvm_oct_private_t; Index: sys/mips/cavium/octe/octe.c =================================================================== --- sys/mips/cavium/octe/octe.c (revision 208288) +++ sys/mips/cavium/octe/octe.c (working copy) @@ -78,6 +78,9 @@ #include "miibus_if.h" +#define OCTE_TX_LOCK(priv) mtx_lock(&(priv)->tx_mtx) +#define OCTE_TX_UNLOCK(priv) mtx_unlock(&(priv)->tx_mtx) + static int octe_probe(device_t); static int octe_attach(device_t); static int octe_detach(device_t); @@ -174,6 +177,8 @@ priv->if_flags = ifp->if_flags; + mtx_init(&priv->tx_mtx, ifp->if_xname, "octe tx send queue", MTX_DEF); + for (qos = 0; qos < 16; qos++) { mtx_init(&priv->tx_free_queue[qos].ifq_mtx, ifp->if_xname, "octe tx free queue", MTX_DEF); IFQ_SET_MAXLEN(&priv->tx_free_queue[qos], MAX_OUT_QUEUE_DEPTH); @@ -181,9 +186,11 @@ ether_ifattach(ifp, priv->mac); + OCTE_TX_LOCK(priv); IFQ_SET_MAXLEN(&ifp->if_snd, MAX_OUT_QUEUE_DEPTH); ifp->if_snd.ifq_drv_maxlen = MAX_OUT_QUEUE_DEPTH; IFQ_SET_READY(&ifp->if_snd); + OCTE_TX_UNLOCK(priv); return (0); } @@ -280,8 +287,11 @@ if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; + OCTE_TX_LOCK(priv); while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) + break; /* * XXX @@ -301,17 +311,21 @@ * (3) do the collapse here. */ + OCTE_TX_UNLOCK(priv); if (priv->queue != -1) { error = cvm_oct_xmit(m, ifp); } else { error = cvm_oct_xmit_pow(m, ifp); } + OCTE_TX_LOCK(priv); if (error != 0) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; + OCTE_TX_UNLOCK(priv); return; } } + OCTE_TX_UNLOCK(priv); } static int -- Stanislav Sedov ST4096-RIPE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100903112133.dfcae3e5.stas>