[Etherboot-developers] Descriptor alignment question
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: Timothy L. <tl...@ro...> - 2003-03-06 22:42:09
|
Hi
I have not looked at the sundance driver in a bit, but I seem to be
still wondering why it is so slow. I was never sure whether the
descriptor was properly aligned.
The following is in the spec for the sundance st201 chip:
Transmit Next Pointer, the first double word in the TFD contains the
physical address of the next TFD in the TxDMAList. The value of zero
accompanies the last frame of the list and it indicates there are no
more TFD=92s in the TxDMAList. All TFD=92s must be aligned on 8-byte
physical address boundaries, requiring Bits [2..0] of TxDMANextPtr to
be zero.
The first dword in the RFD contains the physical address of the next
RFD in the RxDMAList. If this is the last RFD in the RxDMAList, then
this value must be zero. RFDs must be aligned on 8-byte physical
address boundaries.
Does the following code do this alignment correctly? Is there any need
to align the buffers?
/* The Rx and Tx buffer descriptors.
*/
struct netdev_desc {
u32 next_desc;
u32 status;
u32 addr;
u32 length;
};
/* Define the TX Descriptor */
static struct netdev_desc tx_ring[TX_RING_SIZE]
__attribute__ ((aligned(8)));
/* Create a static buffer of size PKT_BUF_SZ for each
TX Descriptor. All descriptors point to a
part of this buffer */
static unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE];
__attribute__ ((aligned(8)));
/* Define the RX Descriptor */
static struct netdev_desc rx_ring[RX_RING_SIZE]
__attribute__ ((aligned(8)));
/* Create a static buffer of size PKT_BUF_SZ for each
RX Descriptor All descriptors point to a
part of this buffer */
static unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ];
__attribute__ ((aligned(8)));
Tim
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 2/25/2003
=20
|