Skip to contentSkip to conversation

bnx2x: Fix compilation when CONFIG_PCI_IOV is not defined

PATCH In review Ariel Elior 2 participants 2 messages Jan 2, 2013 – Jan 3, 2013

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

PATCH 1/1 bnx2x: Fix compilation when CONFIG_PCI_IOV is not defined

This patch ifdefs out the use of PCI_IOV_RESOURCES which exists in the kernel only when CONFIG_PCI_IOV is defined. There is no point in doing the same for the invocation of SRIOV functionality in the driver as it will be immediately failed by a kernel which was thus compiled.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +2 -0
index 71fcef0..2142839 100644
@@ -1792,6 +1792,7 @@ static int bnx2x_vf_devfn(struct bnx2x *bp, int vfid)
 
 static void bnx2x_vf_set_bars(struct bnx2x *bp, struct bnx2x_virtf *vf)
 {
+#ifdef CONFIG_PCI_IOV
 	int i, n;
 	struct pci_dev *dev = bp->pdev;
 	struct bnx2x_sriov *iov = &bp->vfdb->sriov;
@@ -1804,6 +1805,7 @@ static void bnx2x_vf_set_bars(struct bnx2x *bp, struct bnx2x_virtf *vf)
 		vf->bars[n].bar = start + size * vf->abs_vfid;
 		vf->bars[n].size = size;
 	}
+#endif /* CONFIG_PCI_IOV */
 }
 
 static int bnx2x_ari_enabled(struct pci_dev *dev)
Signature · 1 line
1.7.9.GIT
maintainer
#1 lore raw

From: "Ariel Elior" <[email protected]>
Date: Wed, 2 Jan 2013 15:36:25 +0200

Quoted 6 lines

This patch ifdefs out the use of PCI_IOV_RESOURCES which exists in the kernel only when CONFIG_PCI_IOV is defined. There is no point in doing the same for the invocation of SRIOV functionality in the driver as it will be immediately failed by a kernel which was thus compiled.

This fixes the build but this is a very disappointing patch.

None of your SR-IOV support can possibly work if CONFIG_PCI_IOV is not set.

Look at how the SFC driver has a special Kconfig option and elides all of it's SR-IOV code when that Kconfig option is not set.

That kind of Kconfig option is where you express the CONFIG_PCI_IOV dependency, rather than in a hackish way with ifdefs as a knee-jerk response to a build failure reports.

I'm not applying this patch, segregate your driver properly and use Kconfig dependencies to elide the building of all of the SR-IOV support code in this driver.