Patchwork [net-next] cxgb4: Allow for backward compatibility with new VPD scheme.

login
register
mail settings
Submitter Vipul Pandya
Date March 8, 2013, 1:35 p.m.
Message ID <1362749729-4532-1-git-send-email-vipul@chelsio.com>
Download mbox | patch
Permalink /patch/226113/
State Accepted
Delegated to: David Miller
Headers show

Comments

Vipul Pandya - March 8, 2013, 1:35 p.m.
From: Santosh Rastapur <santosh@chelsio.com>

New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
0x400 of the function.  If no 3rd party VPD is present, then a copy of
Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
requires the VPD to be present at offset 0x0.

Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
David Miller - March 8, 2013, 5:44 p.m.
From: Vipul Pandya <vipul@chelsio.com>
Date: Fri,  8 Mar 2013 19:05:29 +0530

> From: Santosh Rastapur <santosh@chelsio.com>
> 
> New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
> 0x400 of the function.  If no 3rd party VPD is present, then a copy of
> Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
> requires the VPD to be present at offset 0x0.
> 
> Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
> Signed-off-by: Vipul Pandya <vipul@chelsio.com>

Isn't this a fix which is better targetted at 'net' than 'net-next'?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vipul Pandya - March 11, 2013, 5:51 a.m.
On 08-03-2013 23:14, David Miller wrote:
> From: Vipul Pandya <vipul@chelsio.com>
> Date: Fri,  8 Mar 2013 19:05:29 +0530
> 
>> From: Santosh Rastapur <santosh@chelsio.com>
>>
>> New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
>> 0x400 of the function.  If no 3rd party VPD is present, then a copy of
>> Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
>> requires the VPD to be present at offset 0x0.
>>
>> Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
>> Signed-off-by: Vipul Pandya <vipul@chelsio.com>
> 
> Isn't this a fix which is better targetted at 'net' than 'net-next'?
> 

We have very soon new patch series coming up for net-next. This patch
requires for that patch series to work correctly. So, we would like to
get this merge in net-next tree.

Thanks,
Vipul

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - March 11, 2013, 6:30 a.m.
From: Vipul Pandya <vipul@chelsio.com>
Date: Mon, 11 Mar 2013 11:21:51 +0530

> 
> 
> On 08-03-2013 23:14, David Miller wrote:
>> From: Vipul Pandya <vipul@chelsio.com>
>> Date: Fri,  8 Mar 2013 19:05:29 +0530
>> 
>>> From: Santosh Rastapur <santosh@chelsio.com>
>>>
>>> New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
>>> 0x400 of the function.  If no 3rd party VPD is present, then a copy of
>>> Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
>>> requires the VPD to be present at offset 0x0.
>>>
>>> Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
>>> Signed-off-by: Vipul Pandya <vipul@chelsio.com>
>> 
>> Isn't this a fix which is better targetted at 'net' than 'net-next'?
>> 
> 
> We have very soon new patch series coming up for net-next. This patch
> requires for that patch series to work correctly. So, we would like to
> get this merge in net-next tree.

But you can achieve that by asking me to apply this to 'net' and then
when the patch series that depends upon it is posted, you tell me about
this dependency.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vipul Pandya - March 11, 2013, 6:53 a.m.
On 11-03-2013 12:00, David Miller wrote:
> From: Vipul Pandya <vipul@chelsio.com>
> Date: Mon, 11 Mar 2013 11:21:51 +0530
> 
>>
>>
>> On 08-03-2013 23:14, David Miller wrote:
>>> From: Vipul Pandya <vipul@chelsio.com>
>>> Date: Fri,  8 Mar 2013 19:05:29 +0530
>>>
>>>> From: Santosh Rastapur <santosh@chelsio.com>
>>>>
>>>> New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
>>>> 0x400 of the function.  If no 3rd party VPD is present, then a copy of
>>>> Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
>>>> requires the VPD to be present at offset 0x0.
>>>>
>>>> Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
>>>> Signed-off-by: Vipul Pandya <vipul@chelsio.com>
>>>
>>> Isn't this a fix which is better targetted at 'net' than 'net-next'?
>>>
>>
>> We have very soon new patch series coming up for net-next. This patch
>> requires for that patch series to work correctly. So, we would like to
>> get this merge in net-next tree.
> 
> But you can achieve that by asking me to apply this to 'net' and then
> when the patch series that depends upon it is posted, you tell me about
> this dependency.
> 
Ok. I was not aware of this. However there can be a merge conflict at
the time of merging 'net' and 'net-next' tree if this patch gets applied
in 'net' tree and our new patch series gets applied in 'net-next'. To
avoid it we recommended the same. The merge conflict wont be a major and
if it is alright to resolve it we can apply this patch to 'net' tree.

Thanks,
Vipul
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - March 11, 2013, 11:41 a.m.
From: Vipul Pandya <vipul@chelsio.com>
Date: Mon, 11 Mar 2013 12:23:12 +0530

> 
> 
> On 11-03-2013 12:00, David Miller wrote:
>> From: Vipul Pandya <vipul@chelsio.com>
>> Date: Mon, 11 Mar 2013 11:21:51 +0530
>> 
>>>
>>>
>>> On 08-03-2013 23:14, David Miller wrote:
>>>> From: Vipul Pandya <vipul@chelsio.com>
>>>> Date: Fri,  8 Mar 2013 19:05:29 +0530
>>>>
>>>>> From: Santosh Rastapur <santosh@chelsio.com>
>>>>>
>>>>> New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
>>>>> 0x400 of the function.  If no 3rd party VPD is present, then a copy of
>>>>> Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
>>>>> requires the VPD to be present at offset 0x0.
>>>>>
>>>>> Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
>>>>> Signed-off-by: Vipul Pandya <vipul@chelsio.com>
>>>>
>>>> Isn't this a fix which is better targetted at 'net' than 'net-next'?
>>>>
>>>
>>> We have very soon new patch series coming up for net-next. This patch
>>> requires for that patch series to work correctly. So, we would like to
>>> get this merge in net-next tree.
>> 
>> But you can achieve that by asking me to apply this to 'net' and then
>> when the patch series that depends upon it is posted, you tell me about
>> this dependency.
>> 
> Ok. I was not aware of this. However there can be a merge conflict at
> the time of merging 'net' and 'net-next' tree if this patch gets applied
> in 'net' tree and our new patch series gets applied in 'net-next'. To
> avoid it we recommended the same. The merge conflict wont be a major and
> if it is alright to resolve it we can apply this patch to 'net' tree.

That's why you tell me to first pull net into net-next, and you send
me a patch set for net-next which assumes the fix from 'net' is
already applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vipul Pandya - March 11, 2013, 11:49 a.m.
On 11-03-2013 17:11, David Miller wrote:
> From: Vipul Pandya <vipul@chelsio.com>
> Date: Mon, 11 Mar 2013 12:23:12 +0530
> 
>>
>>
>> On 11-03-2013 12:00, David Miller wrote:
>>> From: Vipul Pandya <vipul@chelsio.com>
>>> Date: Mon, 11 Mar 2013 11:21:51 +0530
>>>
>>>>
>>>>
>>>> On 08-03-2013 23:14, David Miller wrote:
>>>>> From: Vipul Pandya <vipul@chelsio.com>
>>>>> Date: Fri,  8 Mar 2013 19:05:29 +0530
>>>>>
>>>>>> From: Santosh Rastapur <santosh@chelsio.com>
>>>>>>
>>>>>> New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
>>>>>> 0x400 of the function.  If no 3rd party VPD is present, then a copy of
>>>>>> Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
>>>>>> requires the VPD to be present at offset 0x0.
>>>>>>
>>>>>> Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
>>>>>> Signed-off-by: Vipul Pandya <vipul@chelsio.com>
>>>>>
>>>>> Isn't this a fix which is better targetted at 'net' than 'net-next'?
>>>>>
>>>>
>>>> We have very soon new patch series coming up for net-next. This patch
>>>> requires for that patch series to work correctly. So, we would like to
>>>> get this merge in net-next tree.
>>>
>>> But you can achieve that by asking me to apply this to 'net' and then
>>> when the patch series that depends upon it is posted, you tell me about
>>> this dependency.
>>>
>> Ok. I was not aware of this. However there can be a merge conflict at
>> the time of merging 'net' and 'net-next' tree if this patch gets applied
>> in 'net' tree and our new patch series gets applied in 'net-next'. To
>> avoid it we recommended the same. The merge conflict wont be a major and
>> if it is alright to resolve it we can apply this patch to 'net' tree.
> 
> That's why you tell me to first pull net into net-next, and you send
> me a patch set for net-next which assumes the fix from 'net' is
> already applied.
> 

Ok, I will inform you about the patch dependency on 'net' tree when I
post the patch series targeted for 'net-next'. Please consider applying
this patch to net tree.

Thanks,
Vipul
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - March 12, 2013, 9:37 a.m.
From: Vipul Pandya <vipul@chelsio.com>
Date: Fri,  8 Mar 2013 19:05:29 +0530

> From: Santosh Rastapur <santosh@chelsio.com>
> 
> New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
> 0x400 of the function.  If no 3rd party VPD is present, then a copy of
> Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
> requires the VPD to be present at offset 0x0.
> 
> Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
> Signed-off-by: Vipul Pandya <vipul@chelsio.com>

Applied to 'net'.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 4ce6203..8049268 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -497,8 +497,9 @@  int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len,
 }
 
 #define EEPROM_STAT_ADDR   0x7bfc
-#define VPD_BASE           0
 #define VPD_LEN            512
+#define VPD_BASE           0x400
+#define VPD_BASE_OLD       0
 
 /**
  *	t4_seeprom_wp - enable/disable EEPROM write protection
@@ -524,7 +525,7 @@  int t4_seeprom_wp(struct adapter *adapter, bool enable)
 int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
 {
 	u32 cclk_param, cclk_val;
-	int i, ret;
+	int i, ret, addr;
 	int ec, sn;
 	u8 *vpd, csum;
 	unsigned int vpdr_len, kw_offset, id_len;
@@ -533,7 +534,12 @@  int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
 	if (!vpd)
 		return -ENOMEM;
 
-	ret = pci_read_vpd(adapter->pdev, VPD_BASE, VPD_LEN, vpd);
+	ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd);
+	if (ret < 0)
+		goto out;
+	addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD;
+
+	ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd);
 	if (ret < 0)
 		goto out;