swconfig: add a generic switch reset call
[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 diff --git a/drivers/net/korina.c b/drivers/net/korina.c
14 index dced5e7..f200175 100644
15 --- a/drivers/net/korina.c
16 +++ b/drivers/net/korina.c
17 @@ -199,7 +199,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
18 struct korina_private *lp = netdev_priv(dev);
19 unsigned long flags;
20 u32 length;
21 - u32 chain_index;
22 + u32 chain_prev, chain_next;
23 struct dma_desc *td;
24
25 spin_lock_irqsave(&lp->lock, flags);
26 @@ -231,8 +231,8 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
27 /* Setup the transmit descriptor. */
28 dma_cache_inv((u32) td, sizeof(*td));
29 td->ca = CPHYSADDR(skb->data);
30 - chain_index = (lp->tx_chain_tail - 1) &
31 - KORINA_TDS_MASK;
32 + chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK;
33 + chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK;
34
35 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) {
36 if (lp->tx_chain_status == desc_empty) {
37 @@ -240,7 +240,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
38 td->control = DMA_COUNT(length) |
39 DMA_DESC_COF | DMA_DESC_IOF;
40 /* Move tail */
41 - lp->tx_chain_tail = chain_index;
42 + lp->tx_chain_tail = chain_next;
43 /* Write to NDPTR */
44 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
45 &lp->tx_dma_regs->dmandptr);
46 @@ -251,12 +251,12 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
47 td->control = DMA_COUNT(length) |
48 DMA_DESC_COF | DMA_DESC_IOF;
49 /* Link to prev */
50 - lp->td_ring[chain_index].control &=
51 + lp->td_ring[chain_prev].control &=
52 ~DMA_DESC_COF;
53 /* Link to prev */
54 - lp->td_ring[chain_index].link = CPHYSADDR(td);
55 + lp->td_ring[chain_prev].link = CPHYSADDR(td);
56 /* Move tail */
57 - lp->tx_chain_tail = chain_index;
58 + lp->tx_chain_tail = chain_next;
59 /* Write to NDPTR */
60 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
61 &(lp->tx_dma_regs->dmandptr));
62 @@ -270,17 +270,17 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
63 td->control = DMA_COUNT(length) |
64 DMA_DESC_COF | DMA_DESC_IOF;
65 /* Move tail */
66 - lp->tx_chain_tail = chain_index;
67 + lp->tx_chain_tail = chain_next;
68 lp->tx_chain_status = desc_filled;
69 netif_stop_queue(dev);
70 } else {
71 /* Update tail */
72 td->control = DMA_COUNT(length) |
73 DMA_DESC_COF | DMA_DESC_IOF;
74 - lp->td_ring[chain_index].control &=
75 + lp->td_ring[chain_prev].control &=
76 ~DMA_DESC_COF;
77 - lp->td_ring[chain_index].link = CPHYSADDR(td);
78 - lp->tx_chain_tail = chain_index;
79 + lp->td_ring[chain_prev].link = CPHYSADDR(td);
80 + lp->tx_chain_tail = chain_next;
81 }
82 }
83 dma_cache_wback((u32) td, sizeof(*td));
84 --
85 1.5.6.4
86
87
This page took 0.051071 seconds and 5 git commands to generate.