--- /dev/null
+From 63664de9287a2f3e709d60e6e6b7973da78ae70a Mon Sep 17 00:00:00 2001
+From: Arjun Vynipadath <arjun@chelsio.com>
+Date: Tue, 26 Jun 2018 12:11:30 +0530
+Subject: [PATCH] cxgb4: Use pci_set_vpd_size() for kernels < 4.16
+
+Kernels > 4.16 removed pci_set_vpd_size() from cxgb4 driver and
+moved VPD size setting to PCI(pci/quirks.c).
+However, for OFED-4.17, when used with distros that doesn't
+have this PCI fix, adapter initialization fails due to
+incorrect VPD size. Fix that by adding pci_set_vpd_size()
+back for kernels < 4.16.
+---
+ drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+index 7cb3ef4..981f035 100644
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+@@ -2692,6 +2692,9 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size)
+ }
+
+ #define EEPROM_STAT_ADDR 0x7bfc
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
++#define VPD_SIZE 0x800
++#endif
+ #define VPD_BASE 0x400
+ #define VPD_BASE_OLD 0
+ #define VPD_LEN 1024
+@@ -2758,6 +2761,17 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p)
+ if (!vpd)
+ return -ENOMEM;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
++ /* We have two VPD data structures stored in the adapter VPD area.
++ * By default, Linux calculates the size of the VPD area by traversing
++ * the first VPD area at offset 0x0, so we need to tell the OS what
++ * our real VPD size is.
++ */
++ ret = pci_set_vpd_size(adapter->pdev, VPD_SIZE);
++ if (ret < 0)
++ goto out;
++#endif
++
+ /* Card information normally starts at VPD_BASE but early cards had
+ * it at 0.
+ */
+--
+1.8.3.1
+