Lines Matching full:pf

25  * @pf: pointer to PF structure
30 bool ice_is_pfc_causing_hung_q(struct ice_pf *pf, unsigned int txqueue) in ice_is_pfc_causing_hung_q() argument
37 vsi = ice_get_main_vsi(pf); in ice_is_pfc_causing_hung_q()
55 up2tc = rd32(&pf->hw, PRTDCB_TUP2TC); in ice_is_pfc_causing_hung_q()
69 ref_prio_xoff[i] = pf->stats.priority_xoff_rx[i]; in ice_is_pfc_causing_hung_q()
71 ice_update_dcb_stats(pf); in ice_is_pfc_causing_hung_q()
75 if (pf->stats.priority_xoff_rx[i] > ref_prio_xoff[i]) in ice_is_pfc_causing_hung_q()
254 * PF queues) should be the first drop TC of the main VSI in ice_vsi_cfg_dcb_rings()
272 * @pf: pointer to the PF instance
276 * Before a new DCB configuration can be applied, VSIs of type PF, SWITCHDEV
281 static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked) in ice_dcb_ena_dis_vsi() argument
285 ice_for_each_vsi(pf, i) { in ice_dcb_ena_dis_vsi()
286 struct ice_vsi *vsi = pf->vsi[i]; in ice_dcb_ena_dis_vsi()
308 * @pf: pointer to the PF struct
311 int ice_dcb_bwchk(struct ice_pf *pf, struct ice_dcbx_cfg *dcbcfg) in ice_dcb_bwchk() argument
336 dev_err(ice_pf_to_dev(pf), "Invalid config, total bandwidth must equal 100\n"); in ice_dcb_bwchk()
345 * @pf: pointer to the PF struct
349 int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) in ice_pf_dcb_cfg() argument
353 struct device *dev = ice_pf_to_dev(pf); in ice_pf_dcb_cfg()
358 curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; in ice_pf_dcb_cfg()
361 if (!pf->hw.port_info->qos_cfg.is_sw_lldp) in ice_pf_dcb_cfg()
367 set_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_pf_dcb_cfg()
370 clear_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_pf_dcb_cfg()
378 if (ice_dcb_bwchk(pf, new_cfg)) in ice_pf_dcb_cfg()
387 pf_vsi = ice_get_main_vsi(pf); in ice_pf_dcb_cfg()
389 dev_dbg(dev, "PF VSI doesn't exist\n"); in ice_pf_dcb_cfg()
402 ice_send_event_to_aux(pf, event); in ice_pf_dcb_cfg()
412 ice_dcb_ena_dis_vsi(pf, false, true); in ice_pf_dcb_cfg()
421 if (pf->hw.port_info->qos_cfg.is_sw_lldp) { in ice_pf_dcb_cfg()
422 ret = ice_set_dcb_cfg(pf->hw.port_info); in ice_pf_dcb_cfg()
431 ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); in ice_pf_dcb_cfg()
437 ice_pf_dcb_recfg(pf); in ice_pf_dcb_cfg()
441 ice_dcb_ena_dis_vsi(pf, true, true); in ice_pf_dcb_cfg()
473 * @pf: board private structure
478 ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, in ice_dcb_need_recfg() argument
481 struct device *dev = ice_pf_to_dev(pf); in ice_dcb_need_recfg()
524 * @pf: physical function instance
526 void ice_dcb_rebuild(struct ice_pf *pf) in ice_dcb_rebuild() argument
529 struct device *dev = ice_pf_to_dev(pf); in ice_dcb_rebuild()
533 ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); in ice_dcb_rebuild()
539 mutex_lock(&pf->tc_mutex); in ice_dcb_rebuild()
541 if (!pf->hw.port_info->qos_cfg.is_sw_lldp) in ice_dcb_rebuild()
542 ice_cfg_etsrec_defaults(pf->hw.port_info); in ice_dcb_rebuild()
544 ret = ice_set_dcb_cfg(pf->hw.port_info); in ice_dcb_rebuild()
550 if (!pf->hw.port_info->qos_cfg.is_sw_lldp) { in ice_dcb_rebuild()
551 ret = ice_cfg_lldp_mib_change(&pf->hw, true); in ice_dcb_rebuild()
552 if (ret && !pf->hw.port_info->qos_cfg.is_sw_lldp) { in ice_dcb_rebuild()
559 ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); in ice_dcb_rebuild()
565 mutex_unlock(&pf->tc_mutex); in ice_dcb_rebuild()
573 mutex_unlock(&pf->tc_mutex); in ice_dcb_rebuild()
587 ice_pf_dcb_cfg(pf, err_cfg, false); in ice_dcb_rebuild()
590 mutex_unlock(&pf->tc_mutex); in ice_dcb_rebuild()
595 * @pf: PF to apply config to
598 static int ice_dcb_init_cfg(struct ice_pf *pf, bool locked) in ice_dcb_init_cfg() argument
604 pi = pf->hw.port_info; in ice_dcb_init_cfg()
612 dev_info(ice_pf_to_dev(pf), "Configuring initial DCB values\n"); in ice_dcb_init_cfg()
613 if (ice_pf_dcb_cfg(pf, newcfg, locked)) in ice_dcb_init_cfg()
623 * @pf: PF to apply config to
627 int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool ets_willing, bool locked) in ice_dcb_sw_dflt_cfg() argument
635 hw = &pf->hw; in ice_dcb_sw_dflt_cfg()
660 ret = ice_pf_dcb_cfg(pf, dcbcfg, locked); in ice_dcb_sw_dflt_cfg()
698 * @pf: pointer to the PF struct
702 static int ice_dcb_noncontig_cfg(struct ice_pf *pf) in ice_dcb_noncontig_cfg() argument
704 struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; in ice_dcb_noncontig_cfg()
705 struct device *dev = ice_pf_to_dev(pf); in ice_dcb_noncontig_cfg()
709 ret = ice_dcb_sw_dflt_cfg(pf, false, true); in ice_dcb_noncontig_cfg()
717 ret = ice_set_dcb_cfg(pf->hw.port_info); in ice_dcb_noncontig_cfg()
726 * @pf: pointer to the PF struct
732 void ice_pf_dcb_recfg(struct ice_pf *pf) in ice_pf_dcb_recfg() argument
734 struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; in ice_pf_dcb_recfg()
740 ice_for_each_vsi(pf, v) { in ice_pf_dcb_recfg()
741 struct ice_vsi *vsi = pf->vsi[v]; in ice_pf_dcb_recfg()
754 ice_dcb_noncontig_cfg(pf); in ice_pf_dcb_recfg()
764 dev_err(ice_pf_to_dev(pf), "Failed to config TC for VSI index: %d\n", in ice_pf_dcb_recfg()
785 ice_send_event_to_aux(pf, event); in ice_pf_dcb_recfg()
790 * ice_init_pf_dcb - initialize DCB for a PF
791 * @pf: PF to initialize DCB for
794 int ice_init_pf_dcb(struct ice_pf *pf, bool locked) in ice_init_pf_dcb() argument
796 struct device *dev = ice_pf_to_dev(pf); in ice_init_pf_dcb()
798 struct ice_hw *hw = &pf->hw; in ice_init_pf_dcb()
810 pf->hw.func_caps.common_cap.maxtc); in ice_init_pf_dcb()
816 clear_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags); in ice_init_pf_dcb()
817 err = ice_aq_set_pfc_mode(&pf->hw, ICE_AQC_PFC_VLAN_BASED_PFC, in ice_init_pf_dcb()
822 err = ice_dcb_sw_dflt_cfg(pf, true, locked); in ice_init_pf_dcb()
833 pf_vsi = ice_get_main_vsi(pf); in ice_init_pf_dcb()
842 pf->dcbx_cap = ice_dcb_get_mode(port_info, true); in ice_init_pf_dcb()
846 set_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags); in ice_init_pf_dcb()
849 pf->dcbx_cap = ice_dcb_get_mode(port_info, false); in ice_init_pf_dcb()
851 err = ice_dcb_init_cfg(pf, locked); in ice_init_pf_dcb()
864 * @pf: PF whose stats needs to be updated
866 void ice_update_dcb_stats(struct ice_pf *pf) in ice_update_dcb_stats() argument
869 struct ice_hw *hw = &pf->hw; in ice_update_dcb_stats()
874 prev_ps = &pf->stats_prev; in ice_update_dcb_stats()
875 cur_ps = &pf->stats; in ice_update_dcb_stats()
879 pf->stat_prev_loaded, in ice_update_dcb_stats()
883 pf->stat_prev_loaded, in ice_update_dcb_stats()
887 pf->stat_prev_loaded, 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()
938 * @pf: ptr to ice_pf
942 ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, in ice_dcb_process_lldp_set_mib_change() argument
946 struct device *dev = ice_pf_to_dev(pf); in ice_dcb_process_lldp_set_mib_change()
955 if (!(test_bit(ICE_FLAG_DCB_CAPABLE, pf->flags))) in ice_dcb_process_lldp_set_mib_change()
958 if (pf->dcbx_cap & DCB_CAP_DCBX_HOST) { in ice_dcb_process_lldp_set_mib_change()
963 pi = pf->hw.port_info; in ice_dcb_process_lldp_set_mib_change()
986 mutex_lock(&pf->tc_mutex); in ice_dcb_process_lldp_set_mib_change()
989 tmp_dcbx_cfg = pf->hw.port_info->qos_cfg.local_dcbx_cfg; in ice_dcb_process_lldp_set_mib_change()
996 ret = ice_get_dcb_cfg(pf->hw.port_info); in ice_dcb_process_lldp_set_mib_change()
1009 pf->dcbx_cap = ice_dcb_get_mode(pi, false); in ice_dcb_process_lldp_set_mib_change()
1011 need_reconfig = ice_dcb_need_recfg(pf, &tmp_dcbx_cfg, in ice_dcb_process_lldp_set_mib_change()
1013 ice_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &pi->qos_cfg.local_dcbx_cfg); in ice_dcb_process_lldp_set_mib_change()
1020 set_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_dcb_process_lldp_set_mib_change()
1023 clear_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_dcb_process_lldp_set_mib_change()
1028 ice_dcb_ena_dis_vsi(pf, false, true); in ice_dcb_process_lldp_set_mib_change()
1030 ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); in ice_dcb_process_lldp_set_mib_change()
1037 ice_pf_dcb_recfg(pf); in ice_dcb_process_lldp_set_mib_change()
1040 ice_dcb_ena_dis_vsi(pf, true, true); in ice_dcb_process_lldp_set_mib_change()
1044 mutex_unlock(&pf->tc_mutex); in ice_dcb_process_lldp_set_mib_change()