Skip to contentSkip to conversation

korina: fix loop back of receive descriptors

PATCH Applied Phil Sutter 3 participants 3 messages Jan 15, 2009 – Jan 20, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 korina: fix loop back of receive descriptors

After the last loop iteration, i has the value RC32434_NUM_RDS and therefore leads to an index overflow when used afterwards to address the last element. This is yet another another bug introduced when rewriting parts of the driver for upstream preparation, as the original driver used 'RC32434_NUM_RDS - 1' instead.

---
 drivers/net/korina.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/korina.c +5 -4
index 1d6e48e..67fbdf4 100644
@@ -769,11 +769,12 @@ static void korina_alloc_ring(struct net_device *dev)
 		lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]);
 	}
 
-	/* loop back */
-	lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[0]);
-	lp->rx_next_done  = 0;
+	/* loop back receive descriptors, so the last
+	 * descriptor points to the first one */
+	lp->rd_ring[i - 1].link = CPHYSADDR(&lp->rd_ring[0]);
+	lp->rd_ring[i - 1].control |= DMA_DESC_COD;
 
-	lp->rd_ring[i].control |= DMA_DESC_COD;
+	lp->rx_next_done  = 0;
 	lp->rx_chain_head = 0;
 	lp->rx_chain_tail = 0;
 	lp->rx_chain_status = desc_empty;
Signature · 1 line
1.5.6.4
Acked-by on v1 1/1
#1 lore raw

Le Thursday 15 January 2009 23:29:55 Phil Sutter, vous avez écrit :

Quoted 7 lines

After the last loop iteration, i has the value RC32434_NUM_RDS and therefore leads to an index overflow when used afterwards to address the last element. This is yet another another bug introduced when rewriting parts of the driver for upstream preparation, as the original driver used 'RC32434_NUM_RDS - 1' instead.

Signature · 4 lines
Best regards, Florian Fainelli
Email : [email protected]
http://openwrt.org
-------------------------------
maintainer Applied
#2 lore raw

From: Florian Fainelli <[email protected]>
Date: Mon, 19 Jan 2009 22:07:30 +0100

Quoted 10 lines

Le Thursday 15 January 2009 23:29:55 Phil Sutter, vous avez écrit :

Quoted 7 lines

After the last loop iteration, i has the value RC32434_NUM_RDS and therefore leads to an index overflow when used afterwards to address the last element. This is yet another another bug introduced when rewriting parts of the driver for upstream preparation, as the original driver used 'RC32434_NUM_RDS - 1' instead.

Applied.