Lines Matching full:pf
26 * @pf: pointer to PF structure
31 bool ice_is_pfc_causing_hung_q(struct ice_pf *pf, unsigned int txqueue) in ice_is_pfc_causing_hung_q() argument
38 vsi = ice_get_main_vsi(pf); in ice_is_pfc_causing_hung_q()
56 up2tc = rd32(&pf->hw, PRTDCB_TUP2TC); in ice_is_pfc_causing_hung_q()
70 ref_prio_xoff[i] = pf->stats.priority_xoff_rx[i]; in ice_is_pfc_causing_hung_q()
72 ice_update_dcb_stats(pf); in ice_is_pfc_causing_hung_q()
76 if (pf->stats.priority_xoff_rx[i] > ref_prio_xoff[i]) in ice_is_pfc_causing_hung_q()
256 * PF queues) should be the first drop TC of the main VSI in ice_vsi_cfg_dcb_rings()
274 * @pf: pointer to the PF instance
278 * Before a new DCB configuration can be applied, VSIs of type PF, SWITCHDEV
283 static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked) in ice_dcb_ena_dis_vsi() argument
287 ice_for_each_vsi(pf, i) { in ice_dcb_ena_dis_vsi()
288 struct ice_vsi *vsi = pf->vsi[i]; in ice_dcb_ena_dis_vsi()
309 * @pf: pointer to the PF struct
312 int ice_dcb_bwchk(struct ice_pf *pf, struct ice_dcbx_cfg *dcbcfg) in ice_dcb_bwchk() argument
337 dev_err(ice_pf_to_dev(pf), "Invalid config, total bandwidth must equal 100\n"); in ice_dcb_bwchk()
346 * @pf: pointer to the PF struct
350 int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) in ice_pf_dcb_cfg() argument
354 struct device *dev = ice_pf_to_dev(pf); in ice_pf_dcb_cfg()
359 curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; in ice_pf_dcb_cfg()
362 if (!pf->hw.port_info->qos_cfg.is_sw_lldp) in ice_pf_dcb_cfg()
368 if (pf->hw.port_info->is_custom_tx_enabled) { in ice_pf_dcb_cfg()
372 ice_tear_down_devlink_rate_tree(pf); in ice_pf_dcb_cfg()
374 set_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_pf_dcb_cfg()
377 clear_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_pf_dcb_cfg()
385 if (ice_dcb_bwchk(pf, new_cfg)) in ice_pf_dcb_cfg()
394 pf_vsi = ice_get_main_vsi(pf); in ice_pf_dcb_cfg()
396 dev_dbg(dev, "PF VSI doesn't exist\n"); in ice_pf_dcb_cfg()
409 ice_send_event_to_aux(pf, event); in ice_pf_dcb_cfg()
419 ice_dcb_ena_dis_vsi(pf, false, true); in ice_pf_dcb_cfg()
428 if (pf->hw.port_info->qos_cfg.is_sw_lldp) { in ice_pf_dcb_cfg()
429 ret = ice_set_dcb_cfg(pf->hw.port_info); in ice_pf_dcb_cfg()
438 ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); in ice_pf_dcb_cfg()
444 ice_pf_dcb_recfg(pf, false); in ice_pf_dcb_cfg()
448 ice_dcb_ena_dis_vsi(pf, true, true); in ice_pf_dcb_cfg()
480 * @pf: board private structure
485 ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, in ice_dcb_need_recfg() argument
488 struct device *dev = ice_pf_to_dev(pf); in ice_dcb_need_recfg()
531 * @pf: physical function instance
533 void ice_dcb_rebuild(struct ice_pf *pf) in ice_dcb_rebuild() argument
536 struct device *dev = ice_pf_to_dev(pf); in ice_dcb_rebuild()
540 ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); in ice_dcb_rebuild()
546 mutex_lock(&pf->tc_mutex); in ice_dcb_rebuild()
548 if (!pf->hw.port_info->qos_cfg.is_sw_lldp) in ice_dcb_rebuild()
549 ice_cfg_etsrec_defaults(pf->hw.port_info); in ice_dcb_rebuild()
551 ret = ice_set_dcb_cfg(pf->hw.port_info); in ice_dcb_rebuild()
557 if (!pf->hw.port_info->qos_cfg.is_sw_lldp) { in ice_dcb_rebuild()
558 ret = ice_cfg_lldp_mib_change(&pf->hw, true); in ice_dcb_rebuild()
559 if (ret && !pf->hw.port_info->qos_cfg.is_sw_lldp) { in ice_dcb_rebuild()
566 ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); in ice_dcb_rebuild()
572 mutex_unlock(&pf->tc_mutex); in ice_dcb_rebuild()
580 mutex_unlock(&pf->tc_mutex); in ice_dcb_rebuild()
594 ice_pf_dcb_cfg(pf, err_cfg, false); in ice_dcb_rebuild()
597 mutex_unlock(&pf->tc_mutex); in ice_dcb_rebuild()
602 * @pf: PF to apply config to
605 static int ice_dcb_init_cfg(struct ice_pf *pf, bool locked) in ice_dcb_init_cfg() argument
611 pi = pf->hw.port_info; in ice_dcb_init_cfg()
619 dev_info(ice_pf_to_dev(pf), "Configuring initial DCB values\n"); in ice_dcb_init_cfg()
620 if (ice_pf_dcb_cfg(pf, newcfg, locked)) in ice_dcb_init_cfg()
630 * @pf: PF to apply config to
634 int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool ets_willing, bool locked) in ice_dcb_sw_dflt_cfg() argument
642 hw = &pf->hw; in ice_dcb_sw_dflt_cfg()
667 ret = ice_pf_dcb_cfg(pf, dcbcfg, locked); in ice_dcb_sw_dflt_cfg()
705 * @pf: pointer to the PF struct
709 static int ice_dcb_noncontig_cfg(struct ice_pf *pf) in ice_dcb_noncontig_cfg() argument
711 struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; in ice_dcb_noncontig_cfg()
712 struct device *dev = ice_pf_to_dev(pf); in ice_dcb_noncontig_cfg()
716 ret = ice_dcb_sw_dflt_cfg(pf, false, true); in ice_dcb_noncontig_cfg()
724 ret = ice_set_dcb_cfg(pf->hw.port_info); in ice_dcb_noncontig_cfg()
733 * @pf: pointer to the PF struct
740 void ice_pf_dcb_recfg(struct ice_pf *pf, bool locked) in ice_pf_dcb_recfg() argument
742 struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; in ice_pf_dcb_recfg()
748 ice_for_each_vsi(pf, v) { in ice_pf_dcb_recfg()
749 struct ice_vsi *vsi = pf->vsi[v]; in ice_pf_dcb_recfg()
762 ice_dcb_noncontig_cfg(pf); in ice_pf_dcb_recfg()
772 dev_err(ice_pf_to_dev(pf), "Failed to config TC for VSI index: %d\n", in ice_pf_dcb_recfg()
793 ice_send_event_to_aux(pf, event); in ice_pf_dcb_recfg()
799 * ice_init_pf_dcb - initialize DCB for a PF
800 * @pf: PF to initialize DCB for
803 int ice_init_pf_dcb(struct ice_pf *pf, bool locked) in ice_init_pf_dcb() argument
805 struct device *dev = ice_pf_to_dev(pf); in ice_init_pf_dcb()
807 struct ice_hw *hw = &pf->hw; in ice_init_pf_dcb()
819 pf->hw.func_caps.common_cap.maxtc); in ice_init_pf_dcb()
825 clear_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags); in ice_init_pf_dcb()
826 err = ice_aq_set_pfc_mode(&pf->hw, ICE_AQC_PFC_VLAN_BASED_PFC, in ice_init_pf_dcb()
831 err = ice_dcb_sw_dflt_cfg(pf, true, locked); in ice_init_pf_dcb()
842 pf_vsi = ice_get_main_vsi(pf); in ice_init_pf_dcb()
851 pf->dcbx_cap = ice_dcb_get_mode(port_info, true); in ice_init_pf_dcb()
855 set_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags); in ice_init_pf_dcb()
858 pf->dcbx_cap = ice_dcb_get_mode(port_info, false); in ice_init_pf_dcb()
860 err = ice_dcb_init_cfg(pf, locked); in ice_init_pf_dcb()
873 * @pf: PF whose stats needs to be updated
875 void ice_update_dcb_stats(struct ice_pf *pf) in ice_update_dcb_stats() argument
878 struct ice_hw *hw = &pf->hw; in ice_update_dcb_stats()
883 prev_ps = &pf->stats_prev; in ice_update_dcb_stats()
884 cur_ps = &pf->stats; in ice_update_dcb_stats()
886 if (ice_is_reset_in_progress(pf->state)) in ice_update_dcb_stats()
887 pf->stat_prev_loaded = false; in ice_update_dcb_stats()
891 pf->stat_prev_loaded, in ice_update_dcb_stats()
895 pf->stat_prev_loaded, in ice_update_dcb_stats()
899 pf->stat_prev_loaded, in ice_update_dcb_stats()
903 pf->stat_prev_loaded, in ice_update_dcb_stats()
907 pf->stat_prev_loaded, in ice_update_dcb_stats()
959 * @pf: ptr to ice_pf
963 ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, in ice_dcb_process_lldp_set_mib_change() argument
967 struct device *dev = ice_pf_to_dev(pf); in ice_dcb_process_lldp_set_mib_change()
977 if (!(test_bit(ICE_FLAG_DCB_CAPABLE, pf->flags))) in ice_dcb_process_lldp_set_mib_change()
980 if (pf->dcbx_cap & DCB_CAP_DCBX_HOST) { in ice_dcb_process_lldp_set_mib_change()
985 pi = pf->hw.port_info; in ice_dcb_process_lldp_set_mib_change()
1021 mutex_lock(&pf->tc_mutex); in ice_dcb_process_lldp_set_mib_change()
1048 pf->dcbx_cap = ice_dcb_get_mode(pi, false); in ice_dcb_process_lldp_set_mib_change()
1050 need_reconfig = ice_dcb_need_recfg(pf, &tmp_dcbx_cfg, in ice_dcb_process_lldp_set_mib_change()
1052 ice_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &pi->qos_cfg.local_dcbx_cfg); in ice_dcb_process_lldp_set_mib_change()
1059 set_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_dcb_process_lldp_set_mib_change()
1062 clear_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_dcb_process_lldp_set_mib_change()
1067 ice_lldp_execute_pending_mib(&pf->hw); in ice_dcb_process_lldp_set_mib_change()
1073 ice_dcb_ena_dis_vsi(pf, false, true); in ice_dcb_process_lldp_set_mib_change()
1082 ice_pf_dcb_recfg(pf, false); in ice_dcb_process_lldp_set_mib_change()
1085 ice_dcb_ena_dis_vsi(pf, true, true); in ice_dcb_process_lldp_set_mib_change()
1089 mutex_unlock(&pf->tc_mutex); in ice_dcb_process_lldp_set_mib_change()
1093 ice_lldp_execute_pending_mib(&pf->hw); in ice_dcb_process_lldp_set_mib_change()