netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/5][RFC] NET: Change pci_enable_device to pci_reenable_device to keep device enable balance
@ 2007-08-02 22:44 Brandon Philips
  2007-08-03  9:00 ` Tejun Heo
  2007-08-08 21:30 ` [patch 1/5][RFC] NET: Change pci_enable_device topci_reenable_device " Ramkrishna Vepa
  0 siblings, 2 replies; 5+ messages in thread
From: Brandon Philips @ 2007-08-02 22:44 UTC (permalink / raw)
  To: netdev; +Cc: teheo, Brandon Philips

[-- Attachment #1: net-pci-reenable-on-slot-reset.patch --]
[-- Type: text/plain, Size: 2552 bytes --]

On a slot_reset event pci_disable_device() is never called so calling
pci_enable_device() will unbalance the enable count.

Signed-off-by: Brandon Philips <bphilips@suse.de>

---
 drivers/net/e100.c             |    2 +-
 drivers/net/e1000/e1000_main.c |    2 +-
 drivers/net/ixgb/ixgb_main.c   |    2 +-
 drivers/net/s2io.c             |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/net/e100.c
===================================================================
--- linux-2.6.orig/drivers/net/e100.c
+++ linux-2.6/drivers/net/e100.c
@@ -2828,7 +2828,7 @@ static pci_ers_result_t e100_io_slot_res
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct nic *nic = netdev_priv(netdev);
 
-	if (pci_enable_device(pdev)) {
+	if (pci_reenable_device(pdev)) {
 		printk(KERN_ERR "e100: Cannot re-enable PCI device after reset.\n");
 		return PCI_ERS_RESULT_DISCONNECT;
 	}
Index: linux-2.6/drivers/net/e1000/e1000_main.c
===================================================================
--- linux-2.6.orig/drivers/net/e1000/e1000_main.c
+++ linux-2.6/drivers/net/e1000/e1000_main.c
@@ -5270,7 +5270,7 @@ static pci_ers_result_t e1000_io_slot_re
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct e1000_adapter *adapter = netdev->priv;
 
-	if (pci_enable_device(pdev)) {
+	if (pci_reenable_device(pdev)) {
 		printk(KERN_ERR "e1000: Cannot re-enable PCI device after reset.\n");
 		return PCI_ERS_RESULT_DISCONNECT;
 	}
Index: linux-2.6/drivers/net/ixgb/ixgb_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ixgb/ixgb_main.c
+++ linux-2.6/drivers/net/ixgb/ixgb_main.c
@@ -2294,7 +2294,7 @@ static pci_ers_result_t ixgb_io_slot_res
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct ixgb_adapter *adapter = netdev_priv(netdev);
 
-	if(pci_enable_device(pdev)) {
+	if(pci_reenable_device(pdev)) {
 		DPRINTK(PROBE, ERR, "Cannot re-enable PCI device after reset.\n");
 		return PCI_ERS_RESULT_DISCONNECT;
 	}
Index: linux-2.6/drivers/net/s2io.c
===================================================================
--- linux-2.6.orig/drivers/net/s2io.c
+++ linux-2.6/drivers/net/s2io.c
@@ -7833,7 +7833,7 @@ static pci_ers_result_t s2io_io_slot_res
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct s2io_nic *sp = netdev->priv;
 
-	if (pci_enable_device(pdev)) {
+	if (pci_reenable_device(pdev)) {
 		printk(KERN_ERR "s2io: "
 		       "Cannot re-enable PCI device after reset.\n");
 		return PCI_ERS_RESULT_DISCONNECT;

-- 

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

* Re: [patch 1/5][RFC] NET: Change pci_enable_device to pci_reenable_device to keep device enable balance
  2007-08-02 22:44 [patch 1/5][RFC] NET: Change pci_enable_device to pci_reenable_device to keep device enable balance Brandon Philips
@ 2007-08-03  9:00 ` Tejun Heo
  2007-08-08 21:30 ` [patch 1/5][RFC] NET: Change pci_enable_device topci_reenable_device " Ramkrishna Vepa
  1 sibling, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2007-08-03  9:00 UTC (permalink / raw)
  To: Brandon Philips; +Cc: netdev, Brandon Philips

Brandon Philips wrote:
> On a slot_reset event pci_disable_device() is never called so calling
> pci_enable_device() will unbalance the enable count.
> 
> Signed-off-by: Brandon Philips <bphilips@suse.de>

Acked-by: Tejun Heo <htejun@gmail.com>

-- 
tejun

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

* RE: [patch 1/5][RFC] NET: Change pci_enable_device topci_reenable_device to keep device enable balance
  2007-08-02 22:44 [patch 1/5][RFC] NET: Change pci_enable_device to pci_reenable_device to keep device enable balance Brandon Philips
  2007-08-03  9:00 ` Tejun Heo
@ 2007-08-08 21:30 ` Ramkrishna Vepa
  2007-08-09 20:45   ` Brandon Philips
  1 sibling, 1 reply; 5+ messages in thread
From: Ramkrishna Vepa @ 2007-08-08 21:30 UTC (permalink / raw)
  To: Brandon Philips, netdev; +Cc: teheo, Brandon Philips

Brandon,

Before slot_reset event is called io_error_detected could be called
(where pci_disable_device() is called), right? 

The pci_reenable_device() will call enable only if the device was
enabled before and would not be enabled if the device were disabled. Is
this the intended behavior?

Ram

> -----Original Message-----
> From: netdev-owner@vger.kernel.org
[mailto:netdev-owner@vger.kernel.org]
> On Behalf Of Brandon Philips
> Sent: Thursday, August 02, 2007 3:44 PM
> To: netdev@vger.kernel.org
> Cc: teheo@suse.de; Brandon Philips
> Subject: [patch 1/5][RFC] NET: Change pci_enable_device
> topci_reenable_device to keep device enable balance
> 
> On a slot_reset event pci_disable_device() is never called so calling
> pci_enable_device() will unbalance the enable count.
> 
> Signed-off-by: Brandon Philips <bphilips@suse.de>
> 
> ---
>  drivers/net/e100.c             |    2 +-
>  drivers/net/e1000/e1000_main.c |    2 +-
>  drivers/net/ixgb/ixgb_main.c   |    2 +-
>  drivers/net/s2io.c             |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/drivers/net/e100.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/e100.c
> +++ linux-2.6/drivers/net/e100.c
> @@ -2828,7 +2828,7 @@ static pci_ers_result_t e100_io_slot_res
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct nic *nic = netdev_priv(netdev);
> 
> -	if (pci_enable_device(pdev)) {
> +	if (pci_reenable_device(pdev)) {
>  		printk(KERN_ERR "e100: Cannot re-enable PCI device after
> reset.\n");
>  		return PCI_ERS_RESULT_DISCONNECT;
>  	}
> Index: linux-2.6/drivers/net/e1000/e1000_main.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/e1000/e1000_main.c
> +++ linux-2.6/drivers/net/e1000/e1000_main.c
> @@ -5270,7 +5270,7 @@ static pci_ers_result_t e1000_io_slot_re
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct e1000_adapter *adapter = netdev->priv;
> 
> -	if (pci_enable_device(pdev)) {
> +	if (pci_reenable_device(pdev)) {
>  		printk(KERN_ERR "e1000: Cannot re-enable PCI device
after
> reset.\n");
>  		return PCI_ERS_RESULT_DISCONNECT;
>  	}
> Index: linux-2.6/drivers/net/ixgb/ixgb_main.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/ixgb/ixgb_main.c
> +++ linux-2.6/drivers/net/ixgb/ixgb_main.c
> @@ -2294,7 +2294,7 @@ static pci_ers_result_t ixgb_io_slot_res
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct ixgb_adapter *adapter = netdev_priv(netdev);
> 
> -	if(pci_enable_device(pdev)) {
> +	if(pci_reenable_device(pdev)) {
>  		DPRINTK(PROBE, ERR, "Cannot re-enable PCI device after
> reset.\n");
>  		return PCI_ERS_RESULT_DISCONNECT;
>  	}
> Index: linux-2.6/drivers/net/s2io.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/s2io.c
> +++ linux-2.6/drivers/net/s2io.c
> @@ -7833,7 +7833,7 @@ static pci_ers_result_t s2io_io_slot_res
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct s2io_nic *sp = netdev->priv;
> 
> -	if (pci_enable_device(pdev)) {
> +	if (pci_reenable_device(pdev)) {
>  		printk(KERN_ERR "s2io: "
>  		       "Cannot re-enable PCI device after reset.\n");
>  		return PCI_ERS_RESULT_DISCONNECT;
> 
> --
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch 1/5][RFC] NET: Change pci_enable_device topci_reenable_device to keep device enable balance
  2007-08-08 21:30 ` [patch 1/5][RFC] NET: Change pci_enable_device topci_reenable_device " Ramkrishna Vepa
@ 2007-08-09 20:45   ` Brandon Philips
  2007-08-09 20:49     ` Kok, Auke
  0 siblings, 1 reply; 5+ messages in thread
From: Brandon Philips @ 2007-08-09 20:45 UTC (permalink / raw)
  To: Ramkrishna Vepa; +Cc: netdev, teheo, e1000-devel, auke-jan.h.kok

On 17:30 Wed 08 Aug 2007, Ramkrishna Vepa wrote:
> Before slot_reset event is called io_error_detected could be called
> (where pci_disable_device() is called), right? 

Oops!  Right, the documentation says .error_detected is _always_ called
before .slot_reset.  So, this patch is not correct.  Please don't merge
this.

>From Documentation/pci-error-recovery.txt:

STEP 1: Notification
--------------------
Platform calls the error_detected() callback on every instance of
every driver affected by the error.
...

If any driver requested a slot reset (by returning PCI_ERS_RESULT_NEED_RESET),
then recovery proceeds to STEP 4 (Slot Reset).

> The pci_reenable_device() will call enable only if the device was
> enabled before and would not be enabled if the device were disabled. Is
> this the intended behavior?

Yes, you are right.  And no it isn't.

Thanks,

	Brandon

> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org
> [mailto:netdev-owner@vger.kernel.org]
> > On Behalf Of Brandon Philips
> > Sent: Thursday, August 02, 2007 3:44 PM
> > To: netdev@vger.kernel.org
> > Cc: teheo@suse.de; Brandon Philips
> > Subject: [patch 1/5][RFC] NET: Change pci_enable_device
> > topci_reenable_device to keep device enable balance
> > 
> > On a slot_reset event pci_disable_device() is never called so calling
> > pci_enable_device() will unbalance the enable count.
> > 
> > Signed-off-by: Brandon Philips <bphilips@suse.de>
> > 
> > ---
> >  drivers/net/e100.c             |    2 +-
> >  drivers/net/e1000/e1000_main.c |    2 +-
> >  drivers/net/ixgb/ixgb_main.c   |    2 +-
> >  drivers/net/s2io.c             |    2 +-
> >  4 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > Index: linux-2.6/drivers/net/e100.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/net/e100.c
> > +++ linux-2.6/drivers/net/e100.c
> > @@ -2828,7 +2828,7 @@ static pci_ers_result_t e100_io_slot_res
> >  	struct net_device *netdev = pci_get_drvdata(pdev);
> >  	struct nic *nic = netdev_priv(netdev);
> > 
> > -	if (pci_enable_device(pdev)) {
> > +	if (pci_reenable_device(pdev)) {
> >  		printk(KERN_ERR "e100: Cannot re-enable PCI device after
> > reset.\n");
> >  		return PCI_ERS_RESULT_DISCONNECT;
> >  	}
> > Index: linux-2.6/drivers/net/e1000/e1000_main.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/net/e1000/e1000_main.c
> > +++ linux-2.6/drivers/net/e1000/e1000_main.c
> > @@ -5270,7 +5270,7 @@ static pci_ers_result_t e1000_io_slot_re
> >  	struct net_device *netdev = pci_get_drvdata(pdev);
> >  	struct e1000_adapter *adapter = netdev->priv;
> > 
> > -	if (pci_enable_device(pdev)) {
> > +	if (pci_reenable_device(pdev)) {
> >  		printk(KERN_ERR "e1000: Cannot re-enable PCI device
> after
> > reset.\n");
> >  		return PCI_ERS_RESULT_DISCONNECT;
> >  	}
> > Index: linux-2.6/drivers/net/ixgb/ixgb_main.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/net/ixgb/ixgb_main.c
> > +++ linux-2.6/drivers/net/ixgb/ixgb_main.c
> > @@ -2294,7 +2294,7 @@ static pci_ers_result_t ixgb_io_slot_res
> >  	struct net_device *netdev = pci_get_drvdata(pdev);
> >  	struct ixgb_adapter *adapter = netdev_priv(netdev);
> > 
> > -	if(pci_enable_device(pdev)) {
> > +	if(pci_reenable_device(pdev)) {
> >  		DPRINTK(PROBE, ERR, "Cannot re-enable PCI device after
> > reset.\n");
> >  		return PCI_ERS_RESULT_DISCONNECT;
> >  	}
> > Index: linux-2.6/drivers/net/s2io.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/net/s2io.c
> > +++ linux-2.6/drivers/net/s2io.c
> > @@ -7833,7 +7833,7 @@ static pci_ers_result_t s2io_io_slot_res
> >  	struct net_device *netdev = pci_get_drvdata(pdev);
> >  	struct s2io_nic *sp = netdev->priv;
> > 
> > -	if (pci_enable_device(pdev)) {
> > +	if (pci_reenable_device(pdev)) {
> >  		printk(KERN_ERR "s2io: "
> >  		       "Cannot re-enable PCI device after reset.\n");
> >  		return PCI_ERS_RESULT_DISCONNECT;
> > 
> > --
> > -
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch 1/5][RFC] NET: Change pci_enable_device topci_reenable_device to keep device enable balance
  2007-08-09 20:45   ` Brandon Philips
@ 2007-08-09 20:49     ` Kok, Auke
  0 siblings, 0 replies; 5+ messages in thread
From: Kok, Auke @ 2007-08-09 20:49 UTC (permalink / raw)
  To: Brandon Philips; +Cc: Ramkrishna Vepa, netdev, teheo, e1000-devel

Brandon Philips wrote:
> On 17:30 Wed 08 Aug 2007, Ramkrishna Vepa wrote:
>> Before slot_reset event is called io_error_detected could be called
>> (where pci_disable_device() is called), right? 
> 
> Oops!  Right, the documentation says .error_detected is _always_ called
> before .slot_reset.  So, this patch is not correct.  Please don't merge
> this.
> 
> From Documentation/pci-error-recovery.txt:
> 
> STEP 1: Notification
> --------------------
> Platform calls the error_detected() callback on every instance of
> every driver affected by the error.
> ...
> 
> If any driver requested a slot reset (by returning PCI_ERS_RESULT_NEED_RESET),
> then recovery proceeds to STEP 4 (Slot Reset).
> 
>> The pci_reenable_device() will call enable only if the device was
>> enabled before and would not be enabled if the device were disabled. Is
>> this the intended behavior?
> 
> Yes, you are right.  And no it isn't.


it would be great if you can convince Linas Vepstas to review and ack your patch 
- he's the one who knows the error handling code the best.

Auke

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

end of thread, other threads:[~2007-08-09 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-02 22:44 [patch 1/5][RFC] NET: Change pci_enable_device to pci_reenable_device to keep device enable balance Brandon Philips
2007-08-03  9:00 ` Tejun Heo
2007-08-08 21:30 ` [patch 1/5][RFC] NET: Change pci_enable_device topci_reenable_device " Ramkrishna Vepa
2007-08-09 20:45   ` Brandon Philips
2007-08-09 20:49     ` Kok, Auke

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).