Subject: Re: mc* performance patch
To: Tim Kelly <hockey@dialectronics.com>
From: Dave Huang <khym@azeotrope.org>
List: port-macppc
Date: 01/13/2005 13:58:31
On Thu, Jan 13, 2005 at 12:55:01PM -0500, Tim Kelly wrote:
> Alright, I found the problem and turned a previously unuseable mc
> interface into a 980KB/s rip roaring 0 packet loss mc interface. The
> problem turned out to be pretty simple and the temporary fix was only
> one line.
> 
> In if_mc.c, in mc_attach, there is the comment:
>         /*
>          * allocate memory for receive buffer and mark it non-cacheable
>          * XXX This should use the bus_dma interface, since the buffer
>          * needs to be physically contiguous. However, it seems that
>          * at least on my system, malloc() does allocate contiguous
>          * memory. If it's not, suggest reducing the number of buffers
>          * to 2, which will fit in one 4K page.
>          */

Hmm, interesting... that comment is from the mac68k attachment of the
driver (sys/arch/mac68k/obio/if_mc_obio.c), but it looks like when it
got moved to macppc, the corresponding code to check to see if the
buffer is contiguous was left out. The mac68k version will print this
message if it finds the buffer allocated was noncontiguous:
 
mc0: receive DMA buffer not contiguous! Try compiling with "options
MC_RXDMABUFS=2"

As I had mentioned in a private email, I wrote the mc driver for
mac68k, and I know just about nothing about macppc interrupts, DMA,
etc... and it looks like the macppc port of the mc driver was a
quick&dirty job, leaving in comments that definitely don't apply (like
the one saying that it's a driver for the Quadra 660av/840av). So I
guess I'm saying not to take that comment at face value... while
reducing the number of buffers to 2 may have fixed the problem, it's
worth investigating _why_ it fixed the problem. It may turn out that
the problem has nothing to do with noncontiguous DMA buffers.
-- 
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: khym@azeotrope.org |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 29 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++