Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ice/if_ice_iflib.c
Context not available. | |||||
static uint64_t ice_if_get_counter(if_ctx_t ctx, ift_counter counter); | static uint64_t ice_if_get_counter(if_ctx_t ctx, ift_counter counter); | ||||
static int ice_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_t data); | static int ice_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_t data); | ||||
static int ice_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req); | static int ice_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req); | ||||
static int ice_if_suspend(if_ctx_t ctx); | |||||
static int ice_if_resume(if_ctx_t ctx); | |||||
static int ice_msix_que(void *arg); | static int ice_msix_que(void *arg); | ||||
static int ice_msix_admin(void *arg); | static int ice_msix_admin(void *arg); | ||||
Context not available. | |||||
DEVMETHOD(ifdi_get_counter, ice_if_get_counter), | DEVMETHOD(ifdi_get_counter, ice_if_get_counter), | ||||
DEVMETHOD(ifdi_priv_ioctl, ice_if_priv_ioctl), | DEVMETHOD(ifdi_priv_ioctl, ice_if_priv_ioctl), | ||||
DEVMETHOD(ifdi_i2c_req, ice_if_i2c_req), | DEVMETHOD(ifdi_i2c_req, ice_if_i2c_req), | ||||
DEVMETHOD(ifdi_suspend, ice_if_suspend), | |||||
DEVMETHOD(ifdi_resume, ice_if_resume), | |||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
Context not available. | |||||
MODULE_DEPEND(ice, pci, 1, 1, 1); | MODULE_DEPEND(ice, pci, 1, 1, 1); | ||||
MODULE_DEPEND(ice, ether, 1, 1, 1); | MODULE_DEPEND(ice, ether, 1, 1, 1); | ||||
MODULE_DEPEND(ice, iflib, 1, 1, 1); | MODULE_DEPEND(ice, iflib, 1, 1, 1); | ||||
MODULE_DEPEND(ice, firmware, 1, 1, 1); | |||||
IFLIB_PNP_INFO(pci, ice, ice_vendor_info_array); | IFLIB_PNP_INFO(pci, ice, ice_vendor_info_array); | ||||
Context not available. | |||||
ice_update_link_status(struct ice_softc *sc, bool update_media) | ice_update_link_status(struct ice_softc *sc, bool update_media) | ||||
{ | { | ||||
struct ice_hw *hw = &sc->hw; | struct ice_hw *hw = &sc->hw; | ||||
enum ice_status status; | |||||
/* Never report link up when in recovery mode */ | /* Never report link up when in recovery mode */ | ||||
if (ice_test_state(&sc->state, ICE_STATE_RECOVERY_MODE)) | if (ice_test_state(&sc->state, ICE_STATE_RECOVERY_MODE)) | ||||
Context not available. | |||||
if (sc->link_up) { /* link is up */ | if (sc->link_up) { /* link is up */ | ||||
uint64_t baudrate = ice_aq_speed_to_rate(sc->hw.port_info); | uint64_t baudrate = ice_aq_speed_to_rate(sc->hw.port_info); | ||||
ice_set_default_local_lldp_mib(sc); | |||||
iflib_link_state_change(sc->ctx, LINK_STATE_UP, baudrate); | iflib_link_state_change(sc->ctx, LINK_STATE_UP, baudrate); | ||||
ice_link_up_msg(sc); | ice_link_up_msg(sc); | ||||
Context not available. | |||||
/* Update the supported media types */ | /* Update the supported media types */ | ||||
if (update_media) { | if (update_media) { | ||||
enum ice_status 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), | ||||
Context not available. | |||||
ASSERT_CTX_LOCKED(sc); | ASSERT_CTX_LOCKED(sc); | ||||
/* | |||||
* We've seen an issue with 11.3/12.1 where sideband routines are | |||||
* called after detach is called. This would call routines after | |||||
* if_stop, causing issues with the teardown process. This has | |||||
* seemingly been fixed in STABLE snapshots, but it seems like a | |||||
* good idea to have this guard here regardless. | |||||
*/ | |||||
if (ice_driver_is_detaching(sc)) | |||||
return; | |||||
if (ice_test_state(&sc->state, ICE_STATE_RECOVERY_MODE)) | if (ice_test_state(&sc->state, ICE_STATE_RECOVERY_MODE)) | ||||
return; | return; | ||||
Context not available. | |||||
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 the driver supports */ | /* 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); | ||||
Context not available. | |||||
return ice_handle_i2c_req(sc, req); | return ice_handle_i2c_req(sc, req); | ||||
} | } | ||||
/** | |||||
* ice_if_suspend - PCI device suspend handler for iflib | |||||
* @ctx: iflib context pointer | |||||
* | |||||
* Deinitializes the driver and clears HW resources in preparation for | |||||
* suspend or an FLR. | |||||
* | |||||
* @returns 0; this return value is ignored | |||||
*/ | |||||
static int | |||||
ice_if_suspend(if_ctx_t ctx) | |||||
{ | |||||
struct ice_softc *sc = (struct ice_softc *)iflib_get_softc(ctx); | |||||
/* At least a PFR is always going to happen after this; | |||||
* either via FLR or during the D3->D0 transition. | |||||
*/ | |||||
ice_clear_state(&sc->state, ICE_STATE_RESET_PFR_REQ); | |||||
ice_prepare_for_reset(sc); | |||||
return (0); | |||||
} | |||||
/** | |||||
* ice_if_resume - PCI device resume handler for iflib | |||||
* @ctx: iflib context pointer | |||||
* | |||||
* Reinitializes the driver and the HW after PCI resume or after | |||||
* an FLR. An init is performed by iflib after this function is finished. | |||||
* | |||||
* @returns 0; this return value is ignored | |||||
*/ | |||||
static int | |||||
ice_if_resume(if_ctx_t ctx) | |||||
{ | |||||
struct ice_softc *sc = (struct ice_softc *)iflib_get_softc(ctx); | |||||
ice_rebuild(sc); | |||||
return (0); | |||||
} | |||||
Context not available. |