diff options
author | Phil Sutter <n0-1@freewrt.org> | 2009-01-15 13:29:55 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-20 01:23:00 +0100 |
commit | 6a2fe9834e578590f4a2fbe18a574465ab0e127c (patch) | |
tree | 0560c9a31716369e3b32dda6560e98d0a9322bd8 /drivers/net/korina.c | |
parent | cxgb3: Fix LRO misalignment (diff) | |
download | linux-6a2fe9834e578590f4a2fbe18a574465ab0e127c.tar.xz linux-6a2fe9834e578590f4a2fbe18a574465ab0e127c.zip |
korina: fix loop back of receive descriptors
After the last loop iteration, i has the value RC32434_NUM_RDS and
therefore leads to an index overflow when used afterwards to address the
last element. This is yet another another bug introduced when rewriting
parts of the driver for upstream preparation, as the original driver
used 'RC32434_NUM_RDS - 1' instead.
Signed-off-by: Phil Sutter <n0-1@freewrt.org>
Acked-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/korina.c')
-rw-r--r-- | drivers/net/korina.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/korina.c b/drivers/net/korina.c index 1d6e48e13366..67fbdf40aceb 100644 --- a/drivers/net/korina.c +++ b/drivers/net/korina.c @@ -769,11 +769,12 @@ static void korina_alloc_ring(struct net_device *dev) lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]); } - /* loop back */ - lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[0]); - lp->rx_next_done = 0; + /* loop back receive descriptors, so the last + * descriptor points to the first one */ + lp->rd_ring[i - 1].link = CPHYSADDR(&lp->rd_ring[0]); + lp->rd_ring[i - 1].control |= DMA_DESC_COD; - lp->rd_ring[i].control |= DMA_DESC_COD; + lp->rx_next_done = 0; lp->rx_chain_head = 0; lp->rx_chain_tail = 0; lp->rx_chain_status = desc_empty; |