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.
8 Signed-off-by: Phil Sutter <n0-1@freewrt.org>
10 drivers/net/korina.c | 22 +++++++++++-----------
11 1 files changed, 11 insertions(+), 11 deletions(-)
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);
20 + u32 chain_prev, chain_next;
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) &
30 + chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK;
31 + chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK;
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;
39 - lp->tx_chain_tail = chain_index;
40 + lp->tx_chain_tail = chain_next;
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;
48 - lp->td_ring[chain_index].control &=
49 + lp->td_ring[chain_prev].control &=
52 - lp->td_ring[chain_index].link = CPHYSADDR(td);
53 + lp->td_ring[chain_prev].link = CPHYSADDR(td);
55 - lp->tx_chain_tail = chain_index;
56 + lp->tx_chain_tail = chain_next;
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;
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);
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 &=
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;
81 dma_cache_wback((u32) td, sizeof(*td));