Lines Matching full:pf

33 static void ice_info_get_dsn(struct ice_pf *pf, struct ice_info_ctx *ctx)  in ice_info_get_dsn()  argument
38 put_unaligned_be64(pci_get_dsn(pf->pdev), dsn); in ice_info_get_dsn()
43 static void ice_info_pba(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_pba() argument
45 struct ice_hw *hw = &pf->hw; in ice_info_pba()
51 dev_dbg(ice_pf_to_dev(pf), "Failed to read Product Board Assembly string, status %d\n", in ice_info_pba()
55 static void ice_info_fw_mgmt(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_fw_mgmt() argument
57 struct ice_hw *hw = &pf->hw; in ice_info_fw_mgmt()
63 static void ice_info_fw_api(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_fw_api() argument
65 struct ice_hw *hw = &pf->hw; in ice_info_fw_api()
71 static void ice_info_fw_build(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_fw_build() argument
73 struct ice_hw *hw = &pf->hw; in ice_info_fw_build()
78 static void ice_info_orom_ver(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_orom_ver() argument
80 struct ice_orom_info *orom = &pf->hw.flash.orom; in ice_info_orom_ver()
87 ice_info_pending_orom_ver(struct ice_pf __always_unused *pf, in ice_info_pending_orom_ver() argument
97 static void ice_info_nvm_ver(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_nvm_ver() argument
99 struct ice_nvm_info *nvm = &pf->hw.flash.nvm; in ice_info_nvm_ver()
105 ice_info_pending_nvm_ver(struct ice_pf __always_unused *pf, in ice_info_pending_nvm_ver() argument
115 static void ice_info_eetrack(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_eetrack() argument
117 struct ice_nvm_info *nvm = &pf->hw.flash.nvm; in ice_info_eetrack()
123 ice_info_pending_eetrack(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_pending_eetrack() argument
131 static void ice_info_ddp_pkg_name(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_ddp_pkg_name() argument
133 struct ice_hw *hw = &pf->hw; in ice_info_ddp_pkg_name()
139 ice_info_ddp_pkg_version(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_ddp_pkg_version() argument
141 struct ice_pkg_ver *pkg = &pf->hw.active_pkg_ver; in ice_info_ddp_pkg_version()
148 ice_info_ddp_pkg_bundle_id(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_ddp_pkg_bundle_id() argument
150 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", pf->hw.active_track_id); in ice_info_ddp_pkg_bundle_id()
153 static void ice_info_netlist_ver(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_netlist_ver() argument
155 struct ice_netlist_info *netlist = &pf->hw.flash.netlist; in ice_info_netlist_ver()
164 static void ice_info_netlist_build(struct ice_pf *pf, struct ice_info_ctx *ctx) in ice_info_netlist_build() argument
166 struct ice_netlist_info *netlist = &pf->hw.flash.netlist; in ice_info_netlist_build()
172 ice_info_pending_netlist_ver(struct ice_pf __always_unused *pf, in ice_info_pending_netlist_ver() argument
186 ice_info_pending_netlist_build(struct ice_pf __always_unused *pf, in ice_info_pending_netlist_build() argument
222 void (*getter)(struct ice_pf *pf, struct ice_info_ctx *ctx);
223 void (*fallback)(struct ice_pf *pf, struct ice_info_ctx *ctx);
254 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_info_get() local
255 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_info_get()
256 struct ice_hw *hw = &pf->hw; in ice_devlink_info_get()
261 err = ice_wait_for_reset(pf, 10 * HZ); in ice_devlink_info_get()
319 ice_info_get_dsn(pf, ctx); in ice_devlink_info_get()
333 ice_devlink_versions[i].getter(pf, ctx); in ice_devlink_info_get()
341 ice_devlink_versions[i].fallback(pf, ctx); in ice_devlink_info_get()
400 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_reload_empr_start() local
401 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_reload_empr_start()
402 struct ice_hw *hw = &pf->hw; in ice_devlink_reload_empr_start()
406 err = ice_get_pending_updates(pf, &pending, extack); in ice_devlink_reload_empr_start()
420 if (pf->fw_emp_reset_disabled) { in ice_devlink_reload_empr_start()
457 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_reload_empr_finish() local
462 err = ice_wait_for_reset(pf, 60 * HZ); in ice_devlink_reload_empr_finish()
502 * @pf: the PF to print split port options
506 static void ice_devlink_port_options_print(struct ice_pf *pf) in ice_devlink_port_options_print() argument
510 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_port_options_print()
526 status = ice_aq_get_port_options(&pf->hw, opt, &options_count, in ice_devlink_port_options_print()
573 * @pf: the PF to print split port options
581 ice_devlink_aq_set_port_option(struct ice_pf *pf, u8 option_idx, in ice_devlink_aq_set_port_option() argument
584 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_aq_set_port_option()
587 status = ice_aq_set_port_option(&pf->hw, 0, true, option_idx); in ice_devlink_aq_set_port_option()
590 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
595 status = ice_acquire_nvm(&pf->hw, ICE_RES_WRITE); in ice_devlink_aq_set_port_option()
598 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
603 status = ice_nvm_write_activate(&pf->hw, ICE_AQC_NVM_ACTIV_REQ_EMPR, NULL); in ice_devlink_aq_set_port_option()
606 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
608 ice_release_nvm(&pf->hw); in ice_devlink_aq_set_port_option()
612 ice_release_nvm(&pf->hw); in ice_devlink_aq_set_port_option()
642 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_port_split() local
644 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_port_split()
648 status = ice_aq_get_port_options(&pf->hw, options, &option_count, in ice_devlink_port_split()
677 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
684 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
688 status = ice_devlink_aq_set_port_option(pf, new_option, extack); in ice_devlink_port_split()
692 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
734 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_get() local
736 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? true : false; in ice_devlink_enable_roce_get()
745 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_set() local
750 ice_unplug_aux_dev(pf); in ice_devlink_enable_roce_set()
751 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
755 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
756 ret = ice_plug_aux_dev(pf); in ice_devlink_enable_roce_set()
758 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
768 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_roce_validate() local
770 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_roce_validate()
773 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP) { in ice_devlink_enable_roce_validate()
785 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_get() local
787 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_get()
796 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_set() local
801 ice_unplug_aux_dev(pf); in ice_devlink_enable_iw_set()
802 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
806 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
807 ret = ice_plug_aux_dev(pf); in ice_devlink_enable_iw_set()
809 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
819 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_enable_iw_validate() local
821 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_iw_validate()
824 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2) { in ice_devlink_enable_iw_validate()
850 * ice_allocate_pf - Allocate devlink and return PF structure pointer
854 * the PF structure. The devlink memory is kept track of through devres by
873 * ice_devlink_register - Register devlink interface for this PF
874 * @pf: the PF to register the devlink for.
880 void ice_devlink_register(struct ice_pf *pf) in ice_devlink_register() argument
882 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_register()
889 * ice_devlink_unregister - Unregister devlink resources for this PF.
890 * @pf: the PF structure to cleanup
894 void ice_devlink_unregister(struct ice_pf *pf) in ice_devlink_unregister() argument
896 devlink_unregister(priv_to_devlink(pf)); in ice_devlink_unregister()
901 * @pf: the PF to create a devlink port for
905 ice_devlink_set_switch_id(struct ice_pf *pf, struct netdev_phys_item_id *ppid) in ice_devlink_set_switch_id() argument
907 struct pci_dev *pdev = pf->pdev; in ice_devlink_set_switch_id()
916 int ice_devlink_register_params(struct ice_pf *pf) in ice_devlink_register_params() argument
918 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_register_params()
932 value.vbool = test_bit(ICE_FLAG_RDMA_ENA, pf->flags) ? true : false; in ice_devlink_register_params()
940 void ice_devlink_unregister_params(struct ice_pf *pf) in ice_devlink_unregister_params() argument
942 devlink_params_unregister(priv_to_devlink(pf), ice_devlink_params, in ice_devlink_unregister_params()
948 * @pf: the PF to set port split options
954 ice_devlink_set_port_split_options(struct ice_pf *pf, in ice_devlink_set_port_split_options() argument
962 status = ice_aq_get_port_options(&pf->hw, options, &option_count, in ice_devlink_set_port_split_options()
966 dev_dbg(ice_pf_to_dev(pf), "Couldn't read port split options, err = %d\n", in ice_devlink_set_port_split_options()
980 * ice_devlink_create_pf_port - Create a devlink port for this PF
981 * @pf: the PF to create a devlink port for
983 * Create and register a devlink_port for this PF.
987 int ice_devlink_create_pf_port(struct ice_pf *pf) in ice_devlink_create_pf_port() argument
996 dev = ice_pf_to_dev(pf); in ice_devlink_create_pf_port()
998 devlink_port = &pf->devlink_port; in ice_devlink_create_pf_port()
1000 vsi = ice_get_main_vsi(pf); in ice_devlink_create_pf_port()
1005 attrs.phys.port_number = pf->hw.bus.func; in ice_devlink_create_pf_port()
1008 * set port split options only for first PF. in ice_devlink_create_pf_port()
1010 if (pf->hw.pf_id == 0) in ice_devlink_create_pf_port()
1011 ice_devlink_set_port_split_options(pf, &attrs); in ice_devlink_create_pf_port()
1013 ice_devlink_set_switch_id(pf, &attrs.switch_id); in ice_devlink_create_pf_port()
1016 devlink = priv_to_devlink(pf); in ice_devlink_create_pf_port()
1020 dev_err(dev, "Failed to create devlink port for PF %d, error %d\n", in ice_devlink_create_pf_port()
1021 pf->hw.pf_id, err); in ice_devlink_create_pf_port()
1029 * ice_devlink_destroy_pf_port - Destroy the devlink_port for this PF
1030 * @pf: the PF to cleanup
1032 * Unregisters the devlink_port structure associated with this PF.
1034 void ice_devlink_destroy_pf_port(struct ice_pf *pf) in ice_devlink_destroy_pf_port() argument
1038 devlink_port = &pf->devlink_port; in ice_devlink_destroy_pf_port()
1059 struct ice_pf *pf; in ice_devlink_create_vf_port() local
1062 pf = vf->pf; in ice_devlink_create_vf_port()
1063 dev = ice_pf_to_dev(pf); in ice_devlink_create_vf_port()
1071 attrs.pci_vf.pf = pf->hw.bus.func; in ice_devlink_create_vf_port()
1074 ice_devlink_set_switch_id(pf, &attrs.switch_id); in ice_devlink_create_vf_port()
1077 devlink = priv_to_devlink(pf); in ice_devlink_create_vf_port()
1130 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_nvm_snapshot() local
1131 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_nvm_snapshot()
1132 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_snapshot()
1207 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_sram_snapshot() local
1208 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_sram_snapshot()
1209 struct ice_hw *hw = &pf->hw; in ice_devlink_sram_snapshot()
1266 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_devcaps_snapshot() local
1267 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_devcaps_snapshot()
1268 struct ice_hw *hw = &pf->hw; in ice_devlink_devcaps_snapshot()
1311 * @pf: the PF device structure
1316 void ice_devlink_init_regions(struct ice_pf *pf) in ice_devlink_init_regions() argument
1318 struct devlink *devlink = priv_to_devlink(pf); in ice_devlink_init_regions()
1319 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_init_regions()
1322 nvm_size = pf->hw.flash.flash_size; in ice_devlink_init_regions()
1323 pf->nvm_region = devlink_region_create(devlink, &ice_nvm_region_ops, 1, in ice_devlink_init_regions()
1325 if (IS_ERR(pf->nvm_region)) { in ice_devlink_init_regions()
1327 PTR_ERR(pf->nvm_region)); in ice_devlink_init_regions()
1328 pf->nvm_region = NULL; in ice_devlink_init_regions()
1331 sram_size = pf->hw.flash.sr_words * 2u; in ice_devlink_init_regions()
1332 pf->sram_region = devlink_region_create(devlink, &ice_sram_region_ops, in ice_devlink_init_regions()
1334 if (IS_ERR(pf->sram_region)) { in ice_devlink_init_regions()
1336 PTR_ERR(pf->sram_region)); in ice_devlink_init_regions()
1337 pf->sram_region = NULL; in ice_devlink_init_regions()
1340 pf->devcaps_region = devlink_region_create(devlink, in ice_devlink_init_regions()
1343 if (IS_ERR(pf->devcaps_region)) { in ice_devlink_init_regions()
1345 PTR_ERR(pf->devcaps_region)); in ice_devlink_init_regions()
1346 pf->devcaps_region = NULL; in ice_devlink_init_regions()
1352 * @pf: the PF device structure
1354 * Remove previously created regions for this PF.
1356 void ice_devlink_destroy_regions(struct ice_pf *pf) in ice_devlink_destroy_regions() argument
1358 if (pf->nvm_region) in ice_devlink_destroy_regions()
1359 devlink_region_destroy(pf->nvm_region); in ice_devlink_destroy_regions()
1361 if (pf->sram_region) in ice_devlink_destroy_regions()
1362 devlink_region_destroy(pf->sram_region); in ice_devlink_destroy_regions()
1364 if (pf->devcaps_region) in ice_devlink_destroy_regions()
1365 devlink_region_destroy(pf->devcaps_region); in ice_devlink_destroy_regions()