netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6] cnic: Fix big endian bug
@ 2011-01-26  8:14 Michael Chan
  2011-01-26  8:14 ` [PATCH net-2.6] bnx2: Eliminate AER error messages on systems not supporting it Michael Chan
  2011-01-26 22:26 ` [PATCH net-2.6] cnic: Fix big endian bug David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Chan @ 2011-01-26  8:14 UTC (permalink / raw)
  To: davem; +Cc: leitao, netdev, Michael Chan

The chip's page tables did not set up properly on big endian machines,
causing EEH errors on PPC machines.

Reported-by: Breno Leitao <leitao@linux.vnet.ibm.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/cnic.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 263a294..7ff170c 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -699,13 +699,13 @@ static void cnic_free_dma(struct cnic_dev *dev, struct cnic_dma *dma)
 static void cnic_setup_page_tbl(struct cnic_dev *dev, struct cnic_dma *dma)
 {
 	int i;
-	u32 *page_table = dma->pgtbl;
+	__le32 *page_table = (__le32 *) dma->pgtbl;
 
 	for (i = 0; i < dma->num_pages; i++) {
 		/* Each entry needs to be in big endian format. */
-		*page_table = (u32) ((u64) dma->pg_map_arr[i] >> 32);
+		*page_table = cpu_to_le32((u64) dma->pg_map_arr[i] >> 32);
 		page_table++;
-		*page_table = (u32) dma->pg_map_arr[i];
+		*page_table = cpu_to_le32(dma->pg_map_arr[i] & 0xffffffff);
 		page_table++;
 	}
 }
@@ -713,13 +713,13 @@ static void cnic_setup_page_tbl(struct cnic_dev *dev, struct cnic_dma *dma)
 static void cnic_setup_page_tbl_le(struct cnic_dev *dev, struct cnic_dma *dma)
 {
 	int i;
-	u32 *page_table = dma->pgtbl;
+	__le32 *page_table = (__le32 *) dma->pgtbl;
 
 	for (i = 0; i < dma->num_pages; i++) {
 		/* Each entry needs to be in little endian format. */
-		*page_table = dma->pg_map_arr[i] & 0xffffffff;
+		*page_table = cpu_to_le32(dma->pg_map_arr[i] & 0xffffffff);
 		page_table++;
-		*page_table = (u32) ((u64) dma->pg_map_arr[i] >> 32);
+		*page_table = cpu_to_le32((u64) dma->pg_map_arr[i] >> 32);
 		page_table++;
 	}
 }
-- 
1.6.4.GIT



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

* [PATCH net-2.6] bnx2: Eliminate AER error messages on systems not supporting it
  2011-01-26  8:14 [PATCH net-2.6] cnic: Fix big endian bug Michael Chan
@ 2011-01-26  8:14 ` Michael Chan
  2011-01-26 22:26   ` David Miller
  2011-01-26 22:26 ` [PATCH net-2.6] cnic: Fix big endian bug David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Chan @ 2011-01-26  8:14 UTC (permalink / raw)
  To: davem; +Cc: leitao, netdev, Michael Chan

On PPC for example, AER is not supported and we see unnecessary AER
error message without this patch:

bnx2 0003:01:00.1: pci_cleanup_aer_uncorrect_error_status failed 0xfffffffb

Reported-by: Breno Leitao <leitao@linux.vnet.ibm.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/bnx2.c |   17 +++++++++--------
 drivers/net/bnx2.h |    1 +
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 99e7652..62c6079 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -7966,11 +7966,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 
 		/* AER (Advanced Error Reporting) hooks */
 		err = pci_enable_pcie_error_reporting(pdev);
-		if (err) {
-			dev_err(&pdev->dev, "pci_enable_pcie_error_reporting "
-					    "failed 0x%x\n", err);
-			/* non-fatal, continue */
-		}
+		if (!err)
+			bp->flags |= BNX2_FLAG_AER_ENABLED;
 
 	} else {
 		bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
@@ -8233,8 +8230,10 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 	return 0;
 
 err_out_unmap:
-	if (bp->flags & BNX2_FLAG_PCIE)
+	if (bp->flags & BNX2_FLAG_AER_ENABLED) {
 		pci_disable_pcie_error_reporting(pdev);
+		bp->flags &= ~BNX2_FLAG_AER_ENABLED;
+	}
 
 	if (bp->regview) {
 		iounmap(bp->regview);
@@ -8422,8 +8421,10 @@ bnx2_remove_one(struct pci_dev *pdev)
 
 	kfree(bp->temp_stats_blk);
 
-	if (bp->flags & BNX2_FLAG_PCIE)
+	if (bp->flags & BNX2_FLAG_AER_ENABLED) {
 		pci_disable_pcie_error_reporting(pdev);
+		bp->flags &= ~BNX2_FLAG_AER_ENABLED;
+	}
 
 	free_netdev(dev);
 
@@ -8539,7 +8540,7 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
 	}
 	rtnl_unlock();
 
-	if (!(bp->flags & BNX2_FLAG_PCIE))
+	if (!bp->flags & BNX2_FLAG_AER_ENABLED)
 		return result;
 
 	err = pci_cleanup_aer_uncorrect_error_status(pdev);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 5488a2e..f459fb2 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6741,6 +6741,7 @@ struct bnx2 {
 #define BNX2_FLAG_JUMBO_BROKEN		0x00000800
 #define BNX2_FLAG_CAN_KEEP_VLAN		0x00001000
 #define BNX2_FLAG_BROKEN_STATS		0x00002000
+#define BNX2_FLAG_AER_ENABLED		0x00004000
 
 	struct bnx2_napi	bnx2_napi[BNX2_MAX_MSIX_VEC];
 
-- 
1.6.4.GIT



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

* Re: [PATCH net-2.6] cnic: Fix big endian bug
  2011-01-26  8:14 [PATCH net-2.6] cnic: Fix big endian bug Michael Chan
  2011-01-26  8:14 ` [PATCH net-2.6] bnx2: Eliminate AER error messages on systems not supporting it Michael Chan
@ 2011-01-26 22:26 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2011-01-26 22:26 UTC (permalink / raw)
  To: mchan; +Cc: leitao, netdev

From: "Michael Chan" <mchan@broadcom.com>
Date: Wed, 26 Jan 2011 00:14:50 -0800

> The chip's page tables did not set up properly on big endian machines,
> causing EEH errors on PPC machines.
> 
> Reported-by: Breno Leitao <leitao@linux.vnet.ibm.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>

Applied.

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

* Re: [PATCH net-2.6] bnx2: Eliminate AER error messages on systems not supporting it
  2011-01-26  8:14 ` [PATCH net-2.6] bnx2: Eliminate AER error messages on systems not supporting it Michael Chan
@ 2011-01-26 22:26   ` David Miller
  2011-01-26 22:28     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2011-01-26 22:26 UTC (permalink / raw)
  To: mchan; +Cc: leitao, netdev

From: "Michael Chan" <mchan@broadcom.com>
Date: Wed, 26 Jan 2011 00:14:51 -0800

> On PPC for example, AER is not supported and we see unnecessary AER
> error message without this patch:
> 
> bnx2 0003:01:00.1: pci_cleanup_aer_uncorrect_error_status failed 0xfffffffb
> 
> Reported-by: Breno Leitao <leitao@linux.vnet.ibm.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>

Applied.

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

* Re: [PATCH net-2.6] bnx2: Eliminate AER error messages on systems not supporting it
  2011-01-26 22:26   ` David Miller
@ 2011-01-26 22:28     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-01-26 22:28 UTC (permalink / raw)
  To: mchan; +Cc: leitao, netdev

From: David Miller <davem@davemloft.net>
Date: Wed, 26 Jan 2011 14:26:35 -0800 (PST)

> From: "Michael Chan" <mchan@broadcom.com>
> Date: Wed, 26 Jan 2011 00:14:51 -0800
> 
>> On PPC for example, AER is not supported and we see unnecessary AER
>> error message without this patch:
>> 
>> bnx2 0003:01:00.1: pci_cleanup_aer_uncorrect_error_status failed 0xfffffffb
>> 
>> Reported-by: Breno Leitao <leitao@linux.vnet.ibm.com>
>> Signed-off-by: Michael Chan <mchan@broadcom.com>
> 
> Applied.

Please check for warnings in your build, I ammended the following fix
into this commit:

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 62c6079..0ba59d5 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -8540,7 +8540,7 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
 	}
 	rtnl_unlock();
 
-	if (!bp->flags & BNX2_FLAG_AER_ENABLED)
+	if (!(bp->flags & BNX2_FLAG_AER_ENABLED))
 		return result;
 
 	err = pci_cleanup_aer_uncorrect_error_status(pdev);

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

end of thread, other threads:[~2011-01-26 22:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-26  8:14 [PATCH net-2.6] cnic: Fix big endian bug Michael Chan
2011-01-26  8:14 ` [PATCH net-2.6] bnx2: Eliminate AER error messages on systems not supporting it Michael Chan
2011-01-26 22:26   ` David Miller
2011-01-26 22:28     ` David Miller
2011-01-26 22:26 ` [PATCH net-2.6] cnic: Fix big endian bug 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).