Skip to contentSkip to conversation

cxgb4: improve PCI VPD handling

PATCH RESEND Superseded Heiner Kallweit 4 participants 10 messages Feb 5, 2021 – Feb 9, 2021

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

v2 cover cxgb4: improve PCI VPD handling

Working on PCI VPD core code I came across the Chelsio drivers. Let's improve the way how cxgb4 handles PCI VPD.

One major goal is to eventually remove pci_set_vpd_size(), cxgb4 is the only user. The amount of data exposed via the VPD interface is fixed, therefore I see no benefit in providing an interface for manipulating the VPD size.

This series touches only device-specific quirks in the core code, therefore I think it should go via the netdev tree.

v2:
- remove patch 1 from the series

Resending the series because it seems netdev patchwork swallowed it.

Heiner Kallweit (3):
cxgb4: remove unused vpd_cap_addr
PCI/VPD: Change Chelsio T4 quirk to provide access to full virtual
address space
cxgb4: remove changing VPD len

 .../net/ethernet/chelsio/cxgb4/cudbg_entity.h |  1 -
 .../net/ethernet/chelsio/cxgb4/cudbg_lib.c    | 21 ++++---------------
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h    |  1 -
 .../net/ethernet/chelsio/cxgb4/cxgb4_main.c   |  2 --
 drivers/pci/vpd.c                             |  7 +++----
 5 files changed, 7 insertions(+), 25 deletions(-)
Signature · 1 line
2.30.0
#1 lore raw

PATCH RESEND v2 1/3 cxgb4: remove unused vpd_cap_addr

Supposedly this is a leftover from T3 driver heritage. cxgb4 uses the PCI core VPD access code that handles detection of VPD capabilities.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      | 1 -
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 --
 2 files changed, 3 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +0 -1
index 8e681ce72..314f8d806 100644
@@ -414,7 +414,6 @@ struct pf_resources {
 };
 
 struct pci_params {
-	unsigned int vpd_cap_addr;
 	unsigned char speed;
 	unsigned char width;
 };
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +0 -2
index 9f1965c80..6264bc66a 100644
@@ -3201,8 +3201,6 @@ static void cxgb4_mgmt_fill_vf_station_mac_addr(struct adapter *adap)
 	int err;
 	u8 *na;
 
-	adap->params.pci.vpd_cap_addr = pci_find_capability(adap->pdev,
-							    PCI_CAP_ID_VPD);
 	err = t4_get_raw_vpd_params(adap, &adap->params.vpd);
 	if (err)
 		return;
Signature · 1 line
2.30.0
#2 lore raw

PATCH RESEND v2 2/3 PCI/VPD: Change Chelsio T4 quirk to provide access to full virtual address space

In reply to Heiner Kallweit

cxgb4 uses the full VPD address space for accessing its EEPROM (with some mapping, see t4_eeprom_ptov()). In cudbg_collect_vpd_data() it sets the VPD len to 32K (PCI_VPD_MAX_SIZE), and then back to 2K (CUDBG_VPD_PF_SIZE). Having official (structured) and inofficial (unstructured) VPD data violates the PCI spec, let's set VPD len according to all data that can be accessed via PCI VPD access, no matter of its structure.

---
 drivers/pci/vpd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/pci/vpd.c +3 -4
index 7915d10f9..06a7954d0 100644
@@ -633,9 +633,8 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	/*
 	 * If this is a T3-based adapter, there's a 1KB VPD area at offset
 	 * 0xc00 which contains the preferred VPD values.  If this is a T4 or
-	 * later based adapter, the special VPD is at offset 0x400 for the
-	 * Physical Functions (the SR-IOV Virtual Functions have no VPD
-	 * Capabilities).  The PCI VPD Access core routines will normally
+	 * later based adapter, provide access to the full virtual EEPROM
+	 * address space. The PCI VPD Access core routines will normally
 	 * compute the size of the VPD by parsing the VPD Data Structure at
 	 * offset 0x000.  This will result in silent failures when attempting
 	 * to accesses these other VPD areas which are beyond those computed
@@ -644,7 +643,7 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	if (chip == 0x0 && prod >= 0x20)
 		pci_set_vpd_size(dev, 8192);
 	else if (chip >= 0x4 && func < 0x8)
-		pci_set_vpd_size(dev, 2048);
+		pci_set_vpd_size(dev, PCI_VPD_MAX_SIZE);
 }
 
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
Signature · 1 line
2.30.0
#3 lore raw

Re: [PATCH resend net-next v2 2/3] PCI/VPD: Change Chelsio T4 quirk to provide access to full virtual address space

[+cc Casey, Rahul]

Quoted 6 lines · Heiner Kallweit

cxgb4 uses the full VPD address space for accessing its EEPROM (with some mapping, see t4_eeprom_ptov()). In cudbg_collect_vpd_data() it sets the VPD len to 32K (PCI_VPD_MAX_SIZE), and then back to 2K (CUDBG_VPD_PF_SIZE). Having official (structured) and inofficial (unstructured) VPD data violates the PCI spec, let's set VPD len according to all data that can be accessed via PCI VPD access, no matter of its structure.

s/inofficial/unofficial/

Quoted 22 lines
---
 drivers/pci/vpd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/pci/vpd.c +2 -3
index 7915d10f9..06a7954d0 100644
@@ -633,9 +633,8 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	/*
 	 * If this is a T3-based adapter, there's a 1KB VPD area at offset
 	 * 0xc00 which contains the preferred VPD values.  If this is a T4 or
-	 * later based adapter, the special VPD is at offset 0x400 for the
-	 * Physical Functions (the SR-IOV Virtual Functions have no VPD
-	 * Capabilities).  The PCI VPD Access core routines will normally
+	 * later based adapter, provide access to the full virtual EEPROM
+	 * address space. The PCI VPD Access core routines will normally
 	 * compute the size of the VPD by parsing the VPD Data Structure at
 	 * offset 0x000.  This will result in silent failures when attempting
 	 * to accesses these other VPD areas which are beyond those computed

drivers/pci/vpd.c static void quirk_chelsio_extend_vpd(struct pci_dev *dev) · line 646

Quoted 5 lines
drivers/pci/vpd.c +1 -1
@@ -644,7 +643,7 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	if (chip == 0x0 && prod >= 0x20)
 		pci_set_vpd_size(dev, 8192);
 	else if (chip >= 0x4 && func < 0x8)
-		pci_set_vpd_size(dev, 2048);
+		pci_set_vpd_size(dev, PCI_VPD_MAX_SIZE);

This code was added by 7dcf688d4c78 ("PCI/cxgb4: Extend T3 PCI quirk to T4+ devices") [1]. Unfortunately that commit doesn't really have the details about what it fixes, other than the silent failures it mentions in the comment.

Some devices hang if we try to read at the wrong VPD address, and this can be done via the sysfs "vpd" file. Can you expand the commit log with an argument for why it is always safe to set the size to PCI_VPD_MAX_SIZE for these devices?

The fact that cudbg_collect_vpd_data() fiddles around with pci_set_vpd_size() suggests to me that there is *some* problem with reading parts of the VPD. Otherwise, why would they bother?

940c9c458866 ("cxgb4: collect vpd info directly from hardware") [2] added the pci_set_vpd_size() usage, but doesn't say why it's needed. Maybe Rahul will remember?

Bjorn

[1] https://git.kernel.org/linus/7dcf688d4c78
[2] https://git.kernel.org/linus/940c9c458866

Quoted 8 lines
drivers/pci/vpd.c +0 -0
 }
 
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
Signature · 1 line
2.30.0
#4 lore raw

Re: [PATCH resend net-next v2 2/3] PCI/VPD: Change Chelsio T4 quirk to provide access to full virtual address space

Quoted 45 lines · Bjorn Helgaas

[+cc Casey, Rahul]

Quoted 6 lines · Heiner Kallweit

cxgb4 uses the full VPD address space for accessing its EEPROM (with some mapping, see t4_eeprom_ptov()). In cudbg_collect_vpd_data() it sets the VPD len to 32K (PCI_VPD_MAX_SIZE), and then back to 2K (CUDBG_VPD_PF_SIZE). Having official (structured) and inofficial (unstructured) VPD data violates the PCI spec, let's set VPD len according to all data that can be accessed via PCI VPD access, no matter of its structure.

s/inofficial/unofficial/

Quoted 22 lines
---
 drivers/pci/vpd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/pci/vpd.c +2 -3
index 7915d10f9..06a7954d0 100644
@@ -633,9 +633,8 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	/*
 	 * If this is a T3-based adapter, there's a 1KB VPD area at offset
 	 * 0xc00 which contains the preferred VPD values.  If this is a T4 or
-	 * later based adapter, the special VPD is at offset 0x400 for the
-	 * Physical Functions (the SR-IOV Virtual Functions have no VPD
-	 * Capabilities).  The PCI VPD Access core routines will normally
+	 * later based adapter, provide access to the full virtual EEPROM
+	 * address space. The PCI VPD Access core routines will normally
 	 * compute the size of the VPD by parsing the VPD Data Structure at
 	 * offset 0x000.  This will result in silent failures when attempting
 	 * to accesses these other VPD areas which are beyond those computed

drivers/pci/vpd.c static void quirk_chelsio_extend_vpd(struct pci_dev *dev) · line 646

Quoted 5 lines
drivers/pci/vpd.c +1 -1
@@ -644,7 +643,7 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	if (chip == 0x0 && prod >= 0x20)
 		pci_set_vpd_size(dev, 8192);
 	else if (chip >= 0x4 && func < 0x8)
-		pci_set_vpd_size(dev, 2048);
+		pci_set_vpd_size(dev, PCI_VPD_MAX_SIZE);

This code was added by 7dcf688d4c78 ("PCI/cxgb4: Extend T3 PCI quirk to T4+ devices") [1]. Unfortunately that commit doesn't really have the details about what it fixes, other than the silent failures it mentions in the comment.

Quoted 5 lines

Some devices hang if we try to read at the wrong VPD address, and this can be done via the sysfs "vpd" file. Can you expand the commit log with an argument for why it is always safe to set the size to PCI_VPD_MAX_SIZE for these devices?

Seeing t4_eeprom_ptov() there is data at the end of the VPD address space, but there may be gaps in between. I don't have test hw, therefore it would be good if Chelsio could confirm that accessing any address in the VPD address space (32K) is ok. If a VPD address isn't backed by EEPROM, it should return 0x00 or 0xff, and not hang the device.

Quoted 8 lines

The fact that cudbg_collect_vpd_data() fiddles around with pci_set_vpd_size() suggests to me that there is *some* problem with reading parts of the VPD. Otherwise, why would they bother?

940c9c458866 ("cxgb4: collect vpd info directly from hardware") [2] added the pci_set_vpd_size() usage, but doesn't say why it's needed. Maybe Rahul will remember?

In addition we have cb92148b58a4 ("PCI: Add pci_set_vpd_size() to set VPD size"). To me it seems the VPD size quirks and this commit try to achieve the same: allow to override the autodetected VPD len

The quirk mechanism is well established, and if possible I'd like to get rid of pci_set_vpd_size(). I don't like the idea that the PCI core exposes API calls for accessing a proprietary VPD data format of one specific vendor (cxgb4 is the only user of pci_set_vpd_size()).

Quoted 13 lines

Bjorn

[1] https://git.kernel.org/linus/7dcf688d4c78
[2] https://git.kernel.org/linus/940c9c458866

Quoted 8 lines
drivers/pci/vpd.c +0 -0
 }
 
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
Signature · 1 line
2.30.0
#5 lore raw

Re: [PATCH resend net-next v2 2/3] PCI/VPD: Change Chelsio T4 quirk to provide access to full virtual address space

Quoted 52 lines · Heiner Kallweit
Quoted 45 lines · Bjorn Helgaas

[+cc Casey, Rahul]

Quoted 6 lines · Heiner Kallweit

cxgb4 uses the full VPD address space for accessing its EEPROM (with some mapping, see t4_eeprom_ptov()). In cudbg_collect_vpd_data() it sets the VPD len to 32K (PCI_VPD_MAX_SIZE), and then back to 2K (CUDBG_VPD_PF_SIZE). Having official (structured) and inofficial (unstructured) VPD data violates the PCI spec, let's set VPD len according to all data that can be accessed via PCI VPD access, no matter of its structure.

s/inofficial/unofficial/

Quoted 22 lines
---
 drivers/pci/vpd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/pci/vpd.c +2 -3
index 7915d10f9..06a7954d0 100644
@@ -633,9 +633,8 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	/*
 	 * If this is a T3-based adapter, there's a 1KB VPD area at offset
 	 * 0xc00 which contains the preferred VPD values.  If this is a T4 or
-	 * later based adapter, the special VPD is at offset 0x400 for the
-	 * Physical Functions (the SR-IOV Virtual Functions have no VPD
-	 * Capabilities).  The PCI VPD Access core routines will normally
+	 * later based adapter, provide access to the full virtual EEPROM
+	 * address space. The PCI VPD Access core routines will normally
 	 * compute the size of the VPD by parsing the VPD Data Structure at
 	 * offset 0x000.  This will result in silent failures when attempting
 	 * to accesses these other VPD areas which are beyond those computed

drivers/pci/vpd.c static void quirk_chelsio_extend_vpd(struct pci_dev *dev) · line 646

Quoted 5 lines
drivers/pci/vpd.c +1 -1
@@ -644,7 +643,7 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	if (chip == 0x0 && prod >= 0x20)
 		pci_set_vpd_size(dev, 8192);
 	else if (chip >= 0x4 && func < 0x8)
-		pci_set_vpd_size(dev, 2048);
+		pci_set_vpd_size(dev, PCI_VPD_MAX_SIZE);

This code was added by 7dcf688d4c78 ("PCI/cxgb4: Extend T3 PCI quirk to T4+ devices") [1]. Unfortunately that commit doesn't really have the details about what it fixes, other than the silent failures it mentions in the comment.

Quoted 5 lines

Some devices hang if we try to read at the wrong VPD address, and this can be done via the sysfs "vpd" file. Can you expand the commit log with an argument for why it is always safe to set the size to PCI_VPD_MAX_SIZE for these devices?

Quoted 7 lines

Seeing t4_eeprom_ptov() there is data at the end of the VPD address space, but there may be gaps in between. I don't have test hw, therefore it would be good if Chelsio could confirm that accessing any address in the VPD address space (32K) is ok. If a VPD address isn't backed by EEPROM, it should return 0x00 or 0xff, and not hang the device.

We've tested the patches on T5 adapter. Although there are no crashes seen, the 32K VPD read from sysfs at certain chunks are getting wrapped around and overwritten. We're still analyzing this.

Quoted 8 lines
Quoted 8 lines

The fact that cudbg_collect_vpd_data() fiddles around with pci_set_vpd_size() suggests to me that there is *some* problem with reading parts of the VPD. Otherwise, why would they bother?

940c9c458866 ("cxgb4: collect vpd info directly from hardware") [2] added the pci_set_vpd_size() usage, but doesn't say why it's needed. Maybe Rahul will remember?

If firmware has crashed, then it's not possible to collect the VPD info from firmware. So, the VPD info is fetched from EEPROM instead, which is unfortunately outside the VPD size of the PF.

Quoted 11 lines

In addition we have cb92148b58a4 ("PCI: Add pci_set_vpd_size() to set VPD size"). To me it seems the VPD size quirks and this commit try to achieve the same: allow to override the autodetected VPD len

The quirk mechanism is well established, and if possible I'd like to get rid of pci_set_vpd_size(). I don't like the idea that the PCI core exposes API calls for accessing a proprietary VPD data format of one specific vendor (cxgb4 is the only user of pci_set_vpd_size()).

There seems to be a way to get the Serial Configuration Version from some internal registers. I will send the patch soon. It should remove the call to pci_set_vpd_size() from cudbg_lib.c.

Thanks,
Rahul

Quoted 14 lines
Quoted 13 lines

Bjorn

[1] https://git.kernel.org/linus/7dcf688d4c78
[2] https://git.kernel.org/linus/940c9c458866

Quoted 8 lines
drivers/pci/vpd.c +0 -0
 }
 
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
Signature · 1 line
2.30.0
#6 lore raw

Re: [PATCH resend net-next v2 2/3] PCI/VPD: Change Chelsio T4 quirk to provide access to full virtual address space

Quoted 90 lines · Rahul Lakkireddy
Quoted 52 lines · Heiner Kallweit
Quoted 45 lines · Bjorn Helgaas

[+cc Casey, Rahul]

Quoted 6 lines · Heiner Kallweit

cxgb4 uses the full VPD address space for accessing its EEPROM (with some mapping, see t4_eeprom_ptov()). In cudbg_collect_vpd_data() it sets the VPD len to 32K (PCI_VPD_MAX_SIZE), and then back to 2K (CUDBG_VPD_PF_SIZE). Having official (structured) and inofficial (unstructured) VPD data violates the PCI spec, let's set VPD len according to all data that can be accessed via PCI VPD access, no matter of its structure.

s/inofficial/unofficial/

Quoted 22 lines
---
 drivers/pci/vpd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/pci/vpd.c +2 -3
index 7915d10f9..06a7954d0 100644
@@ -633,9 +633,8 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	/*
 	 * If this is a T3-based adapter, there's a 1KB VPD area at offset
 	 * 0xc00 which contains the preferred VPD values.  If this is a T4 or
-	 * later based adapter, the special VPD is at offset 0x400 for the
-	 * Physical Functions (the SR-IOV Virtual Functions have no VPD
-	 * Capabilities).  The PCI VPD Access core routines will normally
+	 * later based adapter, provide access to the full virtual EEPROM
+	 * address space. The PCI VPD Access core routines will normally
 	 * compute the size of the VPD by parsing the VPD Data Structure at
 	 * offset 0x000.  This will result in silent failures when attempting
 	 * to accesses these other VPD areas which are beyond those computed

drivers/pci/vpd.c static void quirk_chelsio_extend_vpd(struct pci_dev *dev) · line 646

Quoted 5 lines
drivers/pci/vpd.c +1 -1
@@ -644,7 +643,7 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 	if (chip == 0x0 && prod >= 0x20)
 		pci_set_vpd_size(dev, 8192);
 	else if (chip >= 0x4 && func < 0x8)
-		pci_set_vpd_size(dev, 2048);
+		pci_set_vpd_size(dev, PCI_VPD_MAX_SIZE);

This code was added by 7dcf688d4c78 ("PCI/cxgb4: Extend T3 PCI quirk to T4+ devices") [1]. Unfortunately that commit doesn't really have the details about what it fixes, other than the silent failures it mentions in the comment.

Quoted 5 lines

Some devices hang if we try to read at the wrong VPD address, and this can be done via the sysfs "vpd" file. Can you expand the commit log with an argument for why it is always safe to set the size to PCI_VPD_MAX_SIZE for these devices?

Quoted 7 lines

Seeing t4_eeprom_ptov() there is data at the end of the VPD address space, but there may be gaps in between. I don't have test hw, therefore it would be good if Chelsio could confirm that accessing any address in the VPD address space (32K) is ok. If a VPD address isn't backed by EEPROM, it should return 0x00 or 0xff, and not hang the device.

We've tested the patches on T5 adapter. Although there are no crashes seen, the 32K VPD read from sysfs at certain chunks are getting wrapped around and overwritten. We're still analyzing this.

Quoted 8 lines
Quoted 8 lines

The fact that cudbg_collect_vpd_data() fiddles around with pci_set_vpd_size() suggests to me that there is *some* problem with reading parts of the VPD. Otherwise, why would they bother?

940c9c458866 ("cxgb4: collect vpd info directly from hardware") [2] added the pci_set_vpd_size() usage, but doesn't say why it's needed. Maybe Rahul will remember?

If firmware has crashed, then it's not possible to collect the VPD info from firmware. So, the VPD info is fetched from EEPROM instead, which is unfortunately outside the VPD size of the PF.

Quoted 11 lines

In addition we have cb92148b58a4 ("PCI: Add pci_set_vpd_size() to set VPD size"). To me it seems the VPD size quirks and this commit try to achieve the same: allow to override the autodetected VPD len

The quirk mechanism is well established, and if possible I'd like to get rid of pci_set_vpd_size(). I don't like the idea that the PCI core exposes API calls for accessing a proprietary VPD data format of one specific vendor (cxgb4 is the only user of pci_set_vpd_size()).

Quoted 4 lines

There seems to be a way to get the Serial Configuration Version from some internal registers. I will send the patch soon. It should remove the call to pci_set_vpd_size() from cudbg_lib.c.

Great, this would be the best solution. Then we can get rid of pci_set_vpd_size() w/o impact on what is exposed via sysfs.

So for now I'll drop patches 2 and 3 and will resend patch 1 as a single patch.

Quoted 3 lines

Thanks,
Rahul

Heiner

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

Bjorn

[1] https://git.kernel.org/linus/7dcf688d4c78
[2] https://git.kernel.org/linus/940c9c458866

Quoted 8 lines
drivers/pci/vpd.c +0 -0
 }
 
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
Signature · 1 line
2.30.0
#7 lore raw

PATCH RESEND v2 3/3 cxgb4: remove changing VPD len

In reply to Heiner Kallweit

Now that the PCI VPD for Chelsio devices from T4 has been changed and VPD len is set to PCI_VPD_MAX_SIZE (32K), we don't have to change the VPD len any longer.

---
 .../net/ethernet/chelsio/cxgb4/cudbg_entity.h |  1 -
 .../net/ethernet/chelsio/cxgb4/cudbg_lib.c    | 21 ++++---------------
 2 files changed, 4 insertions(+), 18 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h +0 -1
index 876f90e57..02ccb610a 100644
@@ -220,7 +220,6 @@ struct cudbg_mps_tcam {
 	u8 reserved[2];
 };
 
-#define CUDBG_VPD_PF_SIZE 0x800
 #define CUDBG_SCFG_VER_ADDR 0x06
 #define CUDBG_SCFG_VER_LEN 4
 #define CUDBG_VPD_VER_ADDR 0x18c7
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +4 -17
index 75474f810..addac5518 100644
@@ -2689,7 +2689,7 @@ int cudbg_collect_vpd_data(struct cudbg_init *pdbg_init,
 	u32 scfg_vers, vpd_vers, fw_vers;
 	struct cudbg_vpd_data *vpd_data;
 	struct vpd_params vpd = { 0 };
-	int rc, ret;
+	int rc;
 
 	rc = t4_get_raw_vpd_params(padap, &vpd);
 	if (rc)
@@ -2699,24 +2699,11 @@ int cudbg_collect_vpd_data(struct cudbg_init *pdbg_init,
 	if (rc)
 		return rc;
 
-	/* Serial Configuration Version is located beyond the PF's vpd size.
-	 * Temporarily give access to entire EEPROM to get it.
-	 */
-	rc = pci_set_vpd_size(padap->pdev, EEPROMVSIZE);
-	if (rc < 0)
-		return rc;
-
-	ret = cudbg_read_vpd_reg(padap, CUDBG_SCFG_VER_ADDR, CUDBG_SCFG_VER_LEN,
-				 &scfg_vers);
-
-	/* Restore back to original PF's vpd size */
-	rc = pci_set_vpd_size(padap->pdev, CUDBG_VPD_PF_SIZE);
-	if (rc < 0)
+	rc = cudbg_read_vpd_reg(padap, CUDBG_SCFG_VER_ADDR, CUDBG_SCFG_VER_LEN,
+				&scfg_vers);
+	if (rc)
 		return rc;
 
-	if (ret)
-		return ret;
-
 	rc = cudbg_read_vpd_reg(padap, CUDBG_VPD_VER_ADDR, CUDBG_VPD_VER_LEN,
 				vpd_str);
 	if (rc)
Signature · 1 line
2.30.0
#8 lore raw

PATCH 1/1 cxgb4: remove unused vpd_cap_addr

In reply to Heiner Kallweit

It is likely that this is a leftover from T3 driver heritage. cxgb4 uses the PCI core VPD access code that handles detection of VPD capabilities.

---
- resend after dropping patches 2 and 3 from the series

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      | 1 -
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 --
 2 files changed, 3 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +0 -1
index 8e681ce72..314f8d806 100644
@@ -414,7 +414,6 @@ struct pf_resources {
 };
 
 struct pci_params {
-	unsigned int vpd_cap_addr;
 	unsigned char speed;
 	unsigned char width;
 };
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +0 -2
index 9f1965c80..6264bc66a 100644
@@ -3201,8 +3201,6 @@ static void cxgb4_mgmt_fill_vf_station_mac_addr(struct adapter *adap)
 	int err;
 	u8 *na;
 
-	adap->params.pci.vpd_cap_addr = pci_find_capability(adap->pdev,
-							    PCI_CAP_ID_VPD);
 	err = t4_get_raw_vpd_params(adap, &adap->params.vpd);
 	if (err)
 		return;
Signature · 1 line
2.30.0
#9 lore raw

Re: [PATCH net-next] cxgb4: remove unused vpd_cap_addr

This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 9 lines · On Mon, 8 Feb 2021 21:26:07 +0100 you wrote:

It is likely that this is a leftover from T3 driver heritage. cxgb4 uses the PCI core VPD access code that handles detection of VPD capabilities.

---
- resend after dropping patches 2 and 3 from the series

[...]

Here is the summary with links:
- [net-next] cxgb4: remove unused vpd_cap_addr

    https://git.kernel.org/netdev/net-next/c/4429c5fc3dbd

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html