aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <n0-1@freewrt.org>2009-01-15 00:50:41 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-15 11:28:20 -0500
commit97bc477cbc3d63f2a29c2c81031434b3a082f44c (patch)
tree36d4993d7f48a5460f360ab6e976a5a214296ecb
parent60d3f9827ca455e7272681d67a37137c328d7012 (diff)
korina: fix handling tx_chain_tail
Originally this must have been a rewrite error when introducing 'chain_index'. But the original driver did not use the previous chain item everywhere: when altering the address tx_chain_tail points to, it should move forward, not backwards. Also this is not an "index" but rather the penultimate element in the chain, so rename it accordingly. Signed-off-by: Phil Sutter <n0-1@freewrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/korina.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index dced5e71463a..f20017502519 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -199,7 +199,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
199 struct korina_private *lp = netdev_priv(dev); 199 struct korina_private *lp = netdev_priv(dev);
200 unsigned long flags; 200 unsigned long flags;
201 u32 length; 201 u32 length;
202 u32 chain_index; 202 u32 chain_prev, chain_next;
203 struct dma_desc *td; 203 struct dma_desc *td;
204 204
205 spin_lock_irqsave(&lp->lock, flags); 205 spin_lock_irqsave(&lp->lock, flags);
@@ -231,8 +231,8 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
231 /* Setup the transmit descriptor. */ 231 /* Setup the transmit descriptor. */
232 dma_cache_inv((u32) td, sizeof(*td)); 232 dma_cache_inv((u32) td, sizeof(*td));
233 td->ca = CPHYSADDR(skb->data); 233 td->ca = CPHYSADDR(skb->data);
234 chain_index = (lp->tx_chain_tail - 1) & 234 chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK;
235 KORINA_TDS_MASK; 235 chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK;
236 236
237 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) { 237 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) {
238 if (lp->tx_chain_status == desc_empty) { 238 if (lp->tx_chain_status == desc_empty) {
@@ -240,7 +240,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
240 td->control = DMA_COUNT(length) | 240 td->control = DMA_COUNT(length) |
241 DMA_DESC_COF | DMA_DESC_IOF; 241 DMA_DESC_COF | DMA_DESC_IOF;
242 /* Move tail */ 242 /* Move tail */
243 lp->tx_chain_tail = chain_index; 243 lp->tx_chain_tail = chain_next;
244 /* Write to NDPTR */ 244 /* Write to NDPTR */
245 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), 245 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
246 &lp->tx_dma_regs->dmandptr); 246 &lp->tx_dma_regs->dmandptr);
@@ -251,12 +251,12 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
251 td->control = DMA_COUNT(length) | 251 td->control = DMA_COUNT(length) |
252 DMA_DESC_COF | DMA_DESC_IOF; 252 DMA_DESC_COF | DMA_DESC_IOF;
253 /* Link to prev */ 253 /* Link to prev */
254 lp->td_ring[chain_index].control &= 254 lp->td_ring[chain_prev].control &=
255 ~DMA_DESC_COF; 255 ~DMA_DESC_COF;
256 /* Link to prev */ 256 /* Link to prev */
257 lp->td_ring[chain_index].link = CPHYSADDR(td); 257 lp->td_ring[chain_prev].link = CPHYSADDR(td);
258 /* Move tail */ 258 /* Move tail */
259 lp->tx_chain_tail = chain_index; 259 lp->tx_chain_tail = chain_next;
260 /* Write to NDPTR */ 260 /* Write to NDPTR */
261 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), 261 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
262 &(lp->tx_dma_regs->dmandptr)); 262 &(lp->tx_dma_regs->dmandptr));
@@ -270,17 +270,17 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
270 td->control = DMA_COUNT(length) | 270 td->control = DMA_COUNT(length) |
271 DMA_DESC_COF | DMA_DESC_IOF; 271 DMA_DESC_COF | DMA_DESC_IOF;
272 /* Move tail */ 272 /* Move tail */
273 lp->tx_chain_tail = chain_index; 273 lp->tx_chain_tail = chain_next;
274 lp->tx_chain_status = desc_filled; 274 lp->tx_chain_status = desc_filled;
275 netif_stop_queue(dev); 275 netif_stop_queue(dev);
276 } else { 276 } else {
277 /* Update tail */ 277 /* Update tail */
278 td->control = DMA_COUNT(length) | 278 td->control = DMA_COUNT(length) |
279 DMA_DESC_COF | DMA_DESC_IOF; 279 DMA_DESC_COF | DMA_DESC_IOF;
280 lp->td_ring[chain_index].control &= 280 lp->td_ring[chain_prev].control &=
281 ~DMA_DESC_COF; 281 ~DMA_DESC_COF;
282 lp->td_ring[chain_index].link = CPHYSADDR(td); 282 lp->td_ring[chain_prev].link = CPHYSADDR(td);
283 lp->tx_chain_tail = chain_index; 283 lp->tx_chain_tail = chain_next;
284 } 284 }
285 } 285 }
286 dma_cache_wback((u32) td, sizeof(*td)); 286 dma_cache_wback((u32) td, sizeof(*td));