// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019, Intel Corporation. */ #include "ice_dcb_lib.h" #include "ice_dcb_nl.h" #include "devlink/devlink.h" /** * ice_dcb_get_ena_tc - return bitmap of enabled TCs * @dcbcfg: DCB config to evaluate for enabled TCs */ static u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg) { … } /** * ice_is_pfc_causing_hung_q * @pf: pointer to PF structure * @txqueue: Tx queue which is supposedly hung queue * * find if PFC is causing the hung queue, if yes return true else false */ bool ice_is_pfc_causing_hung_q(struct ice_pf *pf, unsigned int txqueue) { … } /** * ice_dcb_get_mode - gets the DCB mode * @port_info: pointer to port info structure * @host: if set it's HOST if not it's MANAGED */ static u8 ice_dcb_get_mode(struct ice_port_info *port_info, bool host) { … } /** * ice_dcb_get_num_tc - Get the number of TCs from DCBX config * @dcbcfg: config to retrieve number of TCs from */ u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg) { … } /** * ice_get_first_droptc - returns number of first droptc * @vsi: used to find the first droptc * * This function returns the value of first_droptc. * When DCB is enabled, first droptc information is derived from enabled_tc * and PFC enabled bits. otherwise this function returns 0 as there is one * TC without DCB (tc0) */ static u8 ice_get_first_droptc(struct ice_vsi *vsi) { … } /** * ice_vsi_set_dcb_tc_cfg - Set VSI's TC based on DCB configuration * @vsi: pointer to the VSI instance */ void ice_vsi_set_dcb_tc_cfg(struct ice_vsi *vsi) { … } /** * ice_dcb_get_tc - Get the TC associated with the queue * @vsi: ptr to the VSI * @queue_index: queue number associated with VSI */ u8 ice_dcb_get_tc(struct ice_vsi *vsi, int queue_index) { … } /** * ice_vsi_cfg_dcb_rings - Update rings to reflect DCB TC * @vsi: VSI owner of rings being updated */ void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi) { … } /** * ice_dcb_ena_dis_vsi - disable certain VSIs for DCB config/reconfig * @pf: pointer to the PF instance * @ena: true to enable VSIs, false to disable * @locked: true if caller holds RTNL lock, false otherwise * * Before a new DCB configuration can be applied, VSIs of type PF, SWITCHDEV * and CHNL need to be brought down. Following completion of DCB configuration * the VSIs that were downed need to be brought up again. This helper function * does both. */ static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked) { … } /** * ice_dcb_bwchk - check if ETS bandwidth input parameters are correct * @pf: pointer to the PF struct * @dcbcfg: pointer to DCB config structure */ int ice_dcb_bwchk(struct ice_pf *pf, struct ice_dcbx_cfg *dcbcfg) { … } /** * ice_pf_dcb_cfg - Apply new DCB configuration * @pf: pointer to the PF struct * @new_cfg: DCBX config to apply * @locked: is the RTNL held */ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) { … } /** * ice_cfg_etsrec_defaults - Set default ETS recommended DCB config * @pi: port information structure */ static void ice_cfg_etsrec_defaults(struct ice_port_info *pi) { … } /** * ice_dcb_need_recfg - Check if DCB needs reconfig * @pf: board private structure * @old_cfg: current DCB config * @new_cfg: new DCB config */ static bool ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, struct ice_dcbx_cfg *new_cfg) { … } /** * ice_dcb_rebuild - rebuild DCB post reset * @pf: physical function instance */ void ice_dcb_rebuild(struct ice_pf *pf) { … } /** * ice_dcb_init_cfg - set the initial DCB config in SW * @pf: PF to apply config to * @locked: Is the RTNL held */ static int ice_dcb_init_cfg(struct ice_pf *pf, bool locked) { … } /** * ice_dcb_sw_dflt_cfg - Apply a default DCB config * @pf: PF to apply config to * @ets_willing: configure ETS willing * @locked: was this function called with RTNL held */ int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool ets_willing, bool locked) { … } /** * ice_dcb_tc_contig - Check that TCs are contiguous * @prio_table: pointer to priority table * * Check if TCs begin with TC0 and are contiguous */ static bool ice_dcb_tc_contig(u8 *prio_table) { … } /** * ice_dcb_noncontig_cfg - Configure DCB for non-contiguous TCs * @pf: pointer to the PF struct * * If non-contiguous TCs, then configure SW DCB with TC0 and ETS non-willing */ static int ice_dcb_noncontig_cfg(struct ice_pf *pf) { … } /** * ice_pf_dcb_recfg - Reconfigure all VEBs and VSIs * @pf: pointer to the PF struct * @locked: is adev device lock held * * Assumed caller has already disabled all VSIs before * calling this function. Reconfiguring DCB based on * local_dcbx_cfg. */ void ice_pf_dcb_recfg(struct ice_pf *pf, bool locked) { … } /** * ice_init_pf_dcb - initialize DCB for a PF * @pf: PF to initialize DCB for * @locked: Was function called with RTNL held */ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) { … } /** * ice_update_dcb_stats - Update DCB stats counters * @pf: PF whose stats needs to be updated */ void ice_update_dcb_stats(struct ice_pf *pf) { … } /** * ice_tx_prepare_vlan_flags_dcb - prepare VLAN tagging for DCB * @tx_ring: ring to send buffer on * @first: pointer to struct ice_tx_buf * * This should not be called if the outer VLAN is software offloaded as the VLAN * tag will already be configured with the correct ID and priority bits */ void ice_tx_prepare_vlan_flags_dcb(struct ice_tx_ring *tx_ring, struct ice_tx_buf *first) { … } /** * ice_dcb_is_mib_change_pending - Check if MIB change is pending * @state: MIB change state */ static bool ice_dcb_is_mib_change_pending(u8 state) { … } /** * ice_dcb_process_lldp_set_mib_change - Process MIB change * @pf: ptr to ice_pf * @event: pointer to the admin queue receive event */ void ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, struct ice_rq_event_info *event) { … }