diff options
author | Valentin Yakovenkov <yakovenkov@niistt.ru> | 2010-04-23 09:40:23 +0400 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2010-05-03 14:52:49 -0700 |
commit | bd75db3feb9a8e4123b76006dbe582b71adbf22f (patch) | |
tree | b4007dcf9f70ee8c46439d854bd56f2bc03693a2 /drivers | |
parent | f0588fdf921c63f84051923bb29eb4255d62a6e7 (diff) | |
download | u-boot-bd75db3feb9a8e4123b76006dbe582b71adbf22f.tar.gz |
smc911x driver frame alignment patch
SMSC911x chips have alignment function to allow frame payload data
(which comes after 14-bytes ethernet header) to be aligned at some
boundary when reading it from fifo (usually - 4 bytes boundary).
This is done by inserting fake zeros bytes BEFORE actual frame data when
reading from SMSC's fifo.
This function controlled by RX_CFG register. There are bits that
represents amount of fake bytes to be inserted.
Linux uses alignment of 4 bytes. Ethernet frame header is 14 bytes long,
so we need to add 2 fake bytes to get payload data aligned at 4-bytes
boundary.
Linux driver does this by adding IP_ALIGNMENT constant (defined at
skb.h) when calculating fifo data length. All network subsystem of Linux
uses this constant too when calculating different offsets.
But u-boot does not use any packet data alignment, so we don't need to
add anything when calculating fifo data length.
Moreover, driver zeros the RX_CFG register just one line up, so chip
does not insert any fake data at the beginig. So calculated data length
is always bigger by 1 word.
It seems that at almost every packet read we get an underflow condition
at fifo and possible corruption of data. Especially at continuous
transfers, such as tftp.
Just after removing this magic addition, I've got tftp transfer speed as
it aught to be at 100Mbps. It was really slow before.
It seems that fifo underflow occurs only when using byte packing on
32-bit blackfin bus (may be because of very small delay between reads).
Signed-off-by: Valentin Yakovenkov <yakovenkov@niistt.ru>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/smc911x.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index cac08d0a7c..f2fc88b71d 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -220,7 +220,7 @@ static int smc911x_rx(struct eth_device *dev) smc911x_reg_write(dev, RX_CFG, 0); - tmplen = (pktlen + 2+ 3) / 4; + tmplen = (pktlen + 3) / 4; while (tmplen--) *data++ = pkt_data_pull(dev, RX_DATA_FIFO); |