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()
394 * @pf: pointer to the pf instance
407 ice_devlink_reload_empr_start(struct ice_pf *pf, in ice_devlink_reload_empr_start() argument
410 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_reload_empr_start()
411 struct ice_hw *hw = &pf->hw; in ice_devlink_reload_empr_start()
415 err = ice_get_pending_updates(pf, &pending, extack); in ice_devlink_reload_empr_start()
429 if (pf->fw_emp_reset_disabled) { in ice_devlink_reload_empr_start()
461 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_reload_down() local
465 if (ice_is_eswitch_mode_switchdev(pf)) { in ice_devlink_reload_down()
470 if (ice_is_adq_active(pf)) { in ice_devlink_reload_down()
475 if (ice_has_vfs(pf)) { in ice_devlink_reload_down()
480 ice_unload(pf); in ice_devlink_reload_down()
483 return ice_devlink_reload_empr_start(pf, extack); in ice_devlink_reload_down()
492 * @pf: pointer to the pf instance
500 ice_devlink_reload_empr_finish(struct ice_pf *pf, in ice_devlink_reload_empr_finish() argument
505 err = ice_wait_for_reset(pf, 60 * HZ); in ice_devlink_reload_empr_finish()
545 * @pf: the PF to print split port options
549 static void ice_devlink_port_options_print(struct ice_pf *pf) in ice_devlink_port_options_print() argument
553 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_port_options_print()
569 status = ice_aq_get_port_options(&pf->hw, opt, &options_count, in ice_devlink_port_options_print()
616 * @pf: the PF to print split port options
624 ice_devlink_aq_set_port_option(struct ice_pf *pf, u8 option_idx, in ice_devlink_aq_set_port_option() argument
627 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_aq_set_port_option()
630 status = ice_aq_set_port_option(&pf->hw, 0, true, option_idx); in ice_devlink_aq_set_port_option()
633 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
638 status = ice_acquire_nvm(&pf->hw, ICE_RES_WRITE); in ice_devlink_aq_set_port_option()
641 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
646 status = ice_nvm_write_activate(&pf->hw, ICE_AQC_NVM_ACTIV_REQ_EMPR, NULL); in ice_devlink_aq_set_port_option()
649 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
651 ice_release_nvm(&pf->hw); in ice_devlink_aq_set_port_option()
655 ice_release_nvm(&pf->hw); in ice_devlink_aq_set_port_option()
685 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_port_split() local
687 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_port_split()
691 status = ice_aq_get_port_options(&pf->hw, options, &option_count, in ice_devlink_port_split()
720 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
727 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
731 status = ice_devlink_aq_set_port_option(pf, new_option, extack); in ice_devlink_port_split()
735 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
761 * @pf: pf struct
765 void ice_tear_down_devlink_rate_tree(struct ice_pf *pf) in ice_tear_down_devlink_rate_tree() argument
771 devlink = priv_to_devlink(pf); in ice_tear_down_devlink_rate_tree()
774 mutex_lock(&pf->vfs.table_lock); in ice_tear_down_devlink_rate_tree()
775 ice_for_each_vf(pf, bkt, vf) { in ice_tear_down_devlink_rate_tree()
779 mutex_unlock(&pf->vfs.table_lock); in ice_tear_down_devlink_rate_tree()
787 * @pf: pf struct
792 static bool ice_enable_custom_tx(struct ice_pf *pf) in ice_enable_custom_tx() argument
794 struct ice_port_info *pi = ice_get_main_vsi(pf)->port_info; in ice_enable_custom_tx()
795 struct device *dev = ice_pf_to_dev(pf); in ice_enable_custom_tx()
801 if (ice_is_adq_active(pf)) { in ice_enable_custom_tx()
806 if (ice_is_dcb_active(pf)) { in ice_enable_custom_tx()
821 * @pf: pf struct
827 struct ice_sched_node *tc_node, struct ice_pf *pf) in ice_traverse_tx_tree() argument
841 pf->vsi[node->vsi_handle]->vf) { in ice_traverse_tx_tree()
842 vf = pf->vsi[node->vsi_handle]->vf; in ice_traverse_tx_tree()
860 ice_traverse_tx_tree(devlink, node->children[i], tc_node, pf); in ice_traverse_tx_tree()
875 struct ice_pf *pf = vsi->back; in ice_devlink_rate_init_tx_topology() local
882 ice_traverse_tx_tree(devlink, tc_node->children[i], tc_node, pf); in ice_devlink_rate_init_tx_topology()
1033 struct ice_pf *pf = devlink_priv(rate_node->devlink); in ice_get_pi_from_dev_rate() local
1035 return ice_get_main_vsi(pf)->port_info; in ice_get_pi_from_dev_rate()
1287 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_reload_up() local
1292 return ice_load(pf); in ice_devlink_reload_up()
1295 return ice_devlink_reload_empr_finish(pf, extack); in ice_devlink_reload_up()
1334 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_get() local
1336 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? true : false; in ice_devlink_enable_roce_get()
1345 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_set() local
1350 ice_unplug_aux_dev(pf); in ice_devlink_enable_roce_set()
1351 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1355 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1356 ret = ice_plug_aux_dev(pf); in ice_devlink_enable_roce_set()
1358 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1368 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_validate() local
1370 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_roce_validate()
1373 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP) { in ice_devlink_enable_roce_validate()
1385 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_get() local
1387 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_get()
1396 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_set() local
1401 ice_unplug_aux_dev(pf); in ice_devlink_enable_iw_set()
1402 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1406 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1407 ret = ice_plug_aux_dev(pf); in ice_devlink_enable_iw_set()
1409 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1419 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_validate() local
1421 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_iw_validate()
1424 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2) { in ice_devlink_enable_iw_validate()
1450 * ice_allocate_pf - Allocate devlink and return PF structure pointer
1454 * the PF structure. The devlink memory is kept track of through devres by
1473 * ice_devlink_register - Register devlink interface for this PF
1474 * @pf: the PF to register the devlink for.
1480 void ice_devlink_register(struct ice_pf *pf) in ice_devlink_register() argument
1482 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_register()
1488 * ice_devlink_unregister - Unregister devlink resources for this PF.
1489 * @pf: the PF structure to cleanup
1493 void ice_devlink_unregister(struct ice_pf *pf) in ice_devlink_unregister() argument
1495 devlink_unregister(priv_to_devlink(pf)); in ice_devlink_unregister()
1500 * @pf: the PF to create a devlink port for
1504 ice_devlink_set_switch_id(struct ice_pf *pf, struct netdev_phys_item_id *ppid) in ice_devlink_set_switch_id() argument
1506 struct pci_dev *pdev = pf->pdev; in ice_devlink_set_switch_id()
1515 int ice_devlink_register_params(struct ice_pf *pf) in ice_devlink_register_params() argument
1517 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_register_params()
1523 void ice_devlink_unregister_params(struct ice_pf *pf) in ice_devlink_unregister_params() argument
1525 devlink_params_unregister(priv_to_devlink(pf), ice_devlink_params, in ice_devlink_unregister_params()
1531 * @pf: the PF to set port split options
1537 ice_devlink_set_port_split_options(struct ice_pf *pf, in ice_devlink_set_port_split_options() argument
1545 status = ice_aq_get_port_options(&pf->hw, options, &option_count, in ice_devlink_set_port_split_options()
1549 dev_dbg(ice_pf_to_dev(pf), "Couldn't read port split options, err = %d\n", in ice_devlink_set_port_split_options()
1568 * ice_devlink_create_pf_port - Create a devlink port for this PF
1569 * @pf: the PF to create a devlink port for
1571 * Create and register a devlink_port for this PF.
1575 int ice_devlink_create_pf_port(struct ice_pf *pf) in ice_devlink_create_pf_port() argument
1584 dev = ice_pf_to_dev(pf); in ice_devlink_create_pf_port()
1586 devlink_port = &pf->devlink_port; in ice_devlink_create_pf_port()
1588 vsi = ice_get_main_vsi(pf); in ice_devlink_create_pf_port()
1593 attrs.phys.port_number = pf->hw.bus.func; in ice_devlink_create_pf_port()
1596 * set port split options only for first PF. in ice_devlink_create_pf_port()
1598 if (pf->hw.pf_id == 0) in ice_devlink_create_pf_port()
1599 ice_devlink_set_port_split_options(pf, &attrs); in ice_devlink_create_pf_port()
1601 ice_devlink_set_switch_id(pf, &attrs.switch_id); in ice_devlink_create_pf_port()
1604 devlink = priv_to_devlink(pf); in ice_devlink_create_pf_port()
1609 dev_err(dev, "Failed to create devlink port for PF %d, error %d\n", in ice_devlink_create_pf_port()
1610 pf->hw.pf_id, err); in ice_devlink_create_pf_port()
1618 * ice_devlink_destroy_pf_port - Destroy the devlink_port for this PF
1619 * @pf: the PF to cleanup
1621 * Unregisters the devlink_port structure associated with this PF.
1623 void ice_devlink_destroy_pf_port(struct ice_pf *pf) in ice_devlink_destroy_pf_port() argument
1625 devlink_port_unregister(&pf->devlink_port); in ice_devlink_destroy_pf_port()
1643 struct ice_pf *pf; in ice_devlink_create_vf_port() local
1646 pf = vf->pf; in ice_devlink_create_vf_port()
1647 dev = ice_pf_to_dev(pf); in ice_devlink_create_vf_port()
1655 attrs.pci_vf.pf = pf->hw.bus.func; in ice_devlink_create_vf_port()
1658 ice_devlink_set_switch_id(pf, &attrs.switch_id); in ice_devlink_create_vf_port()
1661 devlink = priv_to_devlink(pf); in ice_devlink_create_vf_port()
1711 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_nvm_snapshot() local
1712 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_nvm_snapshot()
1713 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_snapshot()
1800 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_nvm_read() local
1801 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_nvm_read()
1802 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_read()
1864 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_devcaps_snapshot() local
1865 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_devcaps_snapshot()
1866 struct ice_hw *hw = &pf->hw; in ice_devlink_devcaps_snapshot()
1911 * @pf: the PF device structure
1916 void ice_devlink_init_regions(struct ice_pf *pf) in ice_devlink_init_regions() argument
1918 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_init_regions()
1919 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_init_regions()
1922 nvm_size = pf->hw.flash.flash_size; in ice_devlink_init_regions()
1923 pf->nvm_region = devlink_region_create(devlink, &ice_nvm_region_ops, 1, in ice_devlink_init_regions()
1925 if (IS_ERR(pf->nvm_region)) { in ice_devlink_init_regions()
1927 PTR_ERR(pf->nvm_region)); in ice_devlink_init_regions()
1928 pf->nvm_region = NULL; in ice_devlink_init_regions()
1931 sram_size = pf->hw.flash.sr_words * 2u; in ice_devlink_init_regions()
1932 pf->sram_region = devlink_region_create(devlink, &ice_sram_region_ops, in ice_devlink_init_regions()
1934 if (IS_ERR(pf->sram_region)) { in ice_devlink_init_regions()
1936 PTR_ERR(pf->sram_region)); in ice_devlink_init_regions()
1937 pf->sram_region = NULL; in ice_devlink_init_regions()
1940 pf->devcaps_region = devlink_region_create(devlink, in ice_devlink_init_regions()
1943 if (IS_ERR(pf->devcaps_region)) { in ice_devlink_init_regions()
1945 PTR_ERR(pf->devcaps_region)); in ice_devlink_init_regions()
1946 pf->devcaps_region = NULL; in ice_devlink_init_regions()
1952 * @pf: the PF device structure
1954 * Remove previously created regions for this PF.
1956 void ice_devlink_destroy_regions(struct ice_pf *pf) in ice_devlink_destroy_regions() argument
1958 if (pf->nvm_region) in ice_devlink_destroy_regions()
1959 devlink_region_destroy(pf->nvm_region); in ice_devlink_destroy_regions()
1961 if (pf->sram_region) in ice_devlink_destroy_regions()
1962 devlink_region_destroy(pf->sram_region); in ice_devlink_destroy_regions()
1964 if (pf->devcaps_region) in ice_devlink_destroy_regions()
1965 devlink_region_destroy(pf->devcaps_region); in ice_devlink_destroy_regions()