bnxt: Fix build / load error for bnxt(4) in kernels without PCI_IOV

This change removes the hard-forcing of  PCI_IOV and adds shims to
allow the driver to compile and work when the kernel is missing
PCI_IOV support.

Fixes: 7c450d1127
Reviewed by: sumit.saxena_broadcom.com
Differential Revision: https://reviews.freebsd.org/D57300
Sponsored by: Netflix
This commit is contained in:
Andrew Gallatin
2026-05-29 08:52:44 -04:00
parent 283959bbe0
commit 3118f1b99f
3 changed files with 39 additions and 6 deletions
+39
View File
@@ -7,6 +7,8 @@
#include "bnxt_hwrm.h"
#include "bnxt_sriov.h"
#ifdef PCI_IOV
static int
bnxt_set_vf_admin_mac(struct bnxt_softc *softc, struct bnxt_vf_info *vf,
const uint8_t *mac)
@@ -973,6 +975,43 @@ void bnxt_sriov_attach(struct bnxt_softc *softc)
device_printf(dev, "Failed to initialize SR-IOV (error=%d)\n", rc);
}
#else
void
bnxt_sriov_attach(struct bnxt_softc *softc __unused)
{
}
int
bnxt_cfg_hw_sriov(struct bnxt_softc *softc __unused,
uint16_t *num_vfs __unused, bool reset __unused)
{
return (0);
}
int
bnxt_approve_mac(struct bnxt_softc *sc __unused)
{
return (0);
}
void
bnxt_hwrm_exec_fwd_req(struct bnxt_softc *softc __unused)
{
}
bool
bnxt_promisc_ok(struct bnxt_softc *softc __unused)
{
return (true);
}
void
bnxt_update_vf_mac(struct bnxt_softc *sc __unused)
{
}
#endif
void bnxt_reenable_sriov(struct bnxt_softc *bp)
{
if (BNXT_PF(bp)) {
-4
View File
@@ -8,10 +8,6 @@
#include "opt_global.h"
#include "bnxt.h"
#ifndef PCI_IOV
#define PCI_IOV 1
#endif
/* macro definations */
#define BNXT_MAX_VFS 4
-2
View File
@@ -2875,11 +2875,9 @@ bnxt_attach_post(if_ctx_t ctx)
bnxt_dcb_init(softc);
bnxt_rdma_aux_device_init(softc);
#if PCI_IOV
/* SR-IOV attach */
if (BNXT_PF(softc) && BNXT_CHIP_P5_PLUS(softc))
bnxt_sriov_attach(softc);
#endif
failed:
return rc;