Skip to contentSkip to conversation

KS8695: fix ks8695_rx_irq() bug.

PATCH In review zeal 3 participants 6 messages Nov 16, 2009 – Nov 17, 2009

Subsystems (2)
lore
Share & tools
lore

zeal

author
#0 lore raw

PATCH v2 1/2 KS8695: fix ks8695_rx_irq() bug.

From: zeal <[email protected]>

Sorry for the previously patches. THEY'RE NOT RIGHT. It's my mistake. Please forgive my noise.
Please review the following patches and ignore the last (v1).

ks8695 rx irq is edge-level. Before arriving at irq handler, the corresponding status bit has been clear(irq's ack).
So we should not check it after that.

---
 drivers/net/arm/ks8695net.c |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)
drivers/net/arm/ks8695net.c +7 -15
index 0073d19..e15451a 100644
@@ -433,24 +433,16 @@ ks8695_rx_irq(int irq, void *dev_id)
 {
 	struct net_device *ndev = (struct net_device *)dev_id;
 	struct ks8695_priv *ksp = netdev_priv(ndev);
-	unsigned long status;
-
-	unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
 
 	spin_lock(&ksp->rx_lock);
 
-	status = readl(KS8695_IRQ_VA + KS8695_INTST);
-
-	/*clean rx status bit*/
-	writel(status | mask_bit , KS8695_IRQ_VA + KS8695_INTST);
-
-	if (status & mask_bit) {
-		if (napi_schedule_prep(&ksp->napi)) {
-			/*disable rx interrupt*/
-			status &= ~mask_bit;
-			writel(status , KS8695_IRQ_VA + KS8695_INTEN);
-			__napi_schedule(&ksp->napi);
-		}
+	if (napi_schedule_prep(&ksp->napi)) {
+		unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN);
+		unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
+		/*disable rx interrupt*/
+		status &= ~mask_bit;
+		writel(status , KS8695_IRQ_VA + KS8695_INTEN);
+		__napi_schedule(&ksp->napi);
 	}
 
 	spin_unlock(&ksp->rx_lock);
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 9 lines · zeal

From: zeal <[email protected]>

Sorry for the previously patches. THEY'RE NOT RIGHT. It's my mistake. Please forgive my noise.
Please review the following patches and ignore the last (v1).

ks8695 rx irq is edge-level. Before arriving at irq handler, the corresponding status bit has been clear(irq's ack).
So we should not check it after that.

see <KS8695X Integrated Multi-Port Gateway Solution Register Description> Version 1.00

Interrupt Status Register(INTST Offset 0xE208)

it has said: This edge-triggered interrupt status is cleared by writting 1 , so we should write 1 to clear status bit manually.

Quoted 42 lines
---
 drivers/net/arm/ks8695net.c |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)
drivers/net/arm/ks8695net.c +7 -15
index 0073d19..e15451a 100644
@@ -433,24 +433,16 @@ ks8695_rx_irq(int irq, void *dev_id)
 {
 	struct net_device *ndev = (struct net_device *)dev_id;
 	struct ks8695_priv *ksp = netdev_priv(ndev);
-	unsigned long status;
-
-	unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
 
 	spin_lock(&ksp->rx_lock);
 
-	status = readl(KS8695_IRQ_VA + KS8695_INTST);
-
-	/*clean rx status bit*/
-	writel(status | mask_bit , KS8695_IRQ_VA + KS8695_INTST);
-
-	if (status & mask_bit) {
-		if (napi_schedule_prep(&ksp->napi)) {
-			/*disable rx interrupt*/
-			status &= ~mask_bit;
-			writel(status , KS8695_IRQ_VA + KS8695_INTEN);
-			__napi_schedule(&ksp->napi);
-		}
+	if (napi_schedule_prep(&ksp->napi)) {
+		unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN);
+		unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
+		/*disable rx interrupt*/
+		status &= ~mask_bit;
+		writel(status , KS8695_IRQ_VA + KS8695_INTEN);
+		__napi_schedule(&ksp->napi);
 	}
 
 	spin_unlock(&ksp->rx_lock);
author
#2 lore raw
Quoted 11 lines · Figo.zhang
Quoted 9 lines · zeal

From: zeal <[email protected]>

Sorry for the previously patches. THEY'RE NOT RIGHT. It's my mistake. Please forgive my noise.
Please review the following patches and ignore the last (v1).

ks8695 rx irq is edge-level. Before arriving at irq handler, the corresponding status bit has been clear(irq's ack).
So we should not check it after that.

Quoted 8 lines

see <KS8695X Integrated Multi-Port Gateway Solution Register Description> Version 1.00

Interrupt Status Register(INTST Offset 0xE208)

it has said: This edge-triggered interrupt status is cleared by writting 1 , so we should write 1 to clear status bit manually.

Yeah, but irq_chip's ack has done that.
Please check arch/arm/mach-ks8695/irq.c ks8695_irq_edge_chip->ack()

Quoted 49 lines
Quoted 32 lines

---
 drivers/net/arm/ks8695net.c |   22 +++++++---------------

 1 files changed, 7 insertions(+), 15 deletions(-)
drivers/net/arm/ks8695net.c +0 -15
index 0073d19..e15451a 100644
@@ -433,24 +433,16 @@ ks8695_rx_irq(int irq, void *dev_id)
  {
       struct net_device *ndev = (struct net_device *)dev_id;
       struct ks8695_priv *ksp = netdev_priv(ndev);
-     unsigned long status;
-
-     unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
 
       spin_lock(&ksp->rx_lock);
 
-     status = readl(KS8695_IRQ_VA + KS8695_INTST);
-
-     /*clean rx status bit*/
-     writel(status | mask_bit , KS8695_IRQ_VA + KS8695_INTST);
-
-     if (status & mask_bit) {
-             if (napi_schedule_prep(&ksp->napi)) {
-                     /*disable rx interrupt*/
-                     status &= ~mask_bit;
-                     writel(status , KS8695_IRQ_VA + KS8695_INTEN);
-                     __napi_schedule(&ksp->napi);
-             }

drivers/net/arm/ks8695net.c ks8695_rx_irq(int irq, void *dev_id) · line 448

Quoted 10 lines
drivers/net/arm/ks8695net.c +7 -0
+     if (napi_schedule_prep(&ksp->napi)) {
+             unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN);
+             unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
+             /*disable rx interrupt*/
+             status &= ~mask_bit;
+             writel(status , KS8695_IRQ_VA + KS8695_INTEN);
+             __napi_schedule(&ksp->napi);
       }
 
       spin_unlock(&ksp->rx_lock);

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Thanks & Regards

zeal
#3 lore raw
Quoted 15 lines · zeal
Quoted 14 lines · Figo.zhang
Quoted 9 lines · zeal

From: zeal <[email protected]>

Sorry for the previously patches. THEY'RE NOT RIGHT. It's my mistake. Please forgive my noise.
Please review the following patches and ignore the last (v1).

ks8695 rx irq is edge-level. Before arriving at irq handler, the corresponding status bit has been clear(irq's ack).
So we should not check it after that.

see <KS8695X Integrated Multi-Port Gateway Solution Register Description> Version 1.00

Quoted 7 lines
Quoted 5 lines

Interrupt Status Register(INTST Offset 0xE208)

it has said: This edge-triggered interrupt status is cleared by writting 1 , so we should write 1 to clear status bit manually.

Yeah, but irq_chip's ack has done that.
Please check arch/arm/mach-ks8695/irq.c ks8695_irq_edge_chip->ack()

yes, you are right, but you have better add this description at commit log.

Quoted 53 lines
Quoted 50 lines
Quoted 33 lines
---
 drivers/net/arm/ks8695net.c |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)
drivers/net/arm/ks8695net.c +0 -15
index 0073d19..e15451a 100644
@@ -433,24 +433,16 @@ ks8695_rx_irq(int irq, void *dev_id)
 {
      struct net_device *ndev = (struct net_device *)dev_id;
      struct ks8695_priv *ksp = netdev_priv(ndev);
-     unsigned long status;
-
-     unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
 
      spin_lock(&ksp->rx_lock);
 
-     status = readl(KS8695_IRQ_VA + KS8695_INTST);
-
-     /*clean rx status bit*/
-     writel(status | mask_bit , KS8695_IRQ_VA + KS8695_INTST);
-
-     if (status & mask_bit) {
-             if (napi_schedule_prep(&ksp->napi)) {
-                     /*disable rx interrupt*/
-                     status &= ~mask_bit;
-                     writel(status , KS8695_IRQ_VA + KS8695_INTEN);
-                     __napi_schedule(&ksp->napi);
-             }

drivers/net/arm/ks8695net.c ks8695_rx_irq(int irq, void *dev_id) · line 448

Quoted 10 lines
drivers/net/arm/ks8695net.c +7 -0
+     if (napi_schedule_prep(&ksp->napi)) {
+             unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN);
+             unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
+             /*disable rx interrupt*/
+             status &= ~mask_bit;
+             writel(status , KS8695_IRQ_VA + KS8695_INTEN);
+             __napi_schedule(&ksp->napi);
      }
 
      spin_unlock(&ksp->rx_lock);

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#4 lore raw
Quoted 18 lines · Figo.zhang
Quoted 17 lines · zeal
Quoted 16 lines · Figo.zhang
Quoted 9 lines · zeal

From: zeal <[email protected]>

Sorry for the previously patches. THEY'RE NOT RIGHT. It's my mistake. Please forgive my noise.
Please review the following patches and ignore the last (v1).

ks8695 rx irq is edge-level. Before arriving at irq handler, the corresponding status bit has been clear(irq's ack).
So we should not check it after that.

see <KS8695X Integrated Multi-Port Gateway Solution Register Description> Version 1.00

Interrupt Status Register(INTST Offset 0xE208)

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

it has said: This edge-triggered interrupt status is cleared by writting 1 , so we should write 1 to clear status bit manually.

Yeah, but irq_chip's ack has done that.
Please check arch/arm/mach-ks8695/irq.c ks8695_irq_edge_chip->ack()

yes, you are right, but you have better add this description at commit log.

'the corresponding status bit has been clear(irq's ack)' is not enough?

[snip]

Signature · 3 lines
Thanks & Regards

zeal
maintainer
#5 lore raw

From: zeal <[email protected]>
Date: Tue, 17 Nov 2009 12:28:33 +0800

Quoted 1 line

'the corresponding status bit has been clear(irq's ack)' is not enough?

I think it is sufficient, patch applied, thanks!