Blob Blame History Raw
From cf9db86987ccbc1a0eefd77e7b2f8b1c761be1a9 Mon Sep 17 00:00:00 2001
From: Jordan Hargrave <Jordan_Hargrave@dell.com>
Date: Wed, 16 Oct 2013 15:12:06 -0500
Subject: [PATCH] Stop reading VPD data once VPD-R section has been read
 Mellanox cards were taking too long to read entire VPD

---
 src/pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pci.c b/src/pci.c
index 7aa32fc..a2b9faa 100644
--- a/src/pci.c
+++ b/src/pci.c
@@ -30,6 +30,7 @@ extern int is_valid_smbios;
 /* Borrowed from kernel vpd code */
 #define PCI_VPD_LRDT 			0x80
 #define PCI_VPD_SRDT_END 		0x78
+#define PCI_VPDR_TAG                    0x90
 
 #define PCI_VPD_SRDT_LEN_MASK		0x7
 #define PCI_VPD_LRDT_TAG_SIZE		3
@@ -71,7 +72,7 @@ static int pci_vpd_size(struct pci_device *pdev, int fd)
 			tag = buf[0] & ~PCI_VPD_SRDT_LEN_MASK;
 			off += PCI_VPD_SRDT_TAG_SIZE + pci_vpd_srdt_size(buf);
 		}
-		if (tag == 0 || tag == 0xFF || tag == PCI_VPD_SRDT_END)
+		if (tag == 0 || tag == 0xFF || tag == PCI_VPD_SRDT_END || tag == PCI_VPDR_TAG)
 			break;
 	}
 	return off;
@@ -125,7 +126,7 @@ static int parse_vpd(struct libbiosdevname_state *state, struct pci_device *pdev
 	int i, j, k, isz, jsz, port, func, pfi;
 	struct pci_device *vf;
 
-	i = pci_vpd_find_tag(vpd, 0, len, 0x90);
+	i = pci_vpd_find_tag(vpd, 0, len, PCI_VPDR_TAG);
 	if (i < 0)
 		return 1;
 	isz = pci_vpd_lrdt_size(&vpd[i]);
-- 
1.8.5.3