netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.24 4/5]S2io: Check for CARD_DOWN before handling traffic
@ 2007-08-16  0:12 Ramkrishna Vepa
  2007-08-31 13:03 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Ramkrishna Vepa @ 2007-08-16  0:12 UTC (permalink / raw)
  To: netdev; +Cc: jeff, support

- Added check to return from the traffic handling function, if the card status 
  is DOWN.

Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com>
Signed-off-by: Santosh Rastapur <santosh.rastapur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
---
diff -Nurp patch3/drivers/net/s2io.c patch4/drivers/net/s2io.c
--- patch3/drivers/net/s2io.c	2007-08-15 08:57:32.000000000 -0700
+++ patch4/drivers/net/s2io.c	2007-08-15 08:42:14.000000000 -0700
@@ -2927,6 +2927,11 @@ static int s2io_poll(struct net_device *
 	int i;
 
 	atomic_inc(&nic->isr_cnt);
+	if (unlikely(atomic_read(&nic->card_state) == CARD_DOWN)) {
+		atomic_dec(&nic->isr_cnt);
+		return IRQ_NONE;
+	}
+
 	mac_control = &nic->mac_control;
 	config = &nic->config;
 
@@ -3062,12 +3067,6 @@ static void rx_intr_handler(struct ring_
 	struct RxD3* rxdp3;
 
 	spin_lock(&nic->rx_lock);
-	if (atomic_read(&nic->card_state) == CARD_DOWN) {
-		DBG_PRINT(INTR_DBG, "%s: %s going down for reset\n",
-			  __FUNCTION__, dev->name);
-		spin_unlock(&nic->rx_lock);
-		return;
-	}
 
 	get_info = ring_data->rx_curr_get_info;
 	get_block = get_info.block_index;
@@ -4404,6 +4403,10 @@ static irqreturn_t s2io_msix_ring_handle
 	struct s2io_nic *sp = ring->nic;
 
 	atomic_inc(&sp->isr_cnt);
+	if (unlikely(atomic_read(&sp->card_state) == CARD_DOWN)){
+		atomic_dec(&sp->isr_cnt);
+		return IRQ_HANDLED;
+	}
 
 	rx_intr_handler(ring);
 	s2io_chk_rx_buffers(sp, ring->ring_no);
@@ -4418,6 +4421,10 @@ static irqreturn_t s2io_msix_fifo_handle
 	struct s2io_nic *sp = fifo->nic;
 
 	atomic_inc(&sp->isr_cnt);
+	if (unlikely(atomic_read(&sp->card_state) == CARD_DOWN)){
+		atomic_dec(&sp->isr_cnt);
+		return IRQ_HANDLED;
+	}
 	tx_intr_handler(fifo);
 	atomic_dec(&sp->isr_cnt);
 	return IRQ_HANDLED;
@@ -4896,6 +4903,11 @@ static irqreturn_t s2io_isr(int irq, voi
 		return IRQ_NONE;
 
 	atomic_inc(&sp->isr_cnt);
+	if (unlikely(atomic_read(&sp->card_state) == CARD_DOWN)) {
+		atomic_dec(&sp->isr_cnt);
+		return IRQ_NONE;
+	}
+
 	mac_control = &sp->mac_control;
 	config = &sp->config;
 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.24 4/5]S2io: Check for CARD_DOWN before handling traffic
  2007-08-16  0:12 [PATCH 2.6.24 4/5]S2io: Check for CARD_DOWN before handling traffic Ramkrishna Vepa
@ 2007-08-31 13:03 ` Jeff Garzik
  2007-09-01  1:43   ` Ramkrishna Vepa
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2007-08-31 13:03 UTC (permalink / raw)
  To: ram.vepa; +Cc: netdev, support

Ramkrishna Vepa wrote:
> - Added check to return from the traffic handling function, if the card status 
>   is DOWN.
> 
> Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com>
> Signed-off-by: Santosh Rastapur <santosh.rastapur@neterion.com>
> Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
> ---
> diff -Nurp patch3/drivers/net/s2io.c patch4/drivers/net/s2io.c
> --- patch3/drivers/net/s2io.c	2007-08-15 08:57:32.000000000 -0700
> +++ patch4/drivers/net/s2io.c	2007-08-15 08:42:14.000000000 -0700
> @@ -2927,6 +2927,11 @@ static int s2io_poll(struct net_device *
>  	int i;
>  
>  	atomic_inc(&nic->isr_cnt);
> +	if (unlikely(atomic_read(&nic->card_state) == CARD_DOWN)) {
> +		atomic_dec(&nic->isr_cnt);
> +		return IRQ_NONE;
> +	}
> +
>  	mac_control = &nic->mac_control;
>  	config = &nic->config;
>  

invalid return value, for this function

Overall, this looks quite racy -- why does the card state differ from 
net_device state in the first place?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH 2.6.24 4/5]S2io: Check for CARD_DOWN before handling traffic
  2007-08-31 13:03 ` Jeff Garzik
@ 2007-09-01  1:43   ` Ramkrishna Vepa
  0 siblings, 0 replies; 3+ messages in thread
From: Ramkrishna Vepa @ 2007-09-01  1:43 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, support

Jeff,
> > - Added check to return from the traffic handling function, if the
card
> status
> >   is DOWN.
> >
> > Signed-off-by: Sivakumar Subramani
<sivakumar.subramani@neterion.com>
> > Signed-off-by: Santosh Rastapur <santosh.rastapur@neterion.com>
> > Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
> > ---
> > diff -Nurp patch3/drivers/net/s2io.c patch4/drivers/net/s2io.c
> > --- patch3/drivers/net/s2io.c	2007-08-15 08:57:32.000000000
-0700
> > +++ patch4/drivers/net/s2io.c	2007-08-15 08:42:14.000000000
-0700
> > @@ -2927,6 +2927,11 @@ static int s2io_poll(struct net_device *
> >  	int i;
> >
> >  	atomic_inc(&nic->isr_cnt);
> > +	if (unlikely(atomic_read(&nic->card_state) == CARD_DOWN)) {
> > +		atomic_dec(&nic->isr_cnt);
> > +		return IRQ_NONE;
> > +	}
> > +
> >  	mac_control = &nic->mac_control;
> >  	config = &nic->config;
> >
> 
> invalid return value, for this function
> 
> Overall, this looks quite racy -- why does the card state differ from
> net_device state in the first place?
[Ram] Agreed, it is racy. Will use test_and_set_bit(), set_bit() and
clear_bit().
The card reset could be initiated due to an internal error detected in
one of the blocks in the chip, while interrupts are still occurring.
There is a  net_device state (LINK_STATE_START) set at open and reset at
close but none for temporary disabled/enabled states. Did you want us to
use this enum along with the CARRIER states?

Ram


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-09-01  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-16  0:12 [PATCH 2.6.24 4/5]S2io: Check for CARD_DOWN before handling traffic Ramkrishna Vepa
2007-08-31 13:03 ` Jeff Garzik
2007-09-01  1:43   ` Ramkrishna Vepa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).