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 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);
22 + u32 chain_prev, chain_next;
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) &
32 + chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK;
33 + chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK;
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;
41 - lp->tx_chain_tail = chain_index;
42 + lp->tx_chain_tail = chain_next;
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;
50 - lp->td_ring[chain_index].control &=
51 + lp->td_ring[chain_prev].control &=
54 - lp->td_ring[chain_index].link = CPHYSADDR(td);
55 + lp->td_ring[chain_prev].link = CPHYSADDR(td);
57 - lp->tx_chain_tail = chain_index;
58 + lp->tx_chain_tail = chain_next;
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;
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);
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 &=
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;
83 dma_cache_wback((u32) td, sizeof(*td));