t_hwrm_exec_fwd_req(struct bnxt_softc *bp); +void bnxt_destroy_trusted_vf_sysctls(struct bnxt_softc *softc); +int bnxt_set_vf_trust(struct bnxt_softc *softc, int vf_id, bool trusted); +int bnxt_approve_mac(struct bnxt_softc *sc); +void bnxt_update_vf_mac(struct bnxt_softc *sc); +bool bnxt_promisc_ok(struct bnxt_softc *softc); +int bnxt_set_vf_spoofchk(struct bnxt_softc *sc, int vf_id, bool enable); +int bnxt_cfg_hw_sriov(struct bnxt_softc *softc, uint16_t *num_vfs, bool reset); +void bnxt_reenable_sriov(struct bnxt_softc *bp); + + +#endif /* _BNXT_SRIOV_H_ */ diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c index dea6fd68181e..b9fb7fb8a7e4 100644 --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -266,6 +266,11 @@ static device_method_t bnxt_methods[] = { DEVMETHOD(device_shutdown, iflib_device_shutdown), DEVMETHOD(device_suspend, iflib_device_suspend), DEVMETHOD(device_resume, iflib_device_resume), +#ifdef PCI_IOV + DEVMETHOD(pci_iov_init, iflib_device_iov_init), + DEVMETHOD(pci_iov_uninit, iflib_device_iov_uninit), + DEVMETHOD(pci_iov_add_vf, iflib_device_iov_add_vf), +#endif DEVMETHOD_END }; @@ -344,7 +349,11 @@ static device_method_t bnxt_iflib_methods[] = { DEVMETHOD(ifdi_i2c_req, bnxt_i2c_req), DEVMETHOD(ifdi_needs_restart, bnxt_if_needs_restart), - +#ifdef PCI_IOV + DEVMETHOD(ifdi_iov_init, bnxt_iov_init), + DEVMETHOD(ifdi_iov_uninit, bnxt_iov_uninit), + DEVMETHOD(ifdi_iov_vf_add, bnxt_iov_vf_add), +#endif DEVMETHOD_END }; @@ -2738,6 +2747,12 @@ 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; } @@ -5324,4 +5339,4 @@ bnxt_get_wol_settings(struct bnxt_softc *softc) do { wol_handle = bnxt_hwrm_get_wol_fltrs(softc, wol_handle); } while (wol_handle && wol_handle != BNXT_NO_MORE_WOL_FILTERS); -} +} \ No newline at end of file diff --git a/sys/modules/bnxt/bnxt_en/Makefile b/sys/modules/bnxt/bnxt_en/Makefile index 12c23898c106..dc9b30b7f2af 100644 --- a/sys/modules/bnxt/bnxt_en/Makefile +++ b/sys/modules/bnxt/bnxt_en/Makefile @@ -9,6 +9,7 @@ SRCS += bnxt_sysctl.c SRCS += bnxt_mgmt.c SRCS += bnxt_dcb.c bnxt_dcb.h SRCS += bnxt_auxbus_compat.c bnxt_auxbus_compat.h +SRCS += bnxt_sriov.c bnxt_sriov.h SRCS += bnxt_ulp.c bnxt_ulp.h SRCS += ${LINUXKPI_GENSRCS}