[madwifi] make madwifi compile with kernel 2.6.29.
[openwrt.git] / target / linux / rb532 / patches-2.6.28 / 013-korina_fix_handling_tx_chain_tail.patch
1 Originally this must have been a rewrite error when introducing
2 'chain_index'. But the original driver did not use the previous chain
3 item everywhere: when altering the address tx_chain_tail points to, it
4 should move forward, not backwards.
5 Also this is not an "index" but rather the penultimate element in the
6 chain, so rename it accordingly.
7
8 Signed-off-by: Phil Sutter <n0-1@freewrt.org>
9 ---
10 drivers/net/korina.c | 22 +++++++++++-----------
11 1 files changed, 11 insertions(+), 11 deletions(-)
12
13 --- a/drivers/net/korina.c
14 +++ b/drivers/net/korina.c
15 @@ -199,7 +199,7 @@ static int korina_send_packet(struct sk_
16 struct korina_private *lp = netdev_priv(dev);
17 unsigned long flags;
18 u32 length;
19 - u32 chain_index;
20 + u32 chain_prev, chain_next;
21 struct dma_desc *td;
22
23 spin_lock_irqsave(&lp->lock, flags);
24 @@ -231,8 +231,8 @@ static int korina_send_packet(struct sk_
25 /* Setup the transmit descriptor. */
26 dma_cache_inv((u32) td, sizeof(*td));
27 td->ca = CPHYSADDR(skb->data);
28 - chain_index = (lp->tx_chain_tail - 1) &
29 - KORINA_TDS_MASK;
30 + chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK;
31 + chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK;
32
33 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) {
34 if (lp->tx_chain_status == desc_empty) {
35 @@ -240,7 +240,7 @@ static int korina_send_packet(struct sk_
36 td->control = DMA_COUNT(length) |
37 DMA_DESC_COF | DMA_DESC_IOF;
38 /* Move tail */
39 - lp->tx_chain_tail = chain_index;
40 + lp->tx_chain_tail = chain_next;
41 /* Write to NDPTR */
42 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
43 &lp->tx_dma_regs->dmandptr);
44 @@ -251,12 +251,12 @@ static int korina_send_packet(struct sk_
45 td->control = DMA_COUNT(length) |
46 DMA_DESC_COF | DMA_DESC_IOF;
47 /* Link to prev */
48 - lp->td_ring[chain_index].control &=
49 + lp->td_ring[chain_prev].control &=
50 ~DMA_DESC_COF;
51 /* Link to prev */
52 - lp->td_ring[chain_index].link = CPHYSADDR(td);
53 + lp->td_ring[chain_prev].link = CPHYSADDR(td);
54 /* Move tail */
55 - lp->tx_chain_tail = chain_index;
56 + lp->tx_chain_tail = chain_next;
57 /* Write to NDPTR */
58 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
59 &(lp->tx_dma_regs->dmandptr));
60 @@ -270,17 +270,17 @@ static int korina_send_packet(struct sk_
61 td->control = DMA_COUNT(length) |
62 DMA_DESC_COF | DMA_DESC_IOF;
63 /* Move tail */
64 - lp->tx_chain_tail = chain_index;
65 + lp->tx_chain_tail = chain_next;
66 lp->tx_chain_status = desc_filled;
67 netif_stop_queue(dev);
68 } else {
69 /* Update tail */
70 td->control = DMA_COUNT(length) |
71 DMA_DESC_COF | DMA_DESC_IOF;
72 - lp->td_ring[chain_index].control &=
73 + lp->td_ring[chain_prev].control &=
74 ~DMA_DESC_COF;
75 - lp->td_ring[chain_index].link = CPHYSADDR(td);
76 - lp->tx_chain_tail = chain_index;
77 + lp->td_ring[chain_prev].link = CPHYSADDR(td);
78 + lp->tx_chain_tail = chain_next;
79 }
80 }
81 dma_cache_wback((u32) td, sizeof(*td));
This page took 0.040337 seconds and 5 git commands to generate.