refresh patches
[openwrt/openwrt.git] / target / linux / rb532 / patches-2.6.28 / 017-korina_fix_loop_back_rx_desc.patch
1 After the last loop iteration, i has the value RC32434_NUM_RDS and
2 therefore leads to an index overflow when used afterwards to address the
3 last element. This is yet another another bug introduced when rewriting
4 parts of the driver for upstream preparation, as the original driver
5 used 'RC32434_NUM_RDS - 1' instead.
6
7 Signed-off-by: Phil Sutter <n0-1@freewrt.org>
8 ---
9 drivers/net/korina.c | 9 +++++----
10 1 files changed, 5 insertions(+), 4 deletions(-)
11
12 --- a/drivers/net/korina.c
13 +++ b/drivers/net/korina.c
14 @@ -766,11 +766,12 @@ static void korina_alloc_ring(struct net
15 lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]);
16 }
17
18 - /* loop back */
19 - lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[0]);
20 - lp->rx_next_done = 0;
21 + /* loop back receive descriptors, so the last
22 + * descriptor points to the first one */
23 + lp->rd_ring[i - 1].link = CPHYSADDR(&lp->rd_ring[0]);
24 + lp->rd_ring[i - 1].control |= DMA_DESC_COD;
25
26 - lp->rd_ring[i].control |= DMA_DESC_COD;
27 + lp->rx_next_done = 0;
28 lp->rx_chain_head = 0;
29 lp->rx_chain_tail = 0;
30 lp->rx_chain_status = desc_empty;