linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions
@ 2021-08-22 13:46 Heiner Kallweit
  2021-08-22 13:48 ` [PATCH 01/12] sfc: falcon: Read VPD with pci_vpd_alloc() Heiner Kallweit
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Heiner Kallweit @ 2021-08-22 13:46 UTC (permalink / raw)
  To: Bjorn Helgaas, Edward Cree, Martin Habets, Rasesh Mody,
	GR-Linux-NIC-Dev, Ariel Elior, Sudarsana Kalluru,
	GR-everest-linux-l2, Michael Chan, Raju Rangoju, Manoj N. Kumar,
	Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-pci, SCSI development list

This series converts more users to the new VPD API functions.

bnx2 patches have been tested with a BCM5709 card.
The other patches are compile-tested, except cxlflash.

Heiner Kallweit (12):
  sfc: falcon: Read VPD with pci_vpd_alloc()
  sfc: falcon: Search VPD with pci_vpd_find_ro_info_keyword()
  bnx2: Search VPD with pci_vpd_find_ro_info_keyword()
  bnx2: Replace open-coded version with swab32s()
  bnx2x: Read VPD with pci_vpd_alloc()
  bnx2x: Search VPD with pci_vpd_find_ro_info_keyword()
  bnxt: Read VPD with pci_vpd_alloc()
  bnxt: Search VPD with pci_vpd_find_ro_info_keyword()
  cxgb4: Validate VPD checksum with pci_vpd_check_csum()
  cxgb4: Remove unused vpd_param member ec
  cxgb4: Search VPD with pci_vpd_find_ro_info_keyword()
  scsi: cxlflash: Search VPD with pci_vpd_find_ro_info_keyword()

 drivers/net/ethernet/broadcom/bnx2.c          | 46 +++-------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h   |  1 -
 .../net/ethernet/broadcom/bnx2x/bnx2x_main.c  | 91 ++++---------------
 drivers/net/ethernet/broadcom/bnxt/bnxt.c     | 49 +++-------
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h    |  2 -
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c    | 76 ++++++----------
 drivers/net/ethernet/sfc/falcon/efx.c         | 79 ++++------------
 drivers/scsi/cxlflash/main.c                  | 34 ++-----
 8 files changed, 98 insertions(+), 280 deletions(-)

-- 
2.33.0


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

* [PATCH 01/12] sfc: falcon: Read VPD with pci_vpd_alloc()
  2021-08-22 13:46 [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Heiner Kallweit
@ 2021-08-22 13:48 ` Heiner Kallweit
  2021-08-22 16:25   ` kernel test robot
  2021-08-22 13:49 ` [PATCH 02/12] sfc: falcon: Search VPD with pci_vpd_find_ro_info_keyword() Heiner Kallweit
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Heiner Kallweit @ 2021-08-22 13:48 UTC (permalink / raw)
  To: Bjorn Helgaas, Edward Cree, Martin Habets, Jakub Kicinski, David Miller
  Cc: linux-pci, SCSI development list, netdev

This is the same as 5119e20facfa "sfc: Read VPD with pci_vpd_alloc()",
just for the falcon chip version.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/sfc/falcon/efx.c | 30 +++++++++++++--------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c
index c177ea0f3..5ab1e863d 100644
--- a/drivers/net/ethernet/sfc/falcon/efx.c
+++ b/drivers/net/ethernet/sfc/falcon/efx.c
@@ -2780,22 +2780,18 @@ static void ef4_pci_remove(struct pci_dev *pci_dev)
 };
 
 /* NIC VPD information
- * Called during probe to display the part number of the
- * installed NIC.  VPD is potentially very large but this should
- * always appear within the first 512 bytes.
+ * Called during probe to display the part number of the installed NIC.
  */
-#define SFC_VPD_LEN 512
 static void ef4_probe_vpd_strings(struct ef4_nic *efx)
 {
 	struct pci_dev *dev = efx->pci_dev;
-	char vpd_data[SFC_VPD_LEN];
-	ssize_t vpd_size;
 	int ro_start, ro_size, i, j;
+	unsigned int vpd_size;
+	u8 *vpd_data;
 
-	/* Get the vpd data from the device */
-	vpd_size = pci_read_vpd(dev, 0, sizeof(vpd_data), vpd_data);
-	if (vpd_size <= 0) {
-		netif_err(efx, drv, efx->net_dev, "Unable to read VPD\n");
+	vpd_data = pci_vpd_alloc(dev, &vpd_size);
+	if (IS_ERR(vpd_data)) {
+		pci_warn(dev, "Unable to read VPD\n");
 		return;
 	}
 
@@ -2803,7 +2799,7 @@ static void ef4_probe_vpd_strings(struct ef4_nic *efx)
 	ro_start = pci_vpd_find_tag(vpd_data, vpd_size, PCI_VPD_LRDT_RO_DATA);
 	if (ro_start < 0) {
 		netif_err(efx, drv, efx->net_dev, "VPD Read-only not found\n");
-		return;
+		goto out;
 	}
 
 	ro_size = pci_vpd_lrdt_size(&vpd_data[ro_start]);
@@ -2816,14 +2812,14 @@ static void ef4_probe_vpd_strings(struct ef4_nic *efx)
 	i = pci_vpd_find_info_keyword(vpd_data, i, j, "PN");
 	if (i < 0) {
 		netif_err(efx, drv, efx->net_dev, "Part number not found\n");
-		return;
+		goto out;
 	}
 
 	j = pci_vpd_info_field_size(&vpd_data[i]);
 	i += PCI_VPD_INFO_FLD_HDR_SIZE;
 	if (i + j > vpd_size) {
 		netif_err(efx, drv, efx->net_dev, "Incomplete part number\n");
-		return;
+		goto out;
 	}
 
 	netif_info(efx, drv, efx->net_dev,
@@ -2834,21 +2830,23 @@ static void ef4_probe_vpd_strings(struct ef4_nic *efx)
 	i = pci_vpd_find_info_keyword(vpd_data, i, j, "SN");
 	if (i < 0) {
 		netif_err(efx, drv, efx->net_dev, "Serial number not found\n");
-		return;
+		goto out;
 	}
 
 	j = pci_vpd_info_field_size(&vpd_data[i]);
 	i += PCI_VPD_INFO_FLD_HDR_SIZE;
 	if (i + j > vpd_size) {
 		netif_err(efx, drv, efx->net_dev, "Incomplete serial number\n");
-		return;
+		goto out;
 	}
 
 	efx->vpd_sn = kmalloc(j + 1, GFP_KERNEL);
 	if (!efx->vpd_sn)
-		return;
+		goto out;
 
 	snprintf(efx->vpd_sn, j + 1, "%s", &vpd_data[i]);
+out:
+	kfree(vpd_data);
 }
 
 
-- 
2.33.0



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

* [PATCH 02/12] sfc: falcon: Search VPD with pci_vpd_find_ro_info_keyword()
  2021-08-22 13:46 [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Heiner Kallweit
  2021-08-22 13:48 ` [PATCH 01/12] sfc: falcon: Read VPD with pci_vpd_alloc() Heiner Kallweit
@ 2021-08-22 13:49 ` Heiner Kallweit
  2021-08-22 13:50 ` [PATCH 03/12] bnx2: " Heiner Kallweit
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Heiner Kallweit @ 2021-08-22 13:49 UTC (permalink / raw)
  To: Bjorn Helgaas, Edward Cree, Martin Habets, Jakub Kicinski, David Miller
  Cc: linux-pci, SCSI development list, netdev

This is the same as 37838aa437c7 "sfc: Search VPD with
pci_vpd_find_ro_info_keyword()", just for the falcon chip version.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/sfc/falcon/efx.c | 65 ++++++---------------------
 1 file changed, 14 insertions(+), 51 deletions(-)

diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c
index 5ab1e863d..423bdf812 100644
--- a/drivers/net/ethernet/sfc/falcon/efx.c
+++ b/drivers/net/ethernet/sfc/falcon/efx.c
@@ -2785,9 +2785,9 @@ static void ef4_pci_remove(struct pci_dev *pci_dev)
 static void ef4_probe_vpd_strings(struct ef4_nic *efx)
 {
 	struct pci_dev *dev = efx->pci_dev;
-	int ro_start, ro_size, i, j;
-	unsigned int vpd_size;
+	unsigned int vpd_size, kw_len;
 	u8 *vpd_data;
+	int start;
 
 	vpd_data = pci_vpd_alloc(dev, &vpd_size);
 	if (IS_ERR(vpd_data)) {
@@ -2795,57 +2795,20 @@ static void ef4_probe_vpd_strings(struct ef4_nic *efx)
 		return;
 	}
 
-	/* Get the Read only section */
-	ro_start = pci_vpd_find_tag(vpd_data, vpd_size, PCI_VPD_LRDT_RO_DATA);
-	if (ro_start < 0) {
-		netif_err(efx, drv, efx->net_dev, "VPD Read-only not found\n");
-		goto out;
-	}
-
-	ro_size = pci_vpd_lrdt_size(&vpd_data[ro_start]);
-	j = ro_size;
-	i = ro_start + PCI_VPD_LRDT_TAG_SIZE;
-	if (i + j > vpd_size)
-		j = vpd_size - i;
-
-	/* Get the Part number */
-	i = pci_vpd_find_info_keyword(vpd_data, i, j, "PN");
-	if (i < 0) {
-		netif_err(efx, drv, efx->net_dev, "Part number not found\n");
-		goto out;
-	}
-
-	j = pci_vpd_info_field_size(&vpd_data[i]);
-	i += PCI_VPD_INFO_FLD_HDR_SIZE;
-	if (i + j > vpd_size) {
-		netif_err(efx, drv, efx->net_dev, "Incomplete part number\n");
-		goto out;
-	}
-
-	netif_info(efx, drv, efx->net_dev,
-		   "Part Number : %.*s\n", j, &vpd_data[i]);
-
-	i = ro_start + PCI_VPD_LRDT_TAG_SIZE;
-	j = ro_size;
-	i = pci_vpd_find_info_keyword(vpd_data, i, j, "SN");
-	if (i < 0) {
-		netif_err(efx, drv, efx->net_dev, "Serial number not found\n");
-		goto out;
-	}
-
-	j = pci_vpd_info_field_size(&vpd_data[i]);
-	i += PCI_VPD_INFO_FLD_HDR_SIZE;
-	if (i + j > vpd_size) {
-		netif_err(efx, drv, efx->net_dev, "Incomplete serial number\n");
-		goto out;
-	}
+	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
+					     PCI_VPD_RO_KEYWORD_PARTNO, &kw_len);
+	if (start < 0)
+		pci_warn(dev, "Part number not found or incomplete\n");
+	else
+		pci_info(dev, "Part Number : %.*s\n", kw_len, vpd_data + start);
 
-	efx->vpd_sn = kmalloc(j + 1, GFP_KERNEL);
-	if (!efx->vpd_sn)
-		goto out;
+	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
+					     PCI_VPD_RO_KEYWORD_SERIALNO, &kw_len);
+	if (start < 0)
+		pci_warn(dev, "Serial number not found or incomplete\n");
+	else
+		efx->vpd_sn = kmemdup_nul(vpd_data + start, kw_len, GFP_KERNEL);
 
-	snprintf(efx->vpd_sn, j + 1, "%s", &vpd_data[i]);
-out:
 	kfree(vpd_data);
 }
 
-- 
2.33.0



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

* [PATCH 03/12] bnx2: Search VPD with pci_vpd_find_ro_info_keyword()
  2021-08-22 13:46 [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Heiner Kallweit
  2021-08-22 13:48 ` [PATCH 01/12] sfc: falcon: Read VPD with pci_vpd_alloc() Heiner Kallweit
  2021-08-22 13:49 ` [PATCH 02/12] sfc: falcon: Search VPD with pci_vpd_find_ro_info_keyword() Heiner Kallweit
@ 2021-08-22 13:50 ` Heiner Kallweit
  2021-08-22 13:52 ` [PATCH 04/12] bnx2: Replace open-coded version with swab32s() Heiner Kallweit
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Heiner Kallweit @ 2021-08-22 13:50 UTC (permalink / raw)
  To: Bjorn Helgaas, Rasesh Mody, GR-Linux-NIC-Dev, Jakub Kicinski,
	David Miller
  Cc: linux-pci, SCSI development list, netdev

Use pci_vpd_find_ro_info_keyword() to search for keywords in VPD to
simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/broadcom/bnx2.c | 33 +++++++---------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 89ee1c0e9..de1a60a95 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -8033,9 +8033,9 @@ bnx2_get_pci_speed(struct bnx2 *bp)
 static void
 bnx2_read_vpd_fw_ver(struct bnx2 *bp)
 {
+	unsigned int len;
 	int rc, i, j;
 	u8 *data;
-	unsigned int block_end, rosize, len;
 
 #define BNX2_VPD_NVRAM_OFFSET	0x300
 #define BNX2_VPD_LEN		128
@@ -8057,38 +8057,21 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
 		data[i + 3] = data[i + BNX2_VPD_LEN];
 	}
 
-	i = pci_vpd_find_tag(data, BNX2_VPD_LEN, PCI_VPD_LRDT_RO_DATA);
-	if (i < 0)
-		goto vpd_done;
-
-	rosize = pci_vpd_lrdt_size(&data[i]);
-	i += PCI_VPD_LRDT_TAG_SIZE;
-	block_end = i + rosize;
-
-	if (block_end > BNX2_VPD_LEN)
-		goto vpd_done;
-
-	j = pci_vpd_find_info_keyword(data, i, rosize,
-				      PCI_VPD_RO_KEYWORD_MFR_ID);
+	j = pci_vpd_find_ro_info_keyword(data, BNX2_VPD_LEN,
+					 PCI_VPD_RO_KEYWORD_MFR_ID, &len);
 	if (j < 0)
 		goto vpd_done;
 
-	len = pci_vpd_info_field_size(&data[j]);
-
-	j += PCI_VPD_INFO_FLD_HDR_SIZE;
-	if (j + len > block_end || len != 4 ||
-	    memcmp(&data[j], "1028", 4))
+	if (len != 4 || memcmp(&data[j], "1028", 4))
 		goto vpd_done;
 
-	j = pci_vpd_find_info_keyword(data, i, rosize,
-				      PCI_VPD_RO_KEYWORD_VENDOR0);
+	j = pci_vpd_find_ro_info_keyword(data, BNX2_VPD_LEN,
+					 PCI_VPD_RO_KEYWORD_VENDOR0,
+					 &len);
 	if (j < 0)
 		goto vpd_done;
 
-	len = pci_vpd_info_field_size(&data[j]);
-
-	j += PCI_VPD_INFO_FLD_HDR_SIZE;
-	if (j + len > block_end || len > BNX2_MAX_VER_SLEN)
+	if (len > BNX2_MAX_VER_SLEN)
 		goto vpd_done;
 
 	memcpy(bp->fw_version, &data[j], len);
-- 
2.33.0



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

* [PATCH 04/12] bnx2: Replace open-coded version with swab32s()
  2021-08-22 13:46 [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Heiner Kallweit
                   ` (2 preceding siblings ...)
  2021-08-22 13:50 ` [PATCH 03/12] bnx2: " Heiner Kallweit
@ 2021-08-22 13:52 ` Heiner Kallweit
  2021-08-22 14:01 ` [PATCH 12/12] scsi: cxlflash: Search VPD with pci_vpd_find_ro_info_keyword() Heiner Kallweit
  2021-08-24 18:48 ` [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Bjorn Helgaas
  5 siblings, 0 replies; 8+ messages in thread
From: Heiner Kallweit @ 2021-08-22 13:52 UTC (permalink / raw)
  To: Bjorn Helgaas, Rasesh Mody, GR-Linux-NIC-Dev, Jakub Kicinski,
	David Miller
  Cc: linux-pci, SCSI development list, netdev

Use swab32s() instead of open-coding it.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/broadcom/bnx2.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index de1a60a95..599fc1436 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -8041,21 +8041,16 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
 #define BNX2_VPD_LEN		128
 #define BNX2_MAX_VER_SLEN	30
 
-	data = kmalloc(256, GFP_KERNEL);
+	data = kmalloc(BNX2_VPD_LEN, GFP_KERNEL);
 	if (!data)
 		return;
 
-	rc = bnx2_nvram_read(bp, BNX2_VPD_NVRAM_OFFSET, data + BNX2_VPD_LEN,
-			     BNX2_VPD_LEN);
+	rc = bnx2_nvram_read(bp, BNX2_VPD_NVRAM_OFFSET, data, BNX2_VPD_LEN);
 	if (rc)
 		goto vpd_done;
 
-	for (i = 0; i < BNX2_VPD_LEN; i += 4) {
-		data[i] = data[i + BNX2_VPD_LEN + 3];
-		data[i + 1] = data[i + BNX2_VPD_LEN + 2];
-		data[i + 2] = data[i + BNX2_VPD_LEN + 1];
-		data[i + 3] = data[i + BNX2_VPD_LEN];
-	}
+	for (i = 0; i < BNX2_VPD_LEN; i += 4)
+		swab32s((u32 *)&data[i]);
 
 	j = pci_vpd_find_ro_info_keyword(data, BNX2_VPD_LEN,
 					 PCI_VPD_RO_KEYWORD_MFR_ID, &len);
-- 
2.33.0



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

* [PATCH 12/12] scsi: cxlflash: Search VPD with pci_vpd_find_ro_info_keyword()
  2021-08-22 13:46 [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Heiner Kallweit
                   ` (3 preceding siblings ...)
  2021-08-22 13:52 ` [PATCH 04/12] bnx2: Replace open-coded version with swab32s() Heiner Kallweit
@ 2021-08-22 14:01 ` Heiner Kallweit
  2021-08-24 18:48 ` [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Bjorn Helgaas
  5 siblings, 0 replies; 8+ messages in thread
From: Heiner Kallweit @ 2021-08-22 14:01 UTC (permalink / raw)
  To: Bjorn Helgaas, Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-pci, SCSI development list

Use pci_vpd_find_ro_info_keyword() to search for keywords in VPD to
simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/scsi/cxlflash/main.c | 34 ++++++----------------------------
 1 file changed, 6 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index 2f1894588..b2730e859 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -1629,8 +1629,8 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
 {
 	struct device *dev = &cfg->dev->dev;
 	struct pci_dev *pdev = cfg->dev;
-	int rc = 0;
-	int ro_start, ro_size, i, j, k;
+	int i, k, rc = 0;
+	unsigned int kw_size;
 	ssize_t vpd_size;
 	char vpd_data[CXLFLASH_VPD_LEN];
 	char tmp_buf[WWPN_BUF_LEN] = { 0 };
@@ -1648,24 +1648,6 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
 		goto out;
 	}
 
-	/* Get the read only section offset */
-	ro_start = pci_vpd_find_tag(vpd_data, vpd_size, PCI_VPD_LRDT_RO_DATA);
-	if (unlikely(ro_start < 0)) {
-		dev_err(dev, "%s: VPD Read-only data not found\n", __func__);
-		rc = -ENODEV;
-		goto out;
-	}
-
-	/* Get the read only section size, cap when extends beyond read VPD */
-	ro_size = pci_vpd_lrdt_size(&vpd_data[ro_start]);
-	j = ro_size;
-	i = ro_start + PCI_VPD_LRDT_TAG_SIZE;
-	if (unlikely((i + j) > vpd_size)) {
-		dev_dbg(dev, "%s: Might need to read more VPD (%d > %ld)\n",
-			__func__, (i + j), vpd_size);
-		ro_size = vpd_size - i;
-	}
-
 	/*
 	 * Find the offset of the WWPN tag within the read only
 	 * VPD data and validate the found field (partials are
@@ -1681,11 +1663,9 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
 	 * ports programmed and operate in an undefined state.
 	 */
 	for (k = 0; k < cfg->num_fc_ports; k++) {
-		j = ro_size;
-		i = ro_start + PCI_VPD_LRDT_TAG_SIZE;
-
-		i = pci_vpd_find_info_keyword(vpd_data, i, j, wwpn_vpd_tags[k]);
-		if (i < 0) {
+		i = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
+						 wwpn_vpd_tags[k], &kw_size);
+		if (i == -ENOENT) {
 			if (wwpn_vpd_required)
 				dev_err(dev, "%s: Port %d WWPN not found\n",
 					__func__, k);
@@ -1693,9 +1673,7 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
 			continue;
 		}
 
-		j = pci_vpd_info_field_size(&vpd_data[i]);
-		i += PCI_VPD_INFO_FLD_HDR_SIZE;
-		if (unlikely((i + j > vpd_size) || (j != WWPN_LEN))) {
+		if (i < 0 || kw_size != WWPN_LEN) {
 			dev_err(dev, "%s: Port %d WWPN incomplete or bad VPD\n",
 				__func__, k);
 			rc = -ENODEV;
-- 
2.33.0



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

* Re: [PATCH 01/12] sfc: falcon: Read VPD with pci_vpd_alloc()
  2021-08-22 13:48 ` [PATCH 01/12] sfc: falcon: Read VPD with pci_vpd_alloc() Heiner Kallweit
@ 2021-08-22 16:25   ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-08-22 16:25 UTC (permalink / raw)
  To: Heiner Kallweit, Bjorn Helgaas, Edward Cree, Martin Habets,
	Jakub Kicinski, David Miller
  Cc: kbuild-all, netdev, linux-pci, SCSI development list

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

Hi Heiner,

I love your patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on pci/next mkp-scsi/for-next linus/master v5.14-rc6 next-20210820]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Heiner-Kallweit/PCI-VPD-Convert-more-users-to-the-new-VPD-API-functions/20210822-220229
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/f04e3b53e818526cc8b869af3804e375c0a48abf
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Heiner-Kallweit/PCI-VPD-Convert-more-users-to-the-new-VPD-API-functions/20210822-220229
        git checkout f04e3b53e818526cc8b869af3804e375c0a48abf
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=xtensa 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/sfc/falcon/efx.c: In function 'ef4_probe_vpd_strings':
   drivers/net/ethernet/sfc/falcon/efx.c:2792:20: error: implicit declaration of function 'pci_vpd_alloc'; did you mean 'pci_pool_alloc'? [-Werror=implicit-function-declaration]
    2792 |         vpd_data = pci_vpd_alloc(dev, &vpd_size);
         |                    ^~~~~~~~~~~~~
         |                    pci_pool_alloc
>> drivers/net/ethernet/sfc/falcon/efx.c:2792:18: warning: assignment to 'u8 *' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
    2792 |         vpd_data = pci_vpd_alloc(dev, &vpd_size);
         |                  ^
   cc1: some warnings being treated as errors


vim +2792 drivers/net/ethernet/sfc/falcon/efx.c

  2781	
  2782	/* NIC VPD information
  2783	 * Called during probe to display the part number of the installed NIC.
  2784	 */
  2785	static void ef4_probe_vpd_strings(struct ef4_nic *efx)
  2786	{
  2787		struct pci_dev *dev = efx->pci_dev;
  2788		int ro_start, ro_size, i, j;
  2789		unsigned int vpd_size;
  2790		u8 *vpd_data;
  2791	
> 2792		vpd_data = pci_vpd_alloc(dev, &vpd_size);
  2793		if (IS_ERR(vpd_data)) {
  2794			pci_warn(dev, "Unable to read VPD\n");
  2795			return;
  2796		}
  2797	
  2798		/* Get the Read only section */
  2799		ro_start = pci_vpd_find_tag(vpd_data, vpd_size, PCI_VPD_LRDT_RO_DATA);
  2800		if (ro_start < 0) {
  2801			netif_err(efx, drv, efx->net_dev, "VPD Read-only not found\n");
  2802			goto out;
  2803		}
  2804	
  2805		ro_size = pci_vpd_lrdt_size(&vpd_data[ro_start]);
  2806		j = ro_size;
  2807		i = ro_start + PCI_VPD_LRDT_TAG_SIZE;
  2808		if (i + j > vpd_size)
  2809			j = vpd_size - i;
  2810	
  2811		/* Get the Part number */
  2812		i = pci_vpd_find_info_keyword(vpd_data, i, j, "PN");
  2813		if (i < 0) {
  2814			netif_err(efx, drv, efx->net_dev, "Part number not found\n");
  2815			goto out;
  2816		}
  2817	
  2818		j = pci_vpd_info_field_size(&vpd_data[i]);
  2819		i += PCI_VPD_INFO_FLD_HDR_SIZE;
  2820		if (i + j > vpd_size) {
  2821			netif_err(efx, drv, efx->net_dev, "Incomplete part number\n");
  2822			goto out;
  2823		}
  2824	
  2825		netif_info(efx, drv, efx->net_dev,
  2826			   "Part Number : %.*s\n", j, &vpd_data[i]);
  2827	
  2828		i = ro_start + PCI_VPD_LRDT_TAG_SIZE;
  2829		j = ro_size;
  2830		i = pci_vpd_find_info_keyword(vpd_data, i, j, "SN");
  2831		if (i < 0) {
  2832			netif_err(efx, drv, efx->net_dev, "Serial number not found\n");
  2833			goto out;
  2834		}
  2835	
  2836		j = pci_vpd_info_field_size(&vpd_data[i]);
  2837		i += PCI_VPD_INFO_FLD_HDR_SIZE;
  2838		if (i + j > vpd_size) {
  2839			netif_err(efx, drv, efx->net_dev, "Incomplete serial number\n");
  2840			goto out;
  2841		}
  2842	
  2843		efx->vpd_sn = kmalloc(j + 1, GFP_KERNEL);
  2844		if (!efx->vpd_sn)
  2845			goto out;
  2846	
  2847		snprintf(efx->vpd_sn, j + 1, "%s", &vpd_data[i]);
  2848	out:
  2849		kfree(vpd_data);
  2850	}
  2851	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 68217 bytes --]

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

* Re: [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions
  2021-08-22 13:46 [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Heiner Kallweit
                   ` (4 preceding siblings ...)
  2021-08-22 14:01 ` [PATCH 12/12] scsi: cxlflash: Search VPD with pci_vpd_find_ro_info_keyword() Heiner Kallweit
@ 2021-08-24 18:48 ` Bjorn Helgaas
  5 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2021-08-24 18:48 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Bjorn Helgaas, Edward Cree, Martin Habets, Rasesh Mody,
	GR-Linux-NIC-Dev, Ariel Elior, Sudarsana Kalluru,
	GR-everest-linux-l2, Michael Chan, Raju Rangoju, Manoj N. Kumar,
	Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
	Martin K. Petersen, linux-pci, SCSI development list

On Sun, Aug 22, 2021 at 03:46:20PM +0200, Heiner Kallweit wrote:
> This series converts more users to the new VPD API functions.
> 
> bnx2 patches have been tested with a BCM5709 card.
> The other patches are compile-tested, except cxlflash.
> 
> Heiner Kallweit (12):
>   sfc: falcon: Read VPD with pci_vpd_alloc()
>   sfc: falcon: Search VPD with pci_vpd_find_ro_info_keyword()
>   bnx2: Search VPD with pci_vpd_find_ro_info_keyword()
>   bnx2: Replace open-coded version with swab32s()
>   bnx2x: Read VPD with pci_vpd_alloc()
>   bnx2x: Search VPD with pci_vpd_find_ro_info_keyword()
>   bnxt: Read VPD with pci_vpd_alloc()
>   bnxt: Search VPD with pci_vpd_find_ro_info_keyword()
>   cxgb4: Validate VPD checksum with pci_vpd_check_csum()
>   cxgb4: Remove unused vpd_param member ec
>   cxgb4: Search VPD with pci_vpd_find_ro_info_keyword()
>   scsi: cxlflash: Search VPD with pci_vpd_find_ro_info_keyword()
> 
>  drivers/net/ethernet/broadcom/bnx2.c          | 46 +++-------
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x.h   |  1 -
>  .../net/ethernet/broadcom/bnx2x/bnx2x_main.c  | 91 ++++---------------
>  drivers/net/ethernet/broadcom/bnxt/bnxt.c     | 49 +++-------
>  drivers/net/ethernet/chelsio/cxgb4/cxgb4.h    |  2 -
>  drivers/net/ethernet/chelsio/cxgb4/t4_hw.c    | 76 ++++++----------
>  drivers/net/ethernet/sfc/falcon/efx.c         | 79 ++++------------
>  drivers/scsi/cxlflash/main.c                  | 34 ++-----
>  8 files changed, 98 insertions(+), 280 deletions(-)

I added these to pci/vpd for v5.15, thanks!

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

end of thread, other threads:[~2021-08-24 18:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22 13:46 [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Heiner Kallweit
2021-08-22 13:48 ` [PATCH 01/12] sfc: falcon: Read VPD with pci_vpd_alloc() Heiner Kallweit
2021-08-22 16:25   ` kernel test robot
2021-08-22 13:49 ` [PATCH 02/12] sfc: falcon: Search VPD with pci_vpd_find_ro_info_keyword() Heiner Kallweit
2021-08-22 13:50 ` [PATCH 03/12] bnx2: " Heiner Kallweit
2021-08-22 13:52 ` [PATCH 04/12] bnx2: Replace open-coded version with swab32s() Heiner Kallweit
2021-08-22 14:01 ` [PATCH 12/12] scsi: cxlflash: Search VPD with pci_vpd_find_ro_info_keyword() Heiner Kallweit
2021-08-24 18:48 ` [PATCH 00/12] PCI/VPD: Convert more users to the new VPD API functions Bjorn Helgaas

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