netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic
@ 2010-08-25 10:27 Ajit Khaparde
  2010-08-25 21:23 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Ajit Khaparde @ 2010-08-25 10:27 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

The ONLINE registers can return 0xFFFFFFFF on more than one
occassion. On systems that care, reading these registers could
lead to problems.

So the new code decides that the ASIC has encountered and error
by reading the UE_STATUS_LOW/HIGH registers. AND them with
the mask values and a non-zero result indicates an error.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
 drivers/net/benet/be_main.c |   32 ++++++++------------------------
 1 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index a5a24e6..6eda7a0 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1750,26 +1750,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
 	return 1;
 }
 
-static inline bool be_detect_ue(struct be_adapter *adapter)
-{
-	u32 online0 = 0, online1 = 0;
-
-	pci_read_config_dword(adapter->pdev, PCICFG_ONLINE0, &online0);
-
-	pci_read_config_dword(adapter->pdev, PCICFG_ONLINE1, &online1);
-
-	if (!online0 || !online1) {
-		adapter->ue_detected = true;
-		dev_err(&adapter->pdev->dev,
-			"UE Detected!! online0=%d online1=%d\n",
-			online0, online1);
-		return true;
-	}
-
-	return false;
-}
-
-void be_dump_ue(struct be_adapter *adapter)
+void be_detect_dump_ue(struct be_adapter *adapter)
 {
 	u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask;
 	u32 i;
@@ -1786,6 +1767,11 @@ void be_dump_ue(struct be_adapter *adapter)
 	ue_status_lo = (ue_status_lo & (~ue_status_lo_mask));
 	ue_status_hi = (ue_status_hi & (~ue_status_hi_mask));
 
+	if (ue_status_lo || ue_status_hi) {
+		adapter->ue_detected = true;
+		dev_err(&adapter->pdev->dev, "UE Detected!!\n");
+	}
+
 	if (ue_status_lo) {
 		for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) {
 			if (ue_status_lo & 1)
@@ -1821,10 +1807,8 @@ static void be_worker(struct work_struct *work)
 		adapter->rx_post_starved = false;
 		be_post_rx_frags(adapter);
 	}
-	if (!adapter->ue_detected) {
-		if (be_detect_ue(adapter))
-			be_dump_ue(adapter);
-	}
+	if (!adapter->ue_detected)
+		be_detect_dump_ue(adapter);
 
 	schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000));
 }
-- 
1.7.0.4


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

* Re: [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic
  2010-08-25 10:27 Ajit Khaparde
@ 2010-08-25 21:23 ` David Miller
  2010-08-26  4:15   ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2010-08-25 21:23 UTC (permalink / raw)
  To: ajitk; +Cc: netdev

From: Ajit Khaparde <ajitk@serverengines.com>
Date: Wed, 25 Aug 2010 15:57:31 +0530

> The ONLINE registers can return 0xFFFFFFFF on more than one
> occassion. On systems that care, reading these registers could
> lead to problems.
> 
> So the new code decides that the ASIC has encountered and error
> by reading the UE_STATUS_LOW/HIGH registers. AND them with
> the mask values and a non-zero result indicates an error.
> 
> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>

Applied.

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

* Re: [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic
  2010-08-25 21:23 ` David Miller
@ 2010-08-26  4:15   ` David Miller
  2010-08-26  4:15     ` David Miller
  2010-09-03  4:55     ` Ajit Khaparde
  0 siblings, 2 replies; 7+ messages in thread
From: David Miller @ 2010-08-26  4:15 UTC (permalink / raw)
  To: ajitk; +Cc: netdev

From: David Miller <davem@davemloft.net>
Date: Wed, 25 Aug 2010 14:23:11 -0700 (PDT)

> From: Ajit Khaparde <ajitk@serverengines.com>
> Date: Wed, 25 Aug 2010 15:57:31 +0530
> 
>> The ONLINE registers can return 0xFFFFFFFF on more than one
>> occassion. On systems that care, reading these registers could
>> lead to problems.
>> 
>> So the new code decides that the ASIC has encountered and error
>> by reading the UE_STATUS_LOW/HIGH registers. AND them with
>> the mask values and a non-zero result indicates an error.
>> 
>> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
> 
> Applied.

You didn't even build test what you submitted to me:

ERROR: "be_dump_ue" [drivers/net/benet/be2net.ko] undefined!

I'm reverting both patches.

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

* Re: [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic
  2010-08-26  4:15   ` David Miller
@ 2010-08-26  4:15     ` David Miller
  2010-09-03  4:55     ` Ajit Khaparde
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2010-08-26  4:15 UTC (permalink / raw)
  To: ajitk; +Cc: netdev

From: David Miller <davem@davemloft.net>
Date: Wed, 25 Aug 2010 21:15:00 -0700 (PDT)

> From: David Miller <davem@davemloft.net>
> Date: Wed, 25 Aug 2010 14:23:11 -0700 (PDT)
> 
>> From: Ajit Khaparde <ajitk@serverengines.com>
>> Date: Wed, 25 Aug 2010 15:57:31 +0530
>> 
>>> The ONLINE registers can return 0xFFFFFFFF on more than one
>>> occassion. On systems that care, reading these registers could
>>> lead to problems.
>>> 
>>> So the new code decides that the ASIC has encountered and error
>>> by reading the UE_STATUS_LOW/HIGH registers. AND them with
>>> the mask values and a non-zero result indicates an error.
>>> 
>>> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
>> 
>> Applied.
> 
> You didn't even build test what you submitted to me:
> 
> ERROR: "be_dump_ue" [drivers/net/benet/be2net.ko] undefined!
> 
> I'm reverting both patches.

Of course I meant "I'm reverting all 3 patches."

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

* Re: [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic
  2010-08-26  4:15   ` David Miller
  2010-08-26  4:15     ` David Miller
@ 2010-09-03  4:55     ` Ajit Khaparde
  1 sibling, 0 replies; 7+ messages in thread
From: Ajit Khaparde @ 2010-09-03  4:55 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On 25/08/10 21:15 -0700, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Wed, 25 Aug 2010 14:23:11 -0700 (PDT)
> 
> > From: Ajit Khaparde <ajitk@serverengines.com>
> > Date: Wed, 25 Aug 2010 15:57:31 +0530
> > 
> >> The ONLINE registers can return 0xFFFFFFFF on more than one
> >> occassion. On systems that care, reading these registers could
> >> lead to problems.
> >> 
> >> So the new code decides that the ASIC has encountered and error
> >> by reading the UE_STATUS_LOW/HIGH registers. AND them with
> >> the mask values and a non-zero result indicates an error.
> >> 
> >> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
> > 
> > Applied.
> 
> You didn't even build test what you submitted to me:
> 
> ERROR: "be_dump_ue" [drivers/net/benet/be2net.ko] undefined!
> 
> I'm reverting both patches.
Not sure why this happened and how I missed it because I did compile the
driver before sending the patches out. Will take care of this in future. Thanks

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

* [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic
@ 2010-09-03 16:23 Ajit Khaparde
  2010-09-03 16:53 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Ajit Khaparde @ 2010-09-03 16:23 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

The ONLINE registers can return 0xFFFFFFFF on more than one
occassion. On systems that care, reading these registers could
lead to problems.

So the new code decides that the ASIC has encountered and error
by reading the UE_STATUS_LOW/HIGH registers. AND them with
the mask values and a non-zero result indicates an error.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
 drivers/net/benet/be_cmds.c |    2 +-
 drivers/net/benet/be_cmds.h |    2 +-
 drivers/net/benet/be_main.c |   32 ++++++++------------------------
 3 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 3d30549..78f32fe 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -207,7 +207,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
 
 		if (msecs > 4000) {
 			dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
-			be_dump_ue(adapter);
+			be_detect_dump_ue(adapter);
 			return -1;
 		}
 
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index bdc10a2..ad1e6fa 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -992,5 +992,5 @@ extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
 extern int be_cmd_get_phy_info(struct be_adapter *adapter,
 		struct be_dma_mem *cmd);
 extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
-extern void be_dump_ue(struct be_adapter *adapter);
+extern void be_detect_dump_ue(struct be_adapter *adapter);
 
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index a5a24e6..6eda7a0 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1750,26 +1750,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
 	return 1;
 }
 
-static inline bool be_detect_ue(struct be_adapter *adapter)
-{
-	u32 online0 = 0, online1 = 0;
-
-	pci_read_config_dword(adapter->pdev, PCICFG_ONLINE0, &online0);
-
-	pci_read_config_dword(adapter->pdev, PCICFG_ONLINE1, &online1);
-
-	if (!online0 || !online1) {
-		adapter->ue_detected = true;
-		dev_err(&adapter->pdev->dev,
-			"UE Detected!! online0=%d online1=%d\n",
-			online0, online1);
-		return true;
-	}
-
-	return false;
-}
-
-void be_dump_ue(struct be_adapter *adapter)
+void be_detect_dump_ue(struct be_adapter *adapter)
 {
 	u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask;
 	u32 i;
@@ -1786,6 +1767,11 @@ void be_dump_ue(struct be_adapter *adapter)
 	ue_status_lo = (ue_status_lo & (~ue_status_lo_mask));
 	ue_status_hi = (ue_status_hi & (~ue_status_hi_mask));
 
+	if (ue_status_lo || ue_status_hi) {
+		adapter->ue_detected = true;
+		dev_err(&adapter->pdev->dev, "UE Detected!!\n");
+	}
+
 	if (ue_status_lo) {
 		for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) {
 			if (ue_status_lo & 1)
@@ -1821,10 +1807,8 @@ static void be_worker(struct work_struct *work)
 		adapter->rx_post_starved = false;
 		be_post_rx_frags(adapter);
 	}
-	if (!adapter->ue_detected) {
-		if (be_detect_ue(adapter))
-			be_dump_ue(adapter);
-	}
+	if (!adapter->ue_detected)
+		be_detect_dump_ue(adapter);
 
 	schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000));
 }
-- 
1.7.0.4


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

* Re: [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic
  2010-09-03 16:23 [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic Ajit Khaparde
@ 2010-09-03 16:53 ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2010-09-03 16:53 UTC (permalink / raw)
  To: ajitk; +Cc: netdev

From: Ajit Khaparde <ajitk@serverengines.com>
Date: Fri, 3 Sep 2010 21:53:30 +0530

> The ONLINE registers can return 0xFFFFFFFF on more than one
> occassion. On systems that care, reading these registers could
> lead to problems.
> 
> So the new code decides that the ASIC has encountered and error
> by reading the UE_STATUS_LOW/HIGH registers. AND them with
> the mask values and a non-zero result indicates an error.
> 
> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>

Applied.

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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-03 16:23 [PATCH net-2.6 2/3] be2net: fix a bug in UE detection logic Ajit Khaparde
2010-09-03 16:53 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2010-08-25 10:27 Ajit Khaparde
2010-08-25 21:23 ` David Miller
2010-08-26  4:15   ` David Miller
2010-08-26  4:15     ` David Miller
2010-09-03  4:55     ` Ajit Khaparde

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