Patchwork [net-next] bnx2x: Fix compilation when CONFIG_PCI_IOV is not defined

login
register
mail settings
Submitter Ariel Elior
Date Jan. 2, 2013, 1:36 p.m.
Message ID <1357133785-9569-1-git-send-email-ariele@broadcom.com>
Download mbox | patch
Permalink /patch/209045/
State Rejected
Delegated to: David Miller
Headers show

Comments

Ariel Elior - Jan. 2, 2013, 1:36 p.m.
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.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
David Miller - Jan. 3, 2013, 2:47 a.m.
From: "Ariel Elior" <ariele@broadcom.com>
Date: Wed, 2 Jan 2013 15:36:25 +0200

> 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.
> 
> Signed-off-by: Ariel Elior <ariele@broadcom.com>

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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 71fcef0..2142839 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -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)