Lines Matching full:pf
34 static void ice_info_get_dsn(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_get_dsn() argument
39 put_unaligned_be64(pci_get_dsn(pf->pdev), dsn); in ice_info_get_dsn()
44 static void ice_info_pba(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_pba() argument
46 struct ice_hw *hw = &pf->hw; in ice_info_pba()
52 dev_dbg(ice_pf_to_dev(pf), "Failed to read Product Board Assembly string, status %d\n", in ice_info_pba()
56 static void ice_info_fw_mgmt(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_fw_mgmt() argument
58 struct ice_hw *hw = &pf->hw; in ice_info_fw_mgmt()
64 static void ice_info_fw_api(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_fw_api() argument
66 struct ice_hw *hw = &pf->hw; in ice_info_fw_api()
72 static void ice_info_fw_build(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_fw_build() argument
74 struct ice_hw *hw = &pf->hw; in ice_info_fw_build()
79 static void ice_info_orom_ver(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_orom_ver() argument
81 struct ice_orom_info *orom = &pf->hw.flash.orom; in ice_info_orom_ver()
88 ice_info_pending_orom_ver(struct ice_pf __always_unused *pf, in ice_info_pending_orom_ver() argument
98 static void ice_info_nvm_ver(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_nvm_ver() argument
100 struct ice_nvm_info *nvm = &pf->hw.flash.nvm; in ice_info_nvm_ver()
106 ice_info_pending_nvm_ver(struct ice_pf __always_unused *pf, in ice_info_pending_nvm_ver() argument
116 static void ice_info_eetrack(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_eetrack() argument
118 struct ice_nvm_info *nvm = &pf->hw.flash.nvm; in ice_info_eetrack()
124 ice_info_pending_eetrack(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_pending_eetrack() argument
132 static void ice_info_ddp_pkg_name(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_ddp_pkg_name() argument
134 struct ice_hw *hw = &pf->hw; in ice_info_ddp_pkg_name()
140 ice_info_ddp_pkg_version(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_ddp_pkg_version() argument
142 struct ice_pkg_ver *pkg = &pf->hw.active_pkg_ver; in ice_info_ddp_pkg_version()
149 ice_info_ddp_pkg_bundle_id(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_ddp_pkg_bundle_id() argument
151 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", pf->hw.active_track_id); in ice_info_ddp_pkg_bundle_id()
154 static void ice_info_netlist_ver(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_netlist_ver() argument
156 struct ice_netlist_info *netlist = &pf->hw.flash.netlist; in ice_info_netlist_ver()
165 static void ice_info_netlist_build(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_netlist_build() argument
167 struct ice_netlist_info *netlist = &pf->hw.flash.netlist; in ice_info_netlist_build()
173 ice_info_pending_netlist_ver(struct ice_pf __always_unused *pf, in ice_info_pending_netlist_ver() argument
187 ice_info_pending_netlist_build(struct ice_pf __always_unused *pf, in ice_info_pending_netlist_build() argument
196 static void ice_info_cgu_fw_build(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_cgu_fw_build() argument
200 if (!ice_is_feature_supported(pf, ICE_F_CGU)) in ice_info_cgu_fw_build()
202 if (ice_aq_get_cgu_info(&pf->hw, &id, &cfg_ver, &fw_ver)) in ice_info_cgu_fw_build()
207 static void ice_info_cgu_id(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_cgu_id() argument
209 if (!ice_is_feature_supported(pf, ICE_F_CGU)) in ice_info_cgu_id()
211 snprintf(ctx->buf, sizeof(ctx->buf), "%u", pf->hw.cgu_part_number); in ice_info_cgu_id()
241 void (*getter)(struct ice_pf *pf, struct ice_info_ctx *ctx);
242 void (*fallback)(struct ice_pf *pf, struct ice_info_ctx *ctx);
275 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_info_get() local
276 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_info_get()
277 struct ice_hw *hw = &pf->hw; in ice_devlink_info_get()
282 err = ice_wait_for_reset(pf, 10 * HZ); in ice_devlink_info_get()
334 ice_info_get_dsn(pf, ctx); in ice_devlink_info_get()
348 ice_devlink_versions[i].getter(pf, ctx); in ice_devlink_info_get()
356 ice_devlink_versions[i].fallback(pf, ctx); in ice_devlink_info_get()
398 * @pf: pointer to the pf instance
411 ice_devlink_reload_empr_start(struct ice_pf *pf, in ice_devlink_reload_empr_start() argument
414 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_reload_empr_start()
415 struct ice_hw *hw = &pf->hw; in ice_devlink_reload_empr_start()
419 err = ice_get_pending_updates(pf, &pending, extack); in ice_devlink_reload_empr_start()
433 if (pf->fw_emp_reset_disabled) { in ice_devlink_reload_empr_start()
452 * ice_devlink_reinit_down - unload given PF
453 * @pf: pointer to the PF struct
455 static void ice_devlink_reinit_down(struct ice_pf *pf) in ice_devlink_reinit_down() argument
458 ice_unload(pf); in ice_devlink_reinit_down()
460 ice_vsi_decfg(ice_get_main_vsi(pf)); in ice_devlink_reinit_down()
462 ice_deinit_dev(pf); in ice_devlink_reinit_down()
479 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_reload_down() local
483 if (ice_is_eswitch_mode_switchdev(pf)) { in ice_devlink_reload_down()
488 if (ice_is_adq_active(pf)) { in ice_devlink_reload_down()
493 if (ice_has_vfs(pf)) { in ice_devlink_reload_down()
498 ice_devlink_reinit_down(pf); in ice_devlink_reload_down()
501 return ice_devlink_reload_empr_start(pf, extack); in ice_devlink_reload_down()
510 * @pf: pointer to the pf instance
518 ice_devlink_reload_empr_finish(struct ice_pf *pf, in ice_devlink_reload_empr_finish() argument
523 err = ice_wait_for_reset(pf, 60 * HZ); in ice_devlink_reload_empr_finish()
534 * @pf: pointer to pf structure
541 static int ice_get_tx_topo_user_sel(struct ice_pf *pf, uint8_t *layers) in ice_get_tx_topo_user_sel() argument
544 struct ice_hw *hw = &pf->hw; in ice_get_tx_topo_user_sel()
569 * @pf: pointer to pf structure
578 static int ice_update_tx_topo_user_sel(struct ice_pf *pf, int layers) in ice_update_tx_topo_user_sel() argument
581 struct ice_hw *hw = &pf->hw; in ice_update_tx_topo_user_sel()
598 err = ice_write_one_nvm_block(pf, ICE_AQC_NVM_TX_TOPO_MOD_ID, 2, in ice_update_tx_topo_user_sel()
618 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_tx_sched_layers_get() local
621 err = ice_get_tx_topo_user_sel(pf, &ctx->val.vu8); in ice_devlink_tx_sched_layers_get()
641 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_tx_sched_layers_set() local
644 err = ice_update_tx_topo_user_sel(pf, ctx->val.vu8); in ice_devlink_tx_sched_layers_set()
684 * @pf: pf struct
688 void ice_tear_down_devlink_rate_tree(struct ice_pf *pf) in ice_tear_down_devlink_rate_tree() argument
694 devlink = priv_to_devlink(pf); in ice_tear_down_devlink_rate_tree()
697 mutex_lock(&pf->vfs.table_lock); in ice_tear_down_devlink_rate_tree()
698 ice_for_each_vf(pf, bkt, vf) { in ice_tear_down_devlink_rate_tree()
702 mutex_unlock(&pf->vfs.table_lock); in ice_tear_down_devlink_rate_tree()
710 * @pf: pf struct
715 static bool ice_enable_custom_tx(struct ice_pf *pf) in ice_enable_custom_tx() argument
717 struct ice_port_info *pi = ice_get_main_vsi(pf)->port_info; in ice_enable_custom_tx()
718 struct device *dev = ice_pf_to_dev(pf); in ice_enable_custom_tx()
724 if (ice_is_adq_active(pf)) { in ice_enable_custom_tx()
729 if (ice_is_dcb_active(pf)) { in ice_enable_custom_tx()
744 * @pf: pf struct
750 struct ice_sched_node *tc_node, struct ice_pf *pf) in ice_traverse_tx_tree() argument
765 pf->vsi[node->vsi_handle]->type == ICE_VSI_VF && in ice_traverse_tx_tree()
766 pf->vsi[node->vsi_handle]->vf) { in ice_traverse_tx_tree()
767 vf = pf->vsi[node->vsi_handle]->vf; in ice_traverse_tx_tree()
775 pf->vsi[node->vsi_handle]->type == ICE_VSI_SF && in ice_traverse_tx_tree()
776 pf->vsi[node->vsi_handle]->sf) { in ice_traverse_tx_tree()
777 sf = pf->vsi[node->vsi_handle]->sf; in ice_traverse_tx_tree()
795 ice_traverse_tx_tree(devlink, node->children[i], tc_node, pf); in ice_traverse_tx_tree()
810 struct ice_pf *pf = vsi->back; in ice_devlink_rate_init_tx_topology() local
816 ice_traverse_tx_tree(devlink, tc_node->children[i], tc_node, pf); in ice_devlink_rate_init_tx_topology()
966 struct ice_pf *pf = devlink_priv(rate_node->devlink); in ice_get_pi_from_dev_rate() local
968 return ice_get_main_vsi(pf)->port_info; in ice_get_pi_from_dev_rate()
1208 static void ice_set_min_max_msix(struct ice_pf *pf) in ice_set_min_max_msix() argument
1210 struct devlink *devlink = priv_to_devlink(pf); in ice_set_min_max_msix()
1218 pf->msix.min = val.vu32; in ice_set_min_max_msix()
1224 pf->msix.max = val.vu32; in ice_set_min_max_msix()
1228 * ice_devlink_reinit_up - do reinit of the given PF
1229 * @pf: pointer to the PF struct
1231 static int ice_devlink_reinit_up(struct ice_pf *pf) in ice_devlink_reinit_up() argument
1233 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_devlink_reinit_up()
1236 err = ice_init_hw(&pf->hw); in ice_devlink_reinit_up()
1238 dev_err(ice_pf_to_dev(pf), "ice_init_hw failed: %d\n", err); in ice_devlink_reinit_up()
1243 ice_set_min_max_msix(pf); in ice_devlink_reinit_up()
1245 err = ice_init_dev(pf); in ice_devlink_reinit_up()
1258 err = ice_load(pf); in ice_devlink_reinit_up()
1269 ice_deinit_dev(pf); in ice_devlink_reinit_up()
1271 ice_deinit_hw(&pf->hw); in ice_devlink_reinit_up()
1290 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_reload_up() local
1295 return ice_devlink_reinit_up(pf); in ice_devlink_reload_up()
1298 return ice_devlink_reload_empr_finish(pf, extack); in ice_devlink_reload_up()
1341 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_get() local
1343 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? true : false; in ice_devlink_enable_roce_get()
1352 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_set() local
1357 ice_unplug_aux_dev(pf); in ice_devlink_enable_roce_set()
1358 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1362 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1363 ret = ice_plug_aux_dev(pf); in ice_devlink_enable_roce_set()
1365 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1375 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_validate() local
1377 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_roce_validate()
1380 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP) { in ice_devlink_enable_roce_validate()
1392 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_get() local
1394 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_get()
1403 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_set() local
1408 ice_unplug_aux_dev(pf); in ice_devlink_enable_iw_set()
1409 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1413 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1414 ret = ice_plug_aux_dev(pf); in ice_devlink_enable_iw_set()
1416 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1426 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_validate() local
1428 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_iw_validate()
1431 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2) { in ice_devlink_enable_iw_validate()
1493 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_local_fwd_get() local
1497 pi = pf->hw.port_info; in ice_devlink_local_fwd_get()
1518 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_local_fwd_set() local
1519 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_local_fwd_set()
1522 pi = pf->hw.port_info; in ice_devlink_local_fwd_set()
1526 ice_schedule_reset(pf, ICE_RESET_CORER); in ice_devlink_local_fwd_set()
1563 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_msix_max_pf_validate() local
1565 if (val.vu32 > pf->hw.func_caps.common_cap.num_msix_vectors) in ice_devlink_msix_max_pf_validate()
1586 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_rdma_validate() local
1589 if (new_state && !test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_rdma_validate()
1645 * ice_allocate_pf - Allocate devlink and return PF structure pointer
1649 * the PF structure. The devlink memory is kept track of through devres by
1670 * @pf: pointer to the PF structure
1676 struct ice_sf_priv *ice_allocate_sf(struct device *dev, struct ice_pf *pf) in ice_allocate_sf() argument
1686 err = devl_nested_devlink_set(priv_to_devlink(pf), devlink); in ice_allocate_sf()
1696 * ice_devlink_register - Register devlink interface for this PF
1697 * @pf: the PF to register the devlink for.
1703 void ice_devlink_register(struct ice_pf *pf) in ice_devlink_register() argument
1705 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_register()
1711 * ice_devlink_unregister - Unregister devlink resources for this PF.
1712 * @pf: the PF structure to cleanup
1716 void ice_devlink_unregister(struct ice_pf *pf) in ice_devlink_unregister() argument
1718 devl_unregister(priv_to_devlink(pf)); in ice_devlink_unregister()
1721 int ice_devlink_register_params(struct ice_pf *pf) in ice_devlink_register_params() argument
1723 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_register_params()
1725 struct ice_hw *hw = &pf->hw; in ice_devlink_register_params()
1744 value.vu32 = pf->msix.max; in ice_devlink_register_params()
1748 value.vu32 = pf->msix.min; in ice_devlink_register_params()
1753 value.vbool = test_bit(ICE_FLAG_RDMA_ENA, pf->flags); in ice_devlink_register_params()
1769 void ice_devlink_unregister_params(struct ice_pf *pf) in ice_devlink_unregister_params() argument
1771 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_unregister_params()
1772 struct ice_hw *hw = &pf->hw; in ice_devlink_unregister_params()
1810 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_nvm_snapshot() local
1811 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_nvm_snapshot()
1812 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_snapshot()
1899 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_nvm_read() local
1900 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_nvm_read()
1901 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_read()
1963 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_devcaps_snapshot() local
1964 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_devcaps_snapshot()
1965 struct ice_hw *hw = &pf->hw; in ice_devlink_devcaps_snapshot()
2010 * @pf: the PF device structure
2015 void ice_devlink_init_regions(struct ice_pf *pf) in ice_devlink_init_regions() argument
2017 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_init_regions()
2018 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_init_regions()
2021 nvm_size = pf->hw.flash.flash_size; in ice_devlink_init_regions()
2022 pf->nvm_region = devl_region_create(devlink, &ice_nvm_region_ops, 1, in ice_devlink_init_regions()
2024 if (IS_ERR(pf->nvm_region)) { in ice_devlink_init_regions()
2026 PTR_ERR(pf->nvm_region)); in ice_devlink_init_regions()
2027 pf->nvm_region = NULL; in ice_devlink_init_regions()
2030 sram_size = pf->hw.flash.sr_words * 2u; in ice_devlink_init_regions()
2031 pf->sram_region = devl_region_create(devlink, &ice_sram_region_ops, in ice_devlink_init_regions()
2033 if (IS_ERR(pf->sram_region)) { in ice_devlink_init_regions()
2035 PTR_ERR(pf->sram_region)); in ice_devlink_init_regions()
2036 pf->sram_region = NULL; in ice_devlink_init_regions()
2039 pf->devcaps_region = devl_region_create(devlink, in ice_devlink_init_regions()
2042 if (IS_ERR(pf->devcaps_region)) { in ice_devlink_init_regions()
2044 PTR_ERR(pf->devcaps_region)); in ice_devlink_init_regions()
2045 pf->devcaps_region = NULL; in ice_devlink_init_regions()
2051 * @pf: the PF device structure
2053 * Remove previously created regions for this PF.
2055 void ice_devlink_destroy_regions(struct ice_pf *pf) in ice_devlink_destroy_regions() argument
2057 if (pf->nvm_region) in ice_devlink_destroy_regions()
2058 devl_region_destroy(pf->nvm_region); in ice_devlink_destroy_regions()
2060 if (pf->sram_region) in ice_devlink_destroy_regions()
2061 devl_region_destroy(pf->sram_region); in ice_devlink_destroy_regions()
2063 if (pf->devcaps_region) in ice_devlink_destroy_regions()
2064 devl_region_destroy(pf->devcaps_region); in ice_devlink_destroy_regions()