Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ice/if_ice_iflib.c
Show First 20 Lines • Show All 747 Lines • ▼ Show 20 Lines | ice_if_attach_post(if_ctx_t ctx) | ||||
err = ice_initialize_vsi(&sc->pf_vsi); | err = ice_initialize_vsi(&sc->pf_vsi); | ||||
if (err) { | if (err) { | ||||
device_printf(sc->dev, "Unable to initialize Main VSI: %s\n", | device_printf(sc->dev, "Unable to initialize Main VSI: %s\n", | ||||
ice_err_str(err)); | ice_err_str(err)); | ||||
return err; | return err; | ||||
} | } | ||||
/* Enable FW health event reporting */ | |||||
ice_init_health_events(sc); | |||||
/* Configure the main PF VSI for RSS */ | /* Configure the main PF VSI for RSS */ | ||||
err = ice_config_rss(&sc->pf_vsi); | err = ice_config_rss(&sc->pf_vsi); | ||||
if (err) { | if (err) { | ||||
device_printf(sc->dev, | device_printf(sc->dev, | ||||
"Unable to configure RSS for the main VSI, err %s\n", | "Unable to configure RSS for the main VSI, err %s\n", | ||||
ice_err_str(err)); | ice_err_str(err)); | ||||
return err; | return err; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,177 Lines • ▼ Show 20 Lines | ice_poll_for_media_avail(struct ice_softc *sc) | ||||
if (ice_test_state(&sc->state, ICE_STATE_NO_MEDIA)) { | if (ice_test_state(&sc->state, ICE_STATE_NO_MEDIA)) { | ||||
pi->phy.get_link_info = true; | pi->phy.get_link_info = true; | ||||
ice_get_link_status(pi, &sc->link_up); | ice_get_link_status(pi, &sc->link_up); | ||||
if (pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE) { | if (pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE) { | ||||
enum ice_status status; | enum ice_status status; | ||||
/* Re-enable link and re-apply user link settings */ | /* Re-enable link and re-apply user link settings */ | ||||
ice_apply_saved_phy_cfg(sc); | ice_apply_saved_phy_cfg(sc, ICE_APPLY_LS_FEC_FC); | ||||
/* Update the OS about changes in media capability */ | /* Update the OS about changes in media capability */ | ||||
status = ice_add_media_types(sc, sc->media); | status = ice_add_media_types(sc, sc->media); | ||||
if (status) | if (status) | ||||
device_printf(sc->dev, "Error adding device media types: %s aq_err %s\n", | device_printf(sc->dev, "Error adding device media types: %s aq_err %s\n", | ||||
ice_status_str(status), | ice_status_str(status), | ||||
ice_aq_str(hw->adminq.sq_last_status)); | ice_aq_str(hw->adminq.sq_last_status)); | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
* @remark because this is a callout function, it cannot sleep and should not | * @remark because this is a callout function, it cannot sleep and should not | ||||
* attempt taking the iflib CTX lock. | * attempt taking the iflib CTX lock. | ||||
*/ | */ | ||||
static void | static void | ||||
ice_admin_timer(void *arg) | ice_admin_timer(void *arg) | ||||
{ | { | ||||
struct ice_softc *sc = (struct ice_softc *)arg; | struct ice_softc *sc = (struct ice_softc *)arg; | ||||
/* | |||||
* There is a point where callout routines are no longer | |||||
* cancelable. So there exists a window of time where the | |||||
* driver enters detach() and tries to cancel the callout, but the | |||||
* callout routine has passed the cancellation point. The detach() | |||||
* routine is unaware of this and tries to free resources that the | |||||
* callout routine needs. So we check for the detach state flag to | |||||
* at least shrink the window of opportunity. | |||||
*/ | |||||
if (ice_driver_is_detaching(sc)) | |||||
return; | |||||
/* Fire off the admin task */ | /* Fire off the admin task */ | ||||
iflib_admin_intr_deferred(sc->ctx); | iflib_admin_intr_deferred(sc->ctx); | ||||
/* Reschedule the admin timer */ | /* Reschedule the admin timer */ | ||||
callout_schedule(&sc->admin_timer, hz/2); | callout_schedule(&sc->admin_timer, hz/2); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | if (err) { | ||||
goto err_release_queue_allocations; | goto err_release_queue_allocations; | ||||
} | } | ||||
/* Replay all VSI configuration */ | /* Replay all VSI configuration */ | ||||
err = ice_replay_all_vsi_cfg(sc); | err = ice_replay_all_vsi_cfg(sc); | ||||
if (err) | if (err) | ||||
goto err_deinit_pf_vsi; | goto err_deinit_pf_vsi; | ||||
/* Re-enable FW health event reporting */ | |||||
ice_init_health_events(sc); | |||||
/* Reconfigure the main PF VSI for RSS */ | /* Reconfigure the main PF VSI for RSS */ | ||||
err = ice_config_rss(&sc->pf_vsi); | err = ice_config_rss(&sc->pf_vsi); | ||||
if (err) { | if (err) { | ||||
device_printf(sc->dev, | device_printf(sc->dev, | ||||
"Unable to reconfigure RSS for the main VSI, err %s\n", | "Unable to reconfigure RSS for the main VSI, err %s\n", | ||||
ice_err_str(err)); | ice_err_str(err)); | ||||
goto err_deinit_pf_vsi; | goto err_deinit_pf_vsi; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | ice_init_device_features(struct ice_softc *sc) | ||||
*/ | */ | ||||
if (ice_is_bit_set(sc->feat_en, ICE_FEATURE_SAFE_MODE)) | if (ice_is_bit_set(sc->feat_en, ICE_FEATURE_SAFE_MODE)) | ||||
return; | return; | ||||
/* Set capabilities that all devices support */ | /* Set capabilities that all devices support */ | ||||
ice_set_bit(ICE_FEATURE_SRIOV, sc->feat_cap); | ice_set_bit(ICE_FEATURE_SRIOV, sc->feat_cap); | ||||
ice_set_bit(ICE_FEATURE_RSS, sc->feat_cap); | ice_set_bit(ICE_FEATURE_RSS, sc->feat_cap); | ||||
ice_set_bit(ICE_FEATURE_LENIENT_LINK_MODE, sc->feat_cap); | ice_set_bit(ICE_FEATURE_LENIENT_LINK_MODE, sc->feat_cap); | ||||
ice_set_bit(ICE_FEATURE_DEFAULT_OVERRIDE, sc->feat_cap); | ice_set_bit(ICE_FEATURE_LINK_MGMT_VER_1, sc->feat_cap); | ||||
ice_set_bit(ICE_FEATURE_LINK_MGMT_VER_2, sc->feat_cap); | |||||
ice_set_bit(ICE_FEATURE_HEALTH_STATUS, sc->feat_cap); | |||||
/* Disable features due to hardware limitations... */ | /* Disable features due to hardware limitations... */ | ||||
if (!sc->hw.func_caps.common_cap.rss_table_size) | if (!sc->hw.func_caps.common_cap.rss_table_size) | ||||
ice_clear_bit(ICE_FEATURE_RSS, sc->feat_cap); | ice_clear_bit(ICE_FEATURE_RSS, sc->feat_cap); | ||||
/* Disable features due to firmware limitations... */ | |||||
if (!ice_is_fw_health_report_supported(&sc->hw)) | |||||
ice_clear_bit(ICE_FEATURE_HEALTH_STATUS, sc->feat_cap); | |||||
/* Disable capabilities not supported by the OS */ | /* Disable capabilities not supported by the OS */ | ||||
ice_disable_unsupported_features(sc->feat_cap); | ice_disable_unsupported_features(sc->feat_cap); | ||||
/* RSS is always enabled for iflib */ | /* RSS is always enabled for iflib */ | ||||
if (ice_is_bit_set(sc->feat_cap, ICE_FEATURE_RSS)) | if (ice_is_bit_set(sc->feat_cap, ICE_FEATURE_RSS)) | ||||
ice_set_bit(ICE_FEATURE_RSS, sc->feat_en); | ice_set_bit(ICE_FEATURE_RSS, sc->feat_en); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 325 Lines • Show Last 20 Lines |