IP100A Solve host error problem when in low performance embedded
Subsystems (2)
PATCH 6/6 IP100A Solve host error problem when in low performance embedded
From: Jesse Huang <[email protected]>
Solve host error problem when in low performance embedded
Change Logs:
Solve host error problem when in low performance embedded
---
drivers/net/sundance.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-)
78ff57ea887c19b7552342e990375f5e2bb10af9
drivers/net/sundance.c +22 -4
@@ -1075,7 +1075,7 @@ reset_tx (struct net_device *dev)struct sk_buff *skb;int i;int irq =in_interrupt (); - +tasklet_kill (&np->tx_tasklet);/* Reset tx logic, TxListPtr will be cleaned */ iowrite16 (TxDisable, ioaddr + MACCtrl1); iowrite16 (TxReset | DMAReset | FIFOReset | NetworkReset,
@@ -1646,6 +1646,13 @@ static int netdev_close(struct net_devicstruct sk_buff *skb;int i; +/* Wait and kill tasklet */ +tasklet_kill (&np->rx_tasklet); +tasklet_kill (&np->tx_tasklet); + np->cur_tx = np->dirty_tx =0 ; + np->cur_task =0 ; + np->last_tx=0 ; +netif_stop_queue (dev);if (netif_msg_ifdown (np)) {
@@ -1666,9 +1673,19 @@ static int netdev_close(struct net_devic/* Stop the chip's Tx and Rx processes. */ iowrite16 (TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl1); -/* Wait and kill tasklet */ -tasklet_kill (&np->rx_tasklet); -tasklet_kill (&np->tx_tasklet); +for (i=2000 ;i>0 ;i--) { +if ((readl (ioaddr + DMACtrl)&0xC000 ) ==0 )break ; +mdelay (1 ); + } + +writew (GlobalReset | DMAReset | FIFOReset |NetworkReset, ioaddr +ASICCtrl +2 ); + +for (i=2000 ;i >0 ;i--) + { +if ((readw (ioaddr + ASICCtrl +2 )&ResetBusy) ==0 ) +break ; +mdelay (1 ); + }#ifdef __i386__if (netif_msg_hw (np)) {
@@ -1706,6 +1723,7 @@ #endif /* __i386__ debugging only */ } }for (i =0 ; i <TX_RING_SIZE ; i++) { + np->tx_ring[i].next_desc=0 ; skb = np->tx_skbuff[i];if (skb) { pci_unmap_single(np->pci_dev,
Signature · 1 line
1.3.GIT
Jeff Garzik
NAKQuoted 18 lines · Jesse Huang
From: Jesse Huang <[email protected]>
Solve host error problem when in low performance embedded
Change Logs:
Solve host error problem when in low performance embedded---
drivers/net/sundance.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-)
78ff57ea887c19b7552342e990375f5e2bb10af9drivers/net/sundance.c +0
-0
drivers/net/sundance.c reset_tx (struct net_device *dev) · line 1078
Quoted 5 lines
drivers/net/sundance.c +1
-1@@ -1075,7 +1075,7 @@ reset_tx (struct net_device *dev)struct sk_buff *skb;int i;int irq =in_interrupt (); - +tasklet_kill (&np->tx_tasklet);
NAK, it is a bug to call tasklet_kill() from inside an interrupt.
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1652
Quoted 8 lines
drivers/net/sundance.c +4
-0@@ -1646,6 +1646,13 @@ static int netdev_close(struct net_devicstruct sk_buff *skb;int i; +/* Wait and kill tasklet */ +tasklet_kill (&np->rx_tasklet); +tasklet_kill (&np->tx_tasklet); + np->cur_tx = np->dirty_tx =0 ;
fix source code indent
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1654
Quoted 2 lines
drivers/net/sundance.c +2
-0+ np->cur_task =0 ; + np->last_tx=0 ;
needs whitespace: s/=/ = /
Quoted 4 lines
drivers/net/sundance.c +0
-0netif_stop_queue (dev);if (netif_msg_ifdown (np)) {
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1679
Quoted 10 lines
drivers/net/sundance.c +4
-3@@ -1666,9 +1673,19 @@ static int netdev_close(struct net_devic/* Stop the chip's Tx and Rx processes. */ iowrite16 (TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl1); -/* Wait and kill tasklet */ -tasklet_kill (&np->rx_tasklet); -tasklet_kill (&np->tx_tasklet); +for (i=2000 ;i>0 ;i--) { +if ((readl (ioaddr + DMACtrl)&0xC000 ) ==0 )break ; +mdelay (1 ); + }
(1) fix indentation
(2) add whitespace to 'for' loop
(3) use ioread32(), not readl()
(4) are you certain that DMACtrl should be read as a 32-bit register? In other code, you treat it as a 16-bit register.
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1681
Quoted 1 line
drivers/net/sundance.c +1
-0+writew (GlobalReset | DMAReset | FIFOReset |NetworkReset, ioaddr +ASICCtrl +2 );
(5) use iowrite16() not writew()
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1688
Quoted 6 lines
drivers/net/sundance.c +6
-0+for (i=2000 ;i >0 ;i--) + { +if ((readw (ioaddr + ASICCtrl +2 )&ResetBusy) ==0 ) +break ; +mdelay (1 ); + }
(6) fix indentation to match the rest of the driver
(7) use ioread16(), not readw()
(8) add whitespace to 'for' loop
drivers/net/sundance.c #endif /* __i386__ debugging only */ · line 1726
Quoted 7 lines
drivers/net/sundance.c +1
-0#ifdef __i386__if (netif_msg_hw (np)) {@@ -1706,6 +1723,7 @@ #endif /* __i386__ debugging only */ } }for (i =0 ; i <TX_RING_SIZE ; i++) { + np->tx_ring[i].next_desc=0 ;
(9) add whitespace to assignment: s/=/ = /
Quoted 3 lines
drivers/net/sundance.c +0
-0skb = np->tx_skbuff[i];if (skb) { pci_unmap_single(np->pci_dev,
Jesse Huang
NAKHi Jeff:
I will follow those suggestions. Thanks.
Jesse
----- Original Message -----
From: "Jeff Garzik" <[email protected]>
To: "Jesse Huang" <[email protected]>
Cc: <[email protected]>; <[email protected]>; <[email protected]>
Sent: Friday, August 18, 2006 7:17 PM
Subject: Re: [PATCH 6/6] IP100A Solve host error problem when in low performance embedded
Quoted 18 lines · Jesse Huang
From: Jesse Huang <[email protected]>
Solve host error problem when in low performance embedded
Change Logs:
Solve host error problem when in low performance embedded---
drivers/net/sundance.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-)
78ff57ea887c19b7552342e990375f5e2bb10af9drivers/net/sundance.c +0
-0
drivers/net/sundance.c reset_tx (struct net_device *dev) · line 1078
Quoted 5 lines
drivers/net/sundance.c +1
-1@@ -1075,7 +1075,7 @@ reset_tx (struct net_device *dev)struct sk_buff *skb;int i;int irq =in_interrupt (); - +tasklet_kill (&np->tx_tasklet);
NAK, it is a bug to call tasklet_kill() from inside an interrupt.
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1652
Quoted 8 lines
drivers/net/sundance.c +4
-0@@ -1646,6 +1646,13 @@ static int netdev_close(struct net_devicstruct sk_buff *skb;int i; +/* Wait and kill tasklet */ +tasklet_kill (&np->rx_tasklet); +tasklet_kill (&np->tx_tasklet); + np->cur_tx = np->dirty_tx =0 ;
fix source code indent
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1654
Quoted 2 lines
drivers/net/sundance.c +2
-0+ np->cur_task =0 ; + np->last_tx=0 ;
needs whitespace: s/=/ = /
Quoted 4 lines
drivers/net/sundance.c +0
-0netif_stop_queue (dev);if (netif_msg_ifdown (np)) {
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1679
Quoted 10 lines
drivers/net/sundance.c +4
-3@@ -1666,9 +1673,19 @@ static int netdev_close(struct net_devic/* Stop the chip's Tx and Rx processes. */ iowrite16 (TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl1); -/* Wait and kill tasklet */ -tasklet_kill (&np->rx_tasklet); -tasklet_kill (&np->tx_tasklet); +for (i=2000 ;i>0 ;i--) { +if ((readl (ioaddr + DMACtrl)&0xC000 ) ==0 )break ; +mdelay (1 ); + }
(1) fix indentation
(2) add whitespace to 'for' loop
(3) use ioread32(), not readl()
(4) are you certain that DMACtrl should be read as a 32-bit register? In other code, you treat it as a 16-bit register.
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1680
Quoted 1 line
drivers/net/sundance.c +1
-0+ writew(GlobalReset | DMAReset | FIFOReset |NetworkReset, ioaddr
+ASICCtrl + 2);
(5) use iowrite16() not writew()
drivers/net/sundance.c static int netdev_close(struct net_devic · line 1688
Quoted 6 lines
drivers/net/sundance.c +6
-0+for (i=2000 ;i >0 ;i--) + { +if ((readw (ioaddr + ASICCtrl +2 )&ResetBusy) ==0 ) +break ; +mdelay (1 ); + }
(6) fix indentation to match the rest of the driver
(7) use ioread16(), not readw()
(8) add whitespace to 'for' loop
drivers/net/sundance.c #endif /* __i386__ debugging only */ · line 1726
Quoted 7 lines
drivers/net/sundance.c +1
-0#ifdef __i386__if (netif_msg_hw (np)) {@@ -1706,6 +1723,7 @@ #endif /* __i386__ debugging only */ } }for (i =0 ; i <TX_RING_SIZE ; i++) { + np->tx_ring[i].next_desc=0 ;
(9) add whitespace to assignment: s/=/ = /
Quoted 3 lines
drivers/net/sundance.c +0
-0skb = np->tx_skbuff[i];if (skb) { pci_unmap_single(np->pci_dev,
Hi Jeff:
Quoted 2 lines
(4) are you certain that DMACtrl should be read as a 32-bit register? In other code, you treat it as a 16-bit register.
DMACtrl can read and write both in 16-bit and 32-bit. I will modify all of then as 32-bit.
Thanks.
Jesse