+ bzero(&vf->vsi.info, sizeof(vf->vsi.info)); + ixl_pf_qmgr_clear_queue_flags(&vf->qtag); + ixl_free_filters(&vf->vsi.ftl); + vf->vsi.num_hw_filters = 0; + vf->vsi.num_macs = 0; + vf->vsi.num_vlans = 0; + bit_nclear(vf->vsi.vlans_map, 0, + IXL_VLANS_MAP_LEN - 1); + vf->num_mac_filters = 0; + } + + error = ixl_setup_iov_switch(pf); + if (error != 0) + return (error); + + first_error = 0; + for (i = 0; i < pf->num_vfs; i++) { + vf = &pf->vfs[i]; + if (!(vf->vf_flags & VF_FLAG_ENABLED)) + continue; + + wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_num), + VIRTCHNL_VFR_COMPLETED); + vfrtrig = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_num)); + vfrtrig &= ~I40E_VPGEN_VFRTRIG_VFSWR_MASK; + wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_num), vfrtrig); + + error = ixl_vf_setup_vsi(pf, vf); + if (error != 0) { + device_printf(pf->dev, + "Failed to rebuild VF-%d: %d\n", i, error); + if (first_error == 0) + first_error = error; + continue; + } + ixl_vf_map_queues(pf, vf); + wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_num), + VIRTCHNL_VFR_VFACTIVE); + } + ixl_flush(hw); + return (first_error); +} + +int +ixl_if_iov_init(if_ctx_t ctx, uint16_t num_vfs, const nvlist_t *params) +{ + struct ixl_pf *pf = iflib_get_softc(ctx); + int error, i; pf->vfs = malloc(sizeof(struct ixl_vf) * num_vfs, M_IXL, M_NOWAIT | M_ZERO); @@ -2001,28 +2116,9 @@ ixl_if_iov_init(if_ctx_t ctx, uint16_t num_vfs, const nvlist_t *params) for (i = 0; i < num_vfs; i++) sysctl_ctx_init(&pf->vfs[i].vsi.sysctl_ctx); - /* - * Add the VEB and ... - * - do nothing: VEPA mode - * - enable loopback mode on connected VSIs: VEB mode - */ - ret = i40e_aq_add_veb(hw, pf_vsi->uplink_seid, pf_vsi->seid, - 1, FALSE, &pf->veb_seid, FALSE, NULL); - if (ret != I40E_SUCCESS) { - error = hw->aq.asq_last_status; - device_printf(dev, "i40e_aq_add_veb failed; status %s error %s", - i40e_stat_str(hw, ret), i40e_aq_str(hw, error)); + error = ixl_setup_iov_switch(pf); + if (error != 0) goto fail; - } - if (pf->enable_vf_loopback) - ixl_config_pf_vsi_loopback(pf, true); - - /* - * Adding a VEB brings back the default MAC filter(s). Remove them, - * and let the driver add the proper filters back. - */ - ixl_del_default_hw_filters(pf_vsi); - ixl_reconfigure_filters(pf_vsi); pf->num_vfs = num_vfs; return (0); diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 674e45823cc4..cb6f64f66209 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -494,7 +494,7 @@ ixl_set_initial_advertised_speeds(struct ixl_pf *pf) int ixl_teardown_hw_structs(struct ixl_pf *pf) { - enum i40e_status_code status = 0; + enum i40e_status_code error, status = I40E_SUCCESS; struct i40e_hw *hw = &pf->hw; device_t dev = pf->dev; @@ -505,20 +505,21 @@ ixl_teardown_hw_structs(struct ixl_pf *pf) device_printf(dev, "init: LAN HMC shutdown failure; status %s\n", i40e_stat_str(hw, status)); - goto err_out; } } /* Shutdown admin queue */ ixl_disable_intr0(hw); - status = i40e_shutdown_adminq(hw); - if (status) + error = i40e_shutdown_adminq(hw); + if (error) { device_printf(dev, "init: Admin Queue shutdown failure; status %s\n", - i40e_stat_str(hw, status)); + i40e_stat_str(hw, error)); + if (status == I40E_SUCCESS) + status = error; + } ixl_pf_qmgr_release(&pf->qmgr, &pf->qtag); -err_out: return (status); }