netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] be2net: Bug fix to support newer generation of BE ASIC
@ 2010-01-28  7:56 Ajit Khaparde
  2010-01-28 22:40 ` Ben Hutchings
  0 siblings, 1 reply; 11+ messages in thread
From: Ajit Khaparde @ 2010-01-28  7:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Bug fix in be2net for newer generation of BladeEngine ASIC.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
 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(-)

diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 9fd8e5e..5bc7459 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -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)
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index c002b83..13b33c8 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -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 */
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 33ab8c7..90c5661 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -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;
-- 
1.6.3.3


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

* Re: [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-28  7:56 [PATCH] be2net: Bug fix to support newer generation of BE ASIC Ajit Khaparde
@ 2010-01-28 22:40 ` Ben Hutchings
  2010-01-28 22:51   ` [stable] " Greg KH
  2010-01-29  7:03   ` David Miller
  0 siblings, 2 replies; 11+ messages in thread
From: Ben Hutchings @ 2010-01-28 22:40 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: David Miller, netdev, stable, stable-review

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

On Thu, 2010-01-28 at 13:26 +0530, Ajit Khaparde wrote:
> Bug fix in be2net for newer generation of BladeEngine ASIC.
[...]
> @@ -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 stable@kernel.org, or NAK the
addition of PCI ids for BladeEngine 3 in 2.6.32.7.

Ben.

-- 
Ben Hutchings
You can't have everything.  Where would you put it?

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [stable] [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-28 22:40 ` Ben Hutchings
@ 2010-01-28 22:51   ` Greg KH
  2010-01-28 23:20     ` Ben Hutchings
  2010-01-29  7:03   ` David Miller
  1 sibling, 1 reply; 11+ messages in thread
From: Greg KH @ 2010-01-28 22:51 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Ajit Khaparde, netdev, stable-review, David Miller, stable

On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:
> On Thu, 2010-01-28 at 13:26 +0530, Ajit Khaparde wrote:
> > Bug fix in be2net for newer generation of BladeEngine ASIC.
> [...]
> > @@ -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 :)

> >  	return 0;
> >  }
> >  
> [...]
> 
> I don't think this does what you think it does.
> 
> Also, you should either send this patch to stable@kernel.org, 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

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

* Re: [stable] [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-28 22:51   ` [stable] " Greg KH
@ 2010-01-28 23:20     ` Ben Hutchings
  2010-01-28 23:28       ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Ben Hutchings @ 2010-01-28 23:20 UTC (permalink / raw)
  To: Greg KH; +Cc: Ajit Khaparde, netdev, stable-review, David Miller, stable

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

On Thu, 2010-01-28 at 14:51 -0800, Greg KH wrote:
> On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:
[...]
> > Also, you should either send this patch to stable@kernel.org, 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.

-- 
Ben Hutchings
You can't have everything.  Where would you put it?

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [stable] [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-28 23:20     ` Ben Hutchings
@ 2010-01-28 23:28       ` Greg KH
  2010-01-28 23:55         ` Ben Hutchings
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2010-01-28 23:28 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Ajit Khaparde, netdev, stable-review, David Miller, stable

On Thu, Jan 28, 2010 at 11:20:28PM +0000, Ben Hutchings wrote:
> On Thu, 2010-01-28 at 14:51 -0800, Greg KH wrote:
> > On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:
> [...]
> > > Also, you should either send this patch to stable@kernel.org, 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

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

* Re: [stable] [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-28 23:28       ` Greg KH
@ 2010-01-28 23:55         ` Ben Hutchings
  2010-01-29  5:51           ` Ajit Khaparde
  0 siblings, 1 reply; 11+ messages in thread
From: Ben Hutchings @ 2010-01-28 23:55 UTC (permalink / raw)
  To: Greg KH; +Cc: Ajit Khaparde, netdev, stable-review, David Miller, stable

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]

On Thu, 2010-01-28 at 15:28 -0800, Greg KH wrote:
> On Thu, Jan 28, 2010 at 11:20:28PM +0000, Ben Hutchings wrote:
> > On Thu, 2010-01-28 at 14:51 -0800, Greg KH wrote:
> > > On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:
> > [...]
> > > > Also, you should either send this patch to stable@kernel.org, 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.

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

-- 
Ben Hutchings
You can't have everything.  Where would you put it?

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [stable] [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-28 23:55         ` Ben Hutchings
@ 2010-01-29  5:51           ` Ajit Khaparde
  2010-01-29  5:56             ` David Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Ajit Khaparde @ 2010-01-29  5:51 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Greg KH, netdev, stable-review, David Miller, stable

On 28/01/10 23:55 +0000, Ben Hutchings wrote:
> On Thu, 2010-01-28 at 15:28 -0800, Greg KH wrote:
> > On Thu, Jan 28, 2010 at 11:20:28PM +0000, Ben Hutchings wrote:
> > > On Thu, 2010-01-28 at 14:51 -0800, Greg KH wrote:
> > > > On Thu, Jan 28, 2010 at 10:40:29PM +0000, Ben Hutchings wrote:
> > > [...]
> > > > > Also, you should either send this patch to stable@kernel.org, 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.
> 
> > 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 stable@kernel.org
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

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

* Re: [stable] [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-29  5:51           ` Ajit Khaparde
@ 2010-01-29  5:56             ` David Miller
  2010-01-29  6:47               ` Ajit Khaparde
  0 siblings, 1 reply; 11+ messages in thread
From: David Miller @ 2010-01-29  5:56 UTC (permalink / raw)
  To: ajitk, ajitkhaparde; +Cc: ben, greg, netdev, stable-review, stable

From: Ajit Khaparde <ajitkhaparde@gmail.com>
Date: Fri, 29 Jan 2010 11:21:59 +0530

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

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

* Re: [stable] [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-29  5:56             ` David Miller
@ 2010-01-29  6:47               ` Ajit Khaparde
  2010-01-29  7:05                 ` David Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Ajit Khaparde @ 2010-01-29  6:47 UTC (permalink / raw)
  To: David Miller; +Cc: ajitkhaparde, ben, greg, netdev, stable-review, stable

On 28/01/10 21:56 -0800, David Miller wrote:
> From: Ajit Khaparde <ajitkhaparde@gmail.com>
> Date: Fri, 29 Jan 2010 11:21:59 +0530
> 
> > 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
> 
> 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.

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

* Re: [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-28 22:40 ` Ben Hutchings
  2010-01-28 22:51   ` [stable] " Greg KH
@ 2010-01-29  7:03   ` David Miller
  1 sibling, 0 replies; 11+ messages in thread
From: David Miller @ 2010-01-29  7:03 UTC (permalink / raw)
  To: ben; +Cc: ajitk, netdev, stable, stable-review

From: Ben Hutchings <ben@decadent.org.uk>
Date: Thu, 28 Jan 2010 22:40:29 +0000

> On Thu, 2010-01-28 at 13:26 +0530, Ajit Khaparde wrote:
>> Bug fix in be2net for newer generation of BladeEngine ASIC.
> [...]
>> @@ -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.

I'll fix this.

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

* Re: [stable] [PATCH] be2net: Bug fix to support newer generation of BE ASIC
  2010-01-29  6:47               ` Ajit Khaparde
@ 2010-01-29  7:05                 ` David Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2010-01-29  7:05 UTC (permalink / raw)
  To: ajitk; +Cc: ajitkhaparde, ben, greg, netdev, stable-review, stable

From: Ajit Khaparde <ajitk@serverengines.com>
Date: Fri, 29 Jan 2010 12:17:49 +0530

> On 28/01/10 21:56 -0800, David Miller wrote:
>> From: Ajit Khaparde <ajitkhaparde@gmail.com>
>> Date: Fri, 29 Jan 2010 11:21:59 +0530
>> 
>> > 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 :-)

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

end of thread, other threads:[~2010-01-29  7:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28  7:56 [PATCH] be2net: Bug fix to support newer generation of BE ASIC Ajit Khaparde
2010-01-28 22:40 ` Ben Hutchings
2010-01-28 22:51   ` [stable] " Greg KH
2010-01-28 23:20     ` Ben Hutchings
2010-01-28 23:28       ` Greg KH
2010-01-28 23:55         ` Ben Hutchings
2010-01-29  5:51           ` Ajit Khaparde
2010-01-29  5:56             ` David Miller
2010-01-29  6:47               ` Ajit Khaparde
2010-01-29  7:05                 ` David Miller
2010-01-29  7:03   ` 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).