Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jun 1997 14:36:10 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        hackers@FreeBSD.ORG, mcgovern@spoon.beta.com
Subject:   Re: Need help with fastest way to move data...
Message-ID:  <199706040436.OAA14694@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I've completed a prototype device driver for the Cyclades Cyclom-Z card, and
>I'm hoping to make it available to everyone by the end of the week.
>Unfortunately, its under-performing a 16550 UART, and I suspect that its due
>to how I'm doing I/O with the card. 
>
>Currently, I'm moving a byte at a time to the card (ie - read - I loop,
>moving a byte at a time until the Xmit/Recv buffer is full/empty for
>each TX or RX interrupt I get). Obviously, on a PCI bus (not to mention
>internally), this is terribly inefficient. With the 32 bit bus, I'm
>hoping to be able to move 4 characters at a time, and thereby increase
>performace of this chunk of code by 3-4 times.
>
>The question I have is what is the best way to do this? I'm having some
>problems with q_to_b() locking up the system (I'm not quite sure why, I
>just know it is), but I'm not even sure if this is the best way to move the
>data.

I wouldn't trust q_to_b() for device memory, although the si driver
uses it.  q_to_b() uses bcopy() and bcopy() doesn't worry about alignment.
Misaligned writes might not work for all devices/buses, and they might be
a bit slow.  Apart from this, q_to_b() is the fastest method of copying
a clist to a linear buffer.  You may already have lost the factor of
3-4 for misaligned memory (probably not, since memory is usually faster
than the PCI bus and may be buffered better (my P5/Triton-1 system only
loses a factor of 1.5 for misaligned writes; P5's don't lose much for
misaligned reads since everything is cached)).

Bruce



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