Lines Matching refs: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
223 void (*getter)(struct ice_pf *pf, struct ice_info_ctx *ctx);
224 void (*fallback)(struct ice_pf *pf, struct ice_info_ctx *ctx);
255 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_info_get() local
256 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_info_get()
257 struct ice_hw *hw = &pf->hw; in ice_devlink_info_get()
262 err = ice_wait_for_reset(pf, 10 * HZ); in ice_devlink_info_get()
314 ice_info_get_dsn(pf, ctx); in ice_devlink_info_get()
328 ice_devlink_versions[i].getter(pf, ctx); in ice_devlink_info_get()
336 ice_devlink_versions[i].fallback(pf, ctx); in ice_devlink_info_get()
387 ice_devlink_reload_empr_start(struct ice_pf *pf, in ice_devlink_reload_empr_start() argument
390 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_reload_empr_start()
391 struct ice_hw *hw = &pf->hw; in ice_devlink_reload_empr_start()
395 err = ice_get_pending_updates(pf, &pending, extack); in ice_devlink_reload_empr_start()
409 if (pf->fw_emp_reset_disabled) { in ice_devlink_reload_empr_start()
441 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_reload_down() local
445 if (ice_is_eswitch_mode_switchdev(pf)) { in ice_devlink_reload_down()
450 if (ice_is_adq_active(pf)) { in ice_devlink_reload_down()
455 if (ice_has_vfs(pf)) { in ice_devlink_reload_down()
460 ice_unload(pf); in ice_devlink_reload_down()
463 return ice_devlink_reload_empr_start(pf, extack); in ice_devlink_reload_down()
480 ice_devlink_reload_empr_finish(struct ice_pf *pf, in ice_devlink_reload_empr_finish() argument
485 err = ice_wait_for_reset(pf, 60 * HZ); in ice_devlink_reload_empr_finish()
529 static void ice_devlink_port_options_print(struct ice_pf *pf) in ice_devlink_port_options_print() argument
533 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_port_options_print()
549 status = ice_aq_get_port_options(&pf->hw, opt, &options_count, in ice_devlink_port_options_print()
604 ice_devlink_aq_set_port_option(struct ice_pf *pf, u8 option_idx, in ice_devlink_aq_set_port_option() argument
607 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_aq_set_port_option()
610 status = ice_aq_set_port_option(&pf->hw, 0, true, option_idx); in ice_devlink_aq_set_port_option()
613 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
618 status = ice_acquire_nvm(&pf->hw, ICE_RES_WRITE); in ice_devlink_aq_set_port_option()
621 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
626 status = ice_nvm_write_activate(&pf->hw, ICE_AQC_NVM_ACTIV_REQ_EMPR, NULL); in ice_devlink_aq_set_port_option()
629 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
631 ice_release_nvm(&pf->hw); in ice_devlink_aq_set_port_option()
635 ice_release_nvm(&pf->hw); in ice_devlink_aq_set_port_option()
665 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_port_split() local
667 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_port_split()
671 status = ice_aq_get_port_options(&pf->hw, options, &option_count, in ice_devlink_port_split()
700 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
707 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
711 status = ice_devlink_aq_set_port_option(pf, new_option, extack); in ice_devlink_port_split()
715 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
745 void ice_tear_down_devlink_rate_tree(struct ice_pf *pf) in ice_tear_down_devlink_rate_tree() argument
751 devlink = priv_to_devlink(pf); in ice_tear_down_devlink_rate_tree()
754 mutex_lock(&pf->vfs.table_lock); in ice_tear_down_devlink_rate_tree()
755 ice_for_each_vf(pf, bkt, vf) { in ice_tear_down_devlink_rate_tree()
759 mutex_unlock(&pf->vfs.table_lock); in ice_tear_down_devlink_rate_tree()
772 static bool ice_enable_custom_tx(struct ice_pf *pf) in ice_enable_custom_tx() argument
774 struct ice_port_info *pi = ice_get_main_vsi(pf)->port_info; in ice_enable_custom_tx()
775 struct device *dev = ice_pf_to_dev(pf); in ice_enable_custom_tx()
781 if (ice_is_adq_active(pf)) { in ice_enable_custom_tx()
786 if (ice_is_dcb_active(pf)) { in ice_enable_custom_tx()
807 struct ice_sched_node *tc_node, struct ice_pf *pf) in ice_traverse_tx_tree() argument
817 pf->vsi[node->vsi_handle]->vf) { in ice_traverse_tx_tree()
818 vf = pf->vsi[node->vsi_handle]->vf; in ice_traverse_tx_tree()
835 ice_traverse_tx_tree(devlink, node->children[i], tc_node, pf); in ice_traverse_tx_tree()
850 struct ice_pf *pf = vsi->back; in ice_devlink_rate_init_tx_topology() local
857 ice_traverse_tx_tree(devlink, tc_node->children[i], tc_node, pf); in ice_devlink_rate_init_tx_topology()
984 struct ice_pf *pf = devlink_priv(rate_node->devlink); in ice_get_pi_from_dev_rate() local
986 return ice_get_main_vsi(pf)->port_info; in ice_get_pi_from_dev_rate()
1238 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_reload_up() local
1243 return ice_load(pf); in ice_devlink_reload_up()
1246 return ice_devlink_reload_empr_finish(pf, extack); in ice_devlink_reload_up()
1285 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_get() local
1287 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? true : false; in ice_devlink_enable_roce_get()
1296 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_set() local
1301 ice_unplug_aux_dev(pf); in ice_devlink_enable_roce_set()
1302 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1306 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1307 ret = ice_plug_aux_dev(pf); in ice_devlink_enable_roce_set()
1309 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1319 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_validate() local
1321 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_roce_validate()
1324 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP) { in ice_devlink_enable_roce_validate()
1336 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_get() local
1338 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_get()
1347 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_set() local
1352 ice_unplug_aux_dev(pf); in ice_devlink_enable_iw_set()
1353 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1357 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1358 ret = ice_plug_aux_dev(pf); in ice_devlink_enable_iw_set()
1360 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1370 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_validate() local
1372 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_iw_validate()
1375 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2) { in ice_devlink_enable_iw_validate()
1431 void ice_devlink_register(struct ice_pf *pf) in ice_devlink_register() argument
1433 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_register()
1444 void ice_devlink_unregister(struct ice_pf *pf) in ice_devlink_unregister() argument
1446 devlink_unregister(priv_to_devlink(pf)); in ice_devlink_unregister()
1455 ice_devlink_set_switch_id(struct ice_pf *pf, struct netdev_phys_item_id *ppid) in ice_devlink_set_switch_id() argument
1457 struct pci_dev *pdev = pf->pdev; in ice_devlink_set_switch_id()
1466 int ice_devlink_register_params(struct ice_pf *pf) in ice_devlink_register_params() argument
1468 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_register_params()
1474 void ice_devlink_unregister_params(struct ice_pf *pf) in ice_devlink_unregister_params() argument
1476 devlink_params_unregister(priv_to_devlink(pf), ice_devlink_params, in ice_devlink_unregister_params()
1488 ice_devlink_set_port_split_options(struct ice_pf *pf, in ice_devlink_set_port_split_options() argument
1496 status = ice_aq_get_port_options(&pf->hw, options, &option_count, in ice_devlink_set_port_split_options()
1500 dev_dbg(ice_pf_to_dev(pf), "Couldn't read port split options, err = %d\n", in ice_devlink_set_port_split_options()
1526 int ice_devlink_create_pf_port(struct ice_pf *pf) in ice_devlink_create_pf_port() argument
1535 dev = ice_pf_to_dev(pf); in ice_devlink_create_pf_port()
1537 devlink_port = &pf->devlink_port; in ice_devlink_create_pf_port()
1539 vsi = ice_get_main_vsi(pf); in ice_devlink_create_pf_port()
1544 attrs.phys.port_number = pf->hw.bus.func; in ice_devlink_create_pf_port()
1549 if (pf->hw.pf_id == 0) in ice_devlink_create_pf_port()
1550 ice_devlink_set_port_split_options(pf, &attrs); in ice_devlink_create_pf_port()
1552 ice_devlink_set_switch_id(pf, &attrs.switch_id); in ice_devlink_create_pf_port()
1555 devlink = priv_to_devlink(pf); in ice_devlink_create_pf_port()
1561 pf->hw.pf_id, err); in ice_devlink_create_pf_port()
1574 void ice_devlink_destroy_pf_port(struct ice_pf *pf) in ice_devlink_destroy_pf_port() argument
1576 devlink_port_unregister(&pf->devlink_port); in ice_devlink_destroy_pf_port()
1594 struct ice_pf *pf; in ice_devlink_create_vf_port() local
1597 pf = vf->pf; in ice_devlink_create_vf_port()
1598 dev = ice_pf_to_dev(pf); in ice_devlink_create_vf_port()
1606 attrs.pci_vf.pf = pf->hw.bus.func; in ice_devlink_create_vf_port()
1609 ice_devlink_set_switch_id(pf, &attrs.switch_id); in ice_devlink_create_vf_port()
1612 devlink = priv_to_devlink(pf); in ice_devlink_create_vf_port()
1662 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_nvm_snapshot() local
1663 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_nvm_snapshot()
1664 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_snapshot()
1751 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_nvm_read() local
1752 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_nvm_read()
1753 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_read()
1815 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_devcaps_snapshot() local
1816 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_devcaps_snapshot()
1817 struct ice_hw *hw = &pf->hw; in ice_devlink_devcaps_snapshot()
1867 void ice_devlink_init_regions(struct ice_pf *pf) in ice_devlink_init_regions() argument
1869 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_init_regions()
1870 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_init_regions()
1873 nvm_size = pf->hw.flash.flash_size; in ice_devlink_init_regions()
1874 pf->nvm_region = devlink_region_create(devlink, &ice_nvm_region_ops, 1, in ice_devlink_init_regions()
1876 if (IS_ERR(pf->nvm_region)) { in ice_devlink_init_regions()
1878 PTR_ERR(pf->nvm_region)); in ice_devlink_init_regions()
1879 pf->nvm_region = NULL; in ice_devlink_init_regions()
1882 sram_size = pf->hw.flash.sr_words * 2u; in ice_devlink_init_regions()
1883 pf->sram_region = devlink_region_create(devlink, &ice_sram_region_ops, in ice_devlink_init_regions()
1885 if (IS_ERR(pf->sram_region)) { in ice_devlink_init_regions()
1887 PTR_ERR(pf->sram_region)); in ice_devlink_init_regions()
1888 pf->sram_region = NULL; in ice_devlink_init_regions()
1891 pf->devcaps_region = devlink_region_create(devlink, in ice_devlink_init_regions()
1894 if (IS_ERR(pf->devcaps_region)) { in ice_devlink_init_regions()
1896 PTR_ERR(pf->devcaps_region)); in ice_devlink_init_regions()
1897 pf->devcaps_region = NULL; in ice_devlink_init_regions()
1907 void ice_devlink_destroy_regions(struct ice_pf *pf) in ice_devlink_destroy_regions() argument
1909 if (pf->nvm_region) in ice_devlink_destroy_regions()
1910 devlink_region_destroy(pf->nvm_region); in ice_devlink_destroy_regions()
1912 if (pf->sram_region) in ice_devlink_destroy_regions()
1913 devlink_region_destroy(pf->sram_region); in ice_devlink_destroy_regions()
1915 if (pf->devcaps_region) in ice_devlink_destroy_regions()
1916 devlink_region_destroy(pf->devcaps_region); in ice_devlink_destroy_regions()