Skip to contentSkip to conversation

be2net: Bug fix to support newer generation of BE ASIC

PATCH In review Ajit Khaparde 5 participants 11 messages Jan 28, 2010 – Jan 29, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 be2net: Bug fix to support newer generation of BE ASIC

Bug fix in be2net for newer generation of BladeEngine ASIC.

---
 drivers/net/benet/be.h      |    5 +++++
 drivers/net/benet/be_cmds.h |    3 ++-
 drivers/net/benet/be_main.c |   25 +++++++++++++++++++++++--
 3 files changed, 30 insertions(+), 3 deletions(-)
drivers/net/benet/be.h +5 -0
index 9fd8e5e..5bc7459 100644
@@ -276,8 +276,13 @@ struct be_adapter {
 	int link_speed;
 	u8 port_type;
 	u8 transceiver;
+	u8 generation;		/* BladeEngine ASIC generation */
 };
 
+/* BladeEngine Generation numbers */
+#define BE_GEN2 2
+#define BE_GEN3 3
+
 extern const struct ethtool_ops be_ethtool_ops;
 
 #define drvr_stats(adapter)		(&adapter->stats.drvr_stats)
drivers/net/benet/be_cmds.h +2 -1
index c002b83..13b33c8 100644
@@ -164,7 +164,8 @@ struct be_cmd_req_hdr {
 	u8 domain;		/* dword 0 */
 	u32 timeout;		/* dword 1 */
 	u32 request_length;	/* dword 2 */
-	u32 rsvd;		/* dword 3 */
+	u8 version;		/* dword 3 */
+	u8 rsvd[3];		/* dword 3 */
 };
 
 #define RESP_HDR_INFO_OPCODE_SHIFT	0	/* bits 0 - 7 */
drivers/net/benet/be_main.c +23 -2
index 33ab8c7..90c5661 100644
@@ -2051,6 +2051,7 @@ static void be_unmap_pci_bars(struct be_adapter *adapter)
 static int be_map_pci_bars(struct be_adapter *adapter)
 {
 	u8 __iomem *addr;
+	int pcicfg_reg;
 
 	addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2),
 			pci_resource_len(adapter->pdev, 2));
@@ -2064,8 +2065,13 @@ static int be_map_pci_bars(struct be_adapter *adapter)
 		goto pci_map_err;
 	adapter->db = addr;
 
-	addr = ioremap_nocache(pci_resource_start(adapter->pdev, 1),
-			pci_resource_len(adapter->pdev, 1));
+	if (adapter->generation == BE_GEN2)
+		pcicfg_reg = 1;
+	else
+		pcicfg_reg = 0;
+
+	addr = ioremap_nocache(pci_resource_start(adapter->pdev, pcicfg_reg),
+			pci_resource_len(adapter->pdev, pcicfg_reg));
 	if (addr == NULL)
 		goto pci_map_err;
 	adapter->pcicfg = addr;
@@ -2162,6 +2168,7 @@ static int be_stats_init(struct be_adapter *adapter)
 	cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma);
 	if (cmd->va == NULL)
 		return -1;
+	memset(cmd->va, cmd->size, 0);
 	return 0;
 }
 
@@ -2240,6 +2247,20 @@ static int __devinit be_probe(struct pci_dev *pdev,
 		goto rel_reg;
 	}
 	adapter = netdev_priv(netdev);
+
+	switch (pdev->device) {
+	case BE_DEVICE_ID1:
+	case OC_DEVICE_ID1:
+		adapter->generation = BE_GEN2;
+		break;
+	case BE_DEVICE_ID2:
+	case OC_DEVICE_ID2:
+		adapter->generation = BE_GEN3;
+		break;
+	default:
+		adapter->generation = 0;
+	}
+
 	adapter->pdev = pdev;
 	pci_set_drvdata(pdev, adapter);
 	adapter->netdev = netdev;
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 1 line · Ajit Khaparde

Bug fix in be2net for newer generation of BladeEngine ASIC.

[...]

drivers/net/benet/be_main.c static int be_stats_init(struct be_adapter *adapter) · line 2174

Quoted 8 lines
drivers/net/benet/be_main.c +1 -0
@@ -2162,6 +2168,7 @@ static int be_stats_init(struct be_adapter *adapter)
 	cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma);
 	if (cmd->va == NULL)
 		return -1;
+	memset(cmd->va, cmd->size, 0);
 	return 0;
 }
 

[...]

I don't think this does what you think it does.

Also, you should either send this patch to [email protected], or NAK the addition of PCI ids for BladeEngine 3 in 2.6.32.7.

Ben.

Signature · 2 lines
Ben Hutchings
You can't have everything.  Where would you put it?
#2 lore raw
Quoted 8 lines · Ben Hutchings
Quoted 1 line · Ajit Khaparde

Bug fix in be2net for newer generation of BladeEngine ASIC.

[...]

drivers/net/benet/be_main.c static int be_stats_init(struct be_adapter *adapter) · line 2171

Quoted 5 lines
drivers/net/benet/be_main.c +1 -0
@@ -2162,6 +2168,7 @@ static int be_stats_init(struct be_adapter *adapter)
 	cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma);
 	if (cmd->va == NULL)
 		return -1;
+	memset(cmd->va, cmd->size, 0);

Heh, that's funny. Yeah, that is not correct at all. If that does anything, something else is seriously wrong :)

Quoted 9 lines

drivers/net/benet/be_main.c static int be_stats_init(struct be_adapter *adapter) · line 2174

Quoted 3 lines
drivers/net/benet/be_main.c +0 -0
 	return 0;
 }
 

[...]

I don't think this does what you think it does.

Also, you should either send this patch to [email protected], or NAK the addition of PCI ids for BladeEngine 3 in 2.6.32.7.

Why? How does the pci id patch for 2.6.32.7 matter with this change?

confused,

greg k-h

#3 lore raw
Quoted 1 line · Greg KH

On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:

[...]

Quoted 4 lines
Quoted 2 lines

Also, you should either send this patch to [email protected], or NAK the addition of PCI ids for BladeEngine 3 in 2.6.32.7.

Why? How does the pci id patch for 2.6.32.7 matter with this change?

Because it looks like the devices being added won't work without this.

Ben.

Signature · 2 lines
Ben Hutchings
You can't have everything.  Where would you put it?
#4 lore raw
Quoted 9 lines · Ben Hutchings
Quoted 1 line · Greg KH

On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:

[...]

Quoted 4 lines
Quoted 2 lines

Also, you should either send this patch to [email protected], or NAK the addition of PCI ids for BladeEngine 3 in 2.6.32.7.

Why? How does the pci id patch for 2.6.32.7 matter with this change?

Because it looks like the devices being added won't work without this.

Hm, what is "this"? I seem to have been lost on this thread.

Care to explain it better? 2.6.32.7 is now out with the pci ids, so if I need to add something else for the next .32-stable kernel, please let me know.

thanks,

greg k-h

#5 lore raw
Quoted 4 lines · Greg KH
Quoted 3 lines · Ben Hutchings
Quoted 1 line · Greg KH

On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:

[...]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Also, you should either send this patch to [email protected], or NAK the addition of PCI ids for BladeEngine 3 in 2.6.32.7.

Why? How does the pci id patch for 2.6.32.7 matter with this change?

Because it looks like the devices being added won't work without this.

Hm, what is "this"? I seem to have been lost on this thread.

The patch I was replying to
<http://article.gmane.org/gmane.linux.network/150441> changes I/O setup for be2net to use PCI BAR 0 on the new device whereas it uses BAR 1 on older devices.

Quoted 3 lines

Care to explain it better? 2.6.32.7 is now out with the pci ids, so if I need to add something else for the next .32-stable kernel, please let me know.

Well that will be for Ajit to sort out.

Ben.

Signature · 2 lines
Ben Hutchings
You can't have everything.  Where would you put it?
#6 lore raw
Quoted 19 lines · Ben Hutchings
Quoted 4 lines · Greg KH
Quoted 3 lines · Ben Hutchings
Quoted 1 line · Greg KH

On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:

[...]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Also, you should either send this patch to [email protected], or NAK the addition of PCI ids for BladeEngine 3 in 2.6.32.7.

Why? How does the pci id patch for 2.6.32.7 matter with this change?

Because it looks like the devices being added won't work without this.

Hm, what is "this"? I seem to have been lost on this thread.

The patch I was replying to
<http://article.gmane.org/gmane.linux.network/150441> changes I/O setup for be2net to use PCI BAR 0 on the new device whereas it uses BAR 1 on older devices.

Quoted 5 lines
Quoted 3 lines

Care to explain it better? 2.6.32.7 is now out with the pci ids, so if I need to add something else for the next .32-stable kernel, please let me know.

Well that will be for Ajit to sort out.

My apologies for the confusion.
I was out of action for almost a month. As I got back few days back, I noticed that the patch to include the new PCI IDs was pushed to the stable kernel. So, I gathered the changes necessary for supporting the new generation of ASIC, that were made in my absence and spun this patch.

When I mailed the patch, I was not sure when to CC [email protected] We would like to have the PCI Ids for BladeEngine 3 in 2.6.32 kernel.

Dave,
I plan rectify the error pointed by Ben and Greg and spin the patch again and resend it. Please let me know if you think otherwise.

Thanks
Ajit

maintainer
#7 lore raw

From: Ajit Khaparde <[email protected]>
Date: Fri, 29 Jan 2010 11:21:59 +0530

Quoted 2 lines

I plan rectify the error pointed by Ben and Greg and spin the patch again and resend it. Please let me know if you think otherwise.

I already made the obvious memset() arg fix in my tree as I said I would in my reply to Ben's posting.

It never makes sense to 'respin' patches I've already applied to net-2.6, once I push it out to kernel.org it's irreversable so you must send relative fixes.

#8 lore raw
Quoted 8 lines · David Miller

From: Ajit Khaparde <[email protected]>
Date: Fri, 29 Jan 2010 11:21:59 +0530

Quoted 2 lines

I plan rectify the error pointed by Ben and Greg and spin the patch again and resend it. Please let me know if you think otherwise.

I already made the obvious memset() arg fix in my tree as I said I would in my reply to Ben's posting.

I never saw this mail. Probably its lost for good. It did not even show up on
http://patchwork.ozlabs.org/patch/43852

Thanks

Quoted 4 lines

It never makes sense to 'respin' patches I've already applied to net-2.6, once I push it out to kernel.org it's irreversable so you must send relative fixes.

maintainer
#9 lore raw

From: Ajit Khaparde <[email protected]>
Date: Fri, 29 Jan 2010 12:17:49 +0530

Quoted 12 lines · David Miller
Quoted 8 lines

From: Ajit Khaparde <[email protected]>
Date: Fri, 29 Jan 2010 11:21:59 +0530

Quoted 2 lines

I plan rectify the error pointed by Ben and Greg and spin the patch again and resend it. Please let me know if you think otherwise.

I already made the obvious memset() arg fix in my tree as I said I would in my reply to Ben's posting.

I never saw this mail. Probably its lost for good. It did not even show up on
http://patchwork.ozlabs.org/patch/43852

Ugh, it was stuck in my email client waiting for me to hit 'send', which I just did :-)

maintainer
#10 lore raw
In reply to Ben Hutchings

From: Ben Hutchings <[email protected]>
Date: Thu, 28 Jan 2010 22:40:29 +0000

Quoted 13 lines · Ajit Khaparde
Quoted 1 line

Bug fix in be2net for newer generation of BladeEngine ASIC.

[...]

Quoted 8 lines
drivers/net/benet/be_main.c +1 -0
@@ -2162,6 +2168,7 @@ static int be_stats_init(struct be_adapter *adapter)
 	cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma);
 	if (cmd->va == NULL)
 		return -1;
+	memset(cmd->va, cmd->size, 0);
 	return 0;
 }
 

[...]

Quoted 1 line

I don't think this does what you think it does.

I'll fix this.