Lines Matching full:pf
47 * @pf: the PF to print split port options
51 static void ice_devlink_port_options_print(struct ice_pf *pf) in ice_devlink_port_options_print() argument
55 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_port_options_print()
71 status = ice_aq_get_port_options(&pf->hw, opt, &options_count, in ice_devlink_port_options_print()
118 * @pf: the PF to print split port options
126 ice_devlink_aq_set_port_option(struct ice_pf *pf, u8 option_idx, in ice_devlink_aq_set_port_option() argument
129 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_aq_set_port_option()
132 status = ice_aq_set_port_option(&pf->hw, 0, true, option_idx); in ice_devlink_aq_set_port_option()
135 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
140 status = ice_acquire_nvm(&pf->hw, ICE_RES_WRITE); in ice_devlink_aq_set_port_option()
143 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
148 status = ice_nvm_write_activate(&pf->hw, ICE_AQC_NVM_ACTIV_REQ_EMPR, NULL); in ice_devlink_aq_set_port_option()
151 status, pf->hw.adminq.sq_last_status); in ice_devlink_aq_set_port_option()
153 ice_release_nvm(&pf->hw); in ice_devlink_aq_set_port_option()
157 ice_release_nvm(&pf->hw); in ice_devlink_aq_set_port_option()
187 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_port_split() local
189 struct device *dev = ice_pf_to_dev(pf); in ice_devlink_port_split()
193 status = ice_aq_get_port_options(&pf->hw, options, &option_count, in ice_devlink_port_split()
222 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
229 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
233 status = ice_devlink_aq_set_port_option(pf, new_option, extack); in ice_devlink_port_split()
237 ice_devlink_port_options_print(pf); in ice_devlink_port_split()
263 * @pf: the PF to set port split options
269 ice_devlink_set_port_split_options(struct ice_pf *pf, in ice_devlink_set_port_split_options() argument
277 status = ice_aq_get_port_options(&pf->hw, options, &option_count, in ice_devlink_set_port_split_options()
281 dev_dbg(ice_pf_to_dev(pf), "Couldn't read port split options, err = %d\n", in ice_devlink_set_port_split_options()
301 * @pf: the PF to create a devlink port for
305 ice_devlink_set_switch_id(struct ice_pf *pf, struct netdev_phys_item_id *ppid) in ice_devlink_set_switch_id() argument
307 struct pci_dev *pdev = pf->pdev; in ice_devlink_set_switch_id()
317 * ice_devlink_create_pf_port - Create a devlink port for this PF
318 * @pf: the PF to create a devlink port for
320 * Create and register a devlink_port for this PF.
325 int ice_devlink_create_pf_port(struct ice_pf *pf) in ice_devlink_create_pf_port() argument
334 devlink = priv_to_devlink(pf); in ice_devlink_create_pf_port()
336 dev = ice_pf_to_dev(pf); in ice_devlink_create_pf_port()
338 devlink_port = &pf->devlink_port; in ice_devlink_create_pf_port()
340 vsi = ice_get_main_vsi(pf); in ice_devlink_create_pf_port()
345 attrs.phys.port_number = pf->hw.pf_id; in ice_devlink_create_pf_port()
348 * set port split options only for first PF. in ice_devlink_create_pf_port()
350 if (pf->hw.pf_id == 0) in ice_devlink_create_pf_port()
351 ice_devlink_set_port_split_options(pf, &attrs); in ice_devlink_create_pf_port()
353 ice_devlink_set_switch_id(pf, &attrs.switch_id); in ice_devlink_create_pf_port()
360 dev_err(dev, "Failed to create devlink port for PF %d, error %d\n", in ice_devlink_create_pf_port()
361 pf->hw.pf_id, err); in ice_devlink_create_pf_port()
369 * ice_devlink_destroy_pf_port - Destroy the devlink_port for this PF
370 * @pf: the PF to cleanup
372 * Unregisters the devlink_port structure associated with this PF.
375 void ice_devlink_destroy_pf_port(struct ice_pf *pf) in ice_devlink_destroy_pf_port() argument
377 devl_port_unregister(&pf->devlink_port); in ice_devlink_destroy_pf_port()
421 struct ice_pf *pf; in ice_devlink_port_set_vf_fn_mac() local
424 pf = devlink_priv(devlink); in ice_devlink_port_set_vf_fn_mac()
428 return __ice_set_vf_mac(pf, vf_id, hw_addr); in ice_devlink_port_set_vf_fn_mac()
451 struct ice_pf *pf; in ice_devlink_create_vf_port() local
454 pf = vf->pf; in ice_devlink_create_vf_port()
455 dev = ice_pf_to_dev(pf); in ice_devlink_create_vf_port()
463 attrs.pci_vf.pf = pf->hw.pf_id; in ice_devlink_create_vf_port()
466 ice_devlink_set_switch_id(pf, &attrs.switch_id); in ice_devlink_create_vf_port()
469 devlink = priv_to_devlink(pf); in ice_devlink_create_vf_port()
587 struct ice_pf *pf = dyn_port->pf; in ice_dealloc_dynamic_port() local
591 xa_erase(&pf->sf_nums, devlink_port->attrs.pci_sf.sf); in ice_dealloc_dynamic_port()
592 ice_eswitch_detach_sf(pf, dyn_port); in ice_dealloc_dynamic_port()
594 xa_erase(&pf->dyn_ports, dyn_port->vsi->idx); in ice_dealloc_dynamic_port()
600 * @pf: pointer to the pf structure
602 void ice_dealloc_all_dynamic_ports(struct ice_pf *pf) in ice_dealloc_all_dynamic_ports() argument
607 xa_for_each(&pf->dyn_ports, index, dyn_port) in ice_dealloc_all_dynamic_ports()
613 * @pf: pointer to the PF structure
623 ice_devlink_port_new_check_attr(struct ice_pf *pf, in ice_devlink_port_new_check_attr() argument
642 if (new_attr->pfnum != pf->hw.pf_id) { in ice_devlink_port_new_check_attr()
647 if (!pci_msix_can_alloc_dyn(pf->pdev)) { in ice_devlink_port_new_check_attr()
816 * @pf: pointer to the pf structure
827 ice_reserve_sf_num(struct ice_pf *pf, in ice_reserve_sf_num() argument
835 return xa_alloc(&pf->sf_nums, sfnum, NULL, xa_limit_32b, in ice_reserve_sf_num()
839 err = xa_insert(&pf->sf_nums, new_attr->sfnum, NULL, GFP_KERNEL); in ice_reserve_sf_num()
866 struct ice_pf *pf; in ice_devlink_create_sf_port() local
869 pf = dyn_port->pf; in ice_devlink_create_sf_port()
874 attrs.pci_sf.pf = pf->hw.pf_id; in ice_devlink_create_sf_port()
878 devlink = priv_to_devlink(pf); in ice_devlink_create_sf_port()
898 * @pf: pointer to the pf structure
909 ice_alloc_dynamic_port(struct ice_pf *pf, in ice_alloc_dynamic_port() argument
919 err = ice_reserve_sf_num(pf, new_attr, extack, &sfnum); in ice_alloc_dynamic_port()
929 vsi = ice_vsi_alloc(pf); in ice_alloc_dynamic_port()
937 dyn_port->pf = pf; in ice_alloc_dynamic_port()
941 err = xa_insert(&pf->dyn_ports, vsi->idx, dyn_port, GFP_KERNEL); in ice_alloc_dynamic_port()
947 err = ice_eswitch_attach_sf(pf, dyn_port); in ice_alloc_dynamic_port()
958 xa_erase(&pf->dyn_ports, vsi->idx); in ice_alloc_dynamic_port()
964 xa_erase(&pf->sf_nums, sfnum); in ice_alloc_dynamic_port()
987 struct ice_pf *pf = devlink_priv(devlink); in ice_devlink_port_new() local
990 err = ice_devlink_port_new_check_attr(pf, new_attr, extack); in ice_devlink_port_new()
994 if (!ice_is_eswitch_mode_switchdev(pf)) { in ice_devlink_port_new()
1000 return ice_alloc_dynamic_port(pf, new_attr, extack, devlink_port); in ice_devlink_port_new()