Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ice/ice_lib.c
Show First 20 Lines • Show All 7,650 Lines • ▼ Show 20 Lines | |||||
* ice_module_init - Driver callback to handle module load | * ice_module_init - Driver callback to handle module load | ||||
* | * | ||||
* Callback for handling module load events. This function should initialize | * Callback for handling module load events. This function should initialize | ||||
* any data structures that are used for the life of the device driver. | * any data structures that are used for the life of the device driver. | ||||
*/ | */ | ||||
static int | static int | ||||
ice_module_init(void) | ice_module_init(void) | ||||
{ | { | ||||
ice_rdma_init(); | |||||
return (0); | return (0); | ||||
} | } | ||||
/** | /** | ||||
* ice_module_exit - Driver callback to handle module exit | * ice_module_exit - Driver callback to handle module exit | ||||
* | * | ||||
* Callback for handling module unload events. This function should release | * Callback for handling module unload events. This function should release | ||||
* any resources initialized during ice_module_init. | * any resources initialized during ice_module_init. | ||||
* | * | ||||
* If this function returns non-zero, the module will not be unloaded. It | * If this function returns non-zero, the module will not be unloaded. It | ||||
* should only return such a value if the module cannot be unloaded at all, | * should only return such a value if the module cannot be unloaded at all, | ||||
* such as due to outstanding memory references that cannot be revoked. | * such as due to outstanding memory references that cannot be revoked. | ||||
*/ | */ | ||||
static int | static int | ||||
ice_module_exit(void) | ice_module_exit(void) | ||||
{ | { | ||||
ice_rdma_exit(); | |||||
return (0); | return (0); | ||||
} | } | ||||
/** | /** | ||||
* ice_module_event_handler - Callback for module events | * ice_module_event_handler - Callback for module events | ||||
* @mod: unused module_t parameter | * @mod: unused module_t parameter | ||||
* @what: the event requested | * @what: the event requested | ||||
* @arg: unused event argument | * @arg: unused event argument | ||||
▲ Show 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | ice_alloc_intr_tracking(struct ice_softc *sc) | ||||
/* Allocate PF interrupt mapping storage */ | /* Allocate PF interrupt mapping storage */ | ||||
if (!(sc->pf_imap = | if (!(sc->pf_imap = | ||||
(u16 *)malloc(sizeof(u16) * hw->func_caps.common_cap.num_msix_vectors, | (u16 *)malloc(sizeof(u16) * hw->func_caps.common_cap.num_msix_vectors, | ||||
M_ICE, M_NOWAIT))) { | M_ICE, M_NOWAIT))) { | ||||
device_printf(dev, "Unable to allocate PF imap memory\n"); | device_printf(dev, "Unable to allocate PF imap memory\n"); | ||||
err = ENOMEM; | err = ENOMEM; | ||||
goto free_imgr; | goto free_imgr; | ||||
} | } | ||||
if (!(sc->rdma_imap = | |||||
(u16 *)malloc(sizeof(u16) * hw->func_caps.common_cap.num_msix_vectors, | |||||
M_ICE, M_NOWAIT))) { | |||||
device_printf(dev, "Unable to allocate RDMA imap memory\n"); | |||||
err = ENOMEM; | |||||
free(sc->pf_imap, M_ICE); | |||||
goto free_imgr; | |||||
} | |||||
for (u32 i = 0; i < hw->func_caps.common_cap.num_msix_vectors; i++) { | for (u32 i = 0; i < hw->func_caps.common_cap.num_msix_vectors; i++) { | ||||
sc->pf_imap[i] = ICE_INVALID_RES_IDX; | sc->pf_imap[i] = ICE_INVALID_RES_IDX; | ||||
sc->rdma_imap[i] = ICE_INVALID_RES_IDX; | |||||
} | } | ||||
return (0); | return (0); | ||||
free_imgr: | free_imgr: | ||||
ice_resmgr_destroy(&sc->imgr); | ice_resmgr_destroy(&sc->imgr); | ||||
return (err); | return (err); | ||||
} | } | ||||
Show All 10 Lines | |||||
void | void | ||||
ice_free_intr_tracking(struct ice_softc *sc) | ice_free_intr_tracking(struct ice_softc *sc) | ||||
{ | { | ||||
if (sc->pf_imap) { | if (sc->pf_imap) { | ||||
ice_resmgr_release_map(&sc->imgr, sc->pf_imap, | ice_resmgr_release_map(&sc->imgr, sc->pf_imap, | ||||
sc->lan_vectors); | sc->lan_vectors); | ||||
free(sc->pf_imap, M_ICE); | free(sc->pf_imap, M_ICE); | ||||
sc->pf_imap = NULL; | sc->pf_imap = NULL; | ||||
} | |||||
if (sc->rdma_imap) { | |||||
ice_resmgr_release_map(&sc->imgr, sc->rdma_imap, | |||||
sc->lan_vectors); | |||||
free(sc->rdma_imap, M_ICE); | |||||
sc->rdma_imap = NULL; | |||||
} | } | ||||
ice_resmgr_destroy(&sc->imgr); | ice_resmgr_destroy(&sc->imgr); | ||||
} | } | ||||
/** | /** | ||||
* ice_apply_supported_speed_filter - Mask off unsupported speeds | * ice_apply_supported_speed_filter - Mask off unsupported speeds | ||||
* @report_speeds: bit-field for the desired link speeds | * @report_speeds: bit-field for the desired link speeds | ||||
▲ Show 20 Lines • Show All 275 Lines • Show Last 20 Lines |