aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/net
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2009-03-26 15:31:15 +0000
committerMichael Brown <mcb30@etherboot.org>2009-03-26 15:44:59 +0000
commit5538a38b9c71fb422cd3b5310051c8150eccdb1d (patch)
tree1501d019e182ec35da6e6e03734fb4e826bf1d94 /src/drivers/net
parent03ff8cd3e26a4dd04068fdf7d1542cbc8fa0b3f7 (diff)
downloadipxe-5538a38b9c71fb422cd3b5310051c8150eccdb1d.zip
ipxe-5538a38b9c71fb422cd3b5310051c8150eccdb1d.tar.gz
ipxe-5538a38b9c71fb422cd3b5310051c8150eccdb1d.tar.bz2
[pcnet32] Fix received packet corruption
The pcnet32 driver mismanages its RX buffers, with the result that packets get corrupted if more than one packet arrives between calls to poll(). Originally-fixed-by: Bill Lortz <Bill.Lortz@premier.org> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Tested-by: Stefan Hajnoczi <stefanha@gmail.com>
Diffstat (limited to 'src/drivers/net')
-rw-r--r--src/drivers/net/pcnet32.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/drivers/net/pcnet32.c b/src/drivers/net/pcnet32.c
index bd39b27..ecd7f2f 100644
--- a/src/drivers/net/pcnet32.c
+++ b/src/drivers/net/pcnet32.c
@@ -216,8 +216,8 @@ struct {
__attribute__ ((aligned(16)));
struct pcnet32_rx_head rx_ring[RX_RING_SIZE]
__attribute__ ((aligned(16)));
- unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE];
- unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ];
+ unsigned char txb[TX_RING_SIZE][PKT_BUF_SZ];
+ unsigned char rxb[RX_RING_SIZE][PKT_BUF_SZ];
} pcnet32_bufs __shared;
/* May need to be moved to mii.h */
@@ -588,7 +588,7 @@ static void pcnet32_transmit(struct nic *nic __unused, const char *d, /* Destina
status = 0x8300;
/* point to the current txb incase multiple tx_rings are used */
- ptxb = pcnet32_bufs.txb + (lp->cur_tx * PKT_BUF_SZ);
+ ptxb = pcnet32_bufs.txb[lp->cur_tx];
/* copy the packet to ring buffer */
memcpy(ptxb, d, ETH_ALEN); /* dst */