netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors
@ 2010-09-02 23:04 Casey Leedom
  2010-09-02 23:07 ` [PATCH net-next 1/4] cxgb3: Add register bit definition for Fatal Parity Error Casey Leedom
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Casey Leedom @ 2010-09-02 23:04 UTC (permalink / raw)
  To: netdev

  These patches implement code to detect and recover from adapter parity errors.

  Two of the following four patches (2/4 and 3/4) were actually implemented by Dimitris Michailidis just before he headed off for vacation.  I've indicated that via a "Signed-off-by" by-line for him as well as one for me which I _think_ is the right way to do this.  The other two patches (1/4 and 4/4) were implemented by me so I've only included a "Signed-off-by" for me on those.  If I've done anything incorrectly please reject the patches and tell me how to correct them.  Thanks!

Casey

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

* [PATCH net-next 1/4] cxgb3: Add register bit definition for Fatal Parity Error.
  2010-09-02 23:04 [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors Casey Leedom
@ 2010-09-02 23:07 ` Casey Leedom
  2010-09-02 23:07 ` [PATCH net-next 2/4] cxgb3: Set FATALPERREN Casey Leedom
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Casey Leedom @ 2010-09-02 23:07 UTC (permalink / raw)
  To: netdev; +Cc: Casey Leedom

Signed-off-by: Casey Leedom <leedom@chelsio.com>
---
 drivers/net/cxgb3/regs.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index cb42353..6990f6c 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1997,6 +1997,10 @@
 
 #define A_PL_RST 0x6f0
 
+#define S_FATALPERREN    4
+#define V_FATALPERREN(x) ((x) << S_FATALPERREN)
+#define F_FATALPERREN    V_FATALPERREN(1U)
+
 #define S_CRSTWRM    1
 #define V_CRSTWRM(x) ((x) << S_CRSTWRM)
 #define F_CRSTWRM    V_CRSTWRM(1U)
-- 
1.7.0.4


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

* [PATCH net-next 2/4] cxgb3: Set FATALPERREN.
  2010-09-02 23:04 [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors Casey Leedom
  2010-09-02 23:07 ` [PATCH net-next 1/4] cxgb3: Add register bit definition for Fatal Parity Error Casey Leedom
@ 2010-09-02 23:07 ` Casey Leedom
  2010-09-02 23:07 ` [PATCH net-next 3/4] cxgb3: Leave interrupts for fatal errors asserted in common code Casey Leedom
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Casey Leedom @ 2010-09-02 23:07 UTC (permalink / raw)
  To: netdev; +Cc: Casey Leedom, Dimitris Michailidis

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: Casey Leedom <leedom@chelsio.com>
---
 drivers/net/cxgb3/t3_hw.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 427c451..14a5664 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -3569,6 +3569,7 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params)
 	t3_write_reg(adapter, A_PM1_TX_MODE, 0);
 	chan_init_hw(adapter, adapter->params.chan_map);
 	t3_sge_init(adapter, &adapter->params.sge);
+	t3_set_reg_field(adapter, A_PL_RST, 0, F_FATALPERREN);
 
 	t3_write_reg(adapter, A_T3DBG_GPIO_ACT_LOW, calc_gpio_intr(adapter));
 
-- 
1.7.0.4


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

* [PATCH net-next 3/4] cxgb3: Leave interrupts for fatal errors asserted in common code.
  2010-09-02 23:04 [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors Casey Leedom
  2010-09-02 23:07 ` [PATCH net-next 1/4] cxgb3: Add register bit definition for Fatal Parity Error Casey Leedom
  2010-09-02 23:07 ` [PATCH net-next 2/4] cxgb3: Set FATALPERREN Casey Leedom
@ 2010-09-02 23:07 ` Casey Leedom
  2010-09-02 23:07 ` [PATCH net-next 4/4] cxgb3: Avoid flush_workqueue() deadlock Casey Leedom
  2010-09-03 17:04 ` [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Casey Leedom @ 2010-09-02 23:07 UTC (permalink / raw)
  To: netdev; +Cc: Casey Leedom, Dimitris Michailidis

Platform code needs to deal with them now.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: Casey Leedom <leedom@chelsio.com>
---
 drivers/net/cxgb3/t3_hw.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 14a5664..d307c9d 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1408,6 +1408,7 @@ static int t3_handle_intr_status(struct adapter *adapter, unsigned int reg,
 			fatal++;
 			CH_ALERT(adapter, "%s (0x%x)\n",
 				 acts->msg, status & acts->mask);
+			status &= ~acts->mask;
 		} else if (acts->msg)
 			CH_WARN(adapter, "%s (0x%x)\n",
 				acts->msg, status & acts->mask);
@@ -1843,11 +1844,10 @@ static int mac_intr_handler(struct adapter *adap, unsigned int idx)
 		t3_os_link_fault_handler(adap, idx);
 	}
 
-	t3_write_reg(adap, A_XGM_INT_CAUSE + mac->offset, cause);
-
 	if (cause & XGM_INTR_FATAL)
 		t3_fatal_err(adap);
 
+	t3_write_reg(adap, A_XGM_INT_CAUSE + mac->offset, cause);
 	return cause != 0;
 }
 
-- 
1.7.0.4


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

* [PATCH net-next 4/4] cxgb3: Avoid flush_workqueue() deadlock.
  2010-09-02 23:04 [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors Casey Leedom
                   ` (2 preceding siblings ...)
  2010-09-02 23:07 ` [PATCH net-next 3/4] cxgb3: Leave interrupts for fatal errors asserted in common code Casey Leedom
@ 2010-09-02 23:07 ` Casey Leedom
  2010-09-03 17:04 ` [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Casey Leedom @ 2010-09-02 23:07 UTC (permalink / raw)
  To: netdev; +Cc: Casey Leedom

Don't call flush_workqueue() on the cxgb3 Work Queue in cxgb_down() when
we're being called from the fatal error task ... which is executing on the
cxgb3 Work Queue.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
---
 drivers/net/cxgb3/cxgb3_main.c |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index ad19585..1ecf53d 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1286,7 +1286,7 @@ irq_err:
 /*
  * Release resources when all the ports and offloading have been stopped.
  */
-static void cxgb_down(struct adapter *adapter)
+static void cxgb_down(struct adapter *adapter, int on_wq)
 {
 	t3_sge_stop(adapter);
 	spin_lock_irq(&adapter->work_lock);	/* sync with PHY intr task */
@@ -1296,7 +1296,8 @@ static void cxgb_down(struct adapter *adapter)
 	free_irq_resources(adapter);
 	quiesce_rx(adapter);
 	t3_sge_stop(adapter);
-	flush_workqueue(cxgb3_wq);	/* wait for external IRQ handler */
+	if (!on_wq)
+		flush_workqueue(cxgb3_wq);/* wait for external IRQ handler */
 }
 
 static void schedule_chk_task(struct adapter *adap)
@@ -1374,7 +1375,7 @@ static int offload_close(struct t3cdev *tdev)
 	clear_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map);
 
 	if (!adapter->open_device_map)
-		cxgb_down(adapter);
+		cxgb_down(adapter, 0);
 
 	cxgb3_offload_deactivate(adapter);
 	return 0;
@@ -1409,7 +1410,7 @@ static int cxgb_open(struct net_device *dev)
 	return 0;
 }
 
-static int cxgb_close(struct net_device *dev)
+static int __cxgb_close(struct net_device *dev, int on_wq)
 {
 	struct port_info *pi = netdev_priv(dev);
 	struct adapter *adapter = pi->adapter;
@@ -1436,12 +1437,17 @@ static int cxgb_close(struct net_device *dev)
 		cancel_delayed_work_sync(&adapter->adap_check_task);
 
 	if (!adapter->open_device_map)
-		cxgb_down(adapter);
+		cxgb_down(adapter, on_wq);
 
 	cxgb3_event_notify(&adapter->tdev, OFFLOAD_PORT_DOWN, pi->port_id);
 	return 0;
 }
 
+static int cxgb_close(struct net_device *dev)
+{
+	return __cxgb_close(dev, 0);
+}
+
 static struct net_device_stats *cxgb_get_stats(struct net_device *dev)
 {
 	struct port_info *pi = netdev_priv(dev);
@@ -2862,7 +2868,7 @@ void t3_os_link_fault_handler(struct adapter *adapter, int port_id)
 	spin_unlock(&adapter->work_lock);
 }
 
-static int t3_adapter_error(struct adapter *adapter, int reset)
+static int t3_adapter_error(struct adapter *adapter, int reset, int on_wq)
 {
 	int i, ret = 0;
 
@@ -2877,7 +2883,7 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
 		struct net_device *netdev = adapter->port[i];
 
 		if (netif_running(netdev))
-			cxgb_close(netdev);
+			__cxgb_close(netdev, on_wq);
 	}
 
 	/* Stop SGE timers */
@@ -2948,7 +2954,7 @@ static void fatal_error_task(struct work_struct *work)
 	int err = 0;
 
 	rtnl_lock();
-	err = t3_adapter_error(adapter, 1);
+	err = t3_adapter_error(adapter, 1, 1);
 	if (!err)
 		err = t3_reenable_adapter(adapter);
 	if (!err)
@@ -2998,7 +3004,7 @@ static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
 	if (state == pci_channel_io_perm_failure)
 		return PCI_ERS_RESULT_DISCONNECT;
 
-	ret = t3_adapter_error(adapter, 0);
+	ret = t3_adapter_error(adapter, 0, 0);
 
 	/* Request a slot reset. */
 	return PCI_ERS_RESULT_NEED_RESET;
-- 
1.7.0.4


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

* Re: [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors
  2010-09-02 23:04 [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors Casey Leedom
                   ` (3 preceding siblings ...)
  2010-09-02 23:07 ` [PATCH net-next 4/4] cxgb3: Avoid flush_workqueue() deadlock Casey Leedom
@ 2010-09-03 17:04 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-09-03 17:04 UTC (permalink / raw)
  To: leedom; +Cc: netdev

From: Casey Leedom <leedom@chelsio.com>
Date: Thu, 2 Sep 2010 16:04:28 -0700

>   These patches implement code to detect and recover from adapter parity errors.
>
>   Two of the following four patches (2/4 and 3/4) were actually
>   implemented by Dimitris Michailidis just before he headed off for
>   vacation.  I've indicated that via a "Signed-off-by" by-line for
>   him as well as one for me which I _think_ is the right way to do
>   this.  The other two patches (1/4 and 4/4) were implemented by me
>   so I've only included a "Signed-off-by" for me on those.  If I've
>   done anything incorrectly please reject the patches and tell me
>   how to correct them.  Thanks!

All applied, thanks Casey.

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

end of thread, other threads:[~2010-09-03 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-02 23:04 [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors Casey Leedom
2010-09-02 23:07 ` [PATCH net-next 1/4] cxgb3: Add register bit definition for Fatal Parity Error Casey Leedom
2010-09-02 23:07 ` [PATCH net-next 2/4] cxgb3: Set FATALPERREN Casey Leedom
2010-09-02 23:07 ` [PATCH net-next 3/4] cxgb3: Leave interrupts for fatal errors asserted in common code Casey Leedom
2010-09-02 23:07 ` [PATCH net-next 4/4] cxgb3: Avoid flush_workqueue() deadlock Casey Leedom
2010-09-03 17:04 ` [PATCH net-next 0/4] cxgb3: new code to deal with adapter parity errors David Miller

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