FILE
ice_dcb_lib.h
File preview with syntax highlighting.
linux-6.19.14/drivers/net/ethernet/intel/ice/ice_dcb_lib.h
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* Copyright (c) 2019, Intel Corporation. */ 3 4#ifndef _ICE_DCB_LIB_H_ 5#define _ICE_DCB_LIB_H_ 6 7#include "ice.h" 8#include "ice_base.h" 9#include "ice_lib.h" 10 11#ifdef CONFIG_DCB 12#define ICE_TC_MAX_BW 100 /* Default Max BW percentage */ 13#define ICE_DCB_HW_CHG_RST 0 /* DCB configuration changed with reset */ 14#define ICE_DCB_NO_HW_CHG 1 /* DCB configuration did not change */ 15#define ICE_DCB_HW_CHG 2 /* DCB configuration changed, no reset */ 16 17void ice_dcb_rebuild(struct ice_pf *pf); 18int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool ets_willing, bool locked); 19u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg); 20void ice_vsi_set_dcb_tc_cfg(struct ice_vsi *vsi); 21bool ice_is_pfc_causing_hung_q(struct ice_pf *pf, unsigned int txqueue); 22u8 ice_dcb_get_tc(struct ice_vsi *vsi, int queue_index); 23int 24ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked); 25int ice_dcb_bwchk(struct ice_pf *pf, struct ice_dcbx_cfg *dcbcfg); 26void ice_pf_dcb_recfg(struct ice_pf *pf, bool locked); 27void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi); 28int ice_init_pf_dcb(struct ice_pf *pf, bool locked); 29void ice_update_dcb_stats(struct ice_pf *pf); 30void 31ice_tx_prepare_vlan_flags_dcb(struct ice_tx_ring *tx_ring, 32 struct ice_tx_buf *first); 33void 34ice_setup_dcb_qos_info(struct ice_pf *pf, 35 struct iidc_rdma_qos_params *qos_info); 36void 37ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, 38 struct ice_rq_event_info *event); 39/** 40 * ice_find_q_in_range 41 * @low: start of queue range for a TC i.e. offset of TC 42 * @high: start of queue for next TC 43 * @tx_q: hung_queue/tx_queue 44 * 45 * finds if queue 'tx_q' falls between the two offsets of any given TC 46 */ 47static inline bool ice_find_q_in_range(u16 low, u16 high, unsigned int tx_q) 48{ 49 return (tx_q >= low) && (tx_q < high); 50} 51 52static inline void 53ice_set_cgd_num(struct ice_tlan_ctx *tlan_ctx, u8 dcb_tc) 54{ 55 tlan_ctx->cgd_num = dcb_tc; 56} 57 58static inline bool ice_is_dcb_active(struct ice_pf *pf) 59{ 60 return (test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags) || 61 test_bit(ICE_FLAG_DCB_ENA, pf->flags)); 62} 63 64static inline u8 ice_get_pfc_mode(struct ice_pf *pf) 65{ 66 return pf->hw.port_info->qos_cfg.local_dcbx_cfg.pfc_mode; 67} 68 69#else 70static inline void ice_dcb_rebuild(struct ice_pf *pf) { } 71 72static inline void ice_vsi_set_dcb_tc_cfg(struct ice_vsi *vsi) 73{ 74 vsi->tc_cfg.ena_tc = ICE_DFLT_TRAFFIC_CLASS; 75 vsi->tc_cfg.numtc = 1; 76} 77 78static inline u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg __always_unused *dcbcfg) 79{ 80 return ICE_DFLT_TRAFFIC_CLASS; 81} 82 83static inline u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg __always_unused *dcbcfg) 84{ 85 return 1; 86} 87 88static inline u8 89ice_dcb_get_tc(struct ice_vsi __always_unused *vsi, 90 int __always_unused queue_index) 91{ 92 return 0; 93} 94 95static inline int 96ice_init_pf_dcb(struct ice_pf *pf, bool __always_unused locked) 97{ 98 dev_dbg(ice_pf_to_dev(pf), "DCB not supported\n"); 99 return -EOPNOTSUPP; 100} 101 102static inline int 103ice_pf_dcb_cfg(struct ice_pf __always_unused *pf, 104 struct ice_dcbx_cfg __always_unused *new_cfg, 105 bool __always_unused locked) 106{ 107 return -EOPNOTSUPP; 108} 109 110static inline int 111ice_tx_prepare_vlan_flags_dcb(struct ice_tx_ring __always_unused *tx_ring, 112 struct ice_tx_buf __always_unused *first) 113{ 114 return 0; 115} 116 117static inline bool ice_is_dcb_active(struct ice_pf __always_unused *pf) 118{ 119 return false; 120} 121 122static inline bool 123ice_is_pfc_causing_hung_q(struct ice_pf __always_unused *pf, 124 unsigned int __always_unused txqueue) 125{ 126 return false; 127} 128 129static inline u8 ice_get_pfc_mode(struct ice_pf *pf) 130{ 131 return 0; 132} 133 134static inline void ice_pf_dcb_recfg(struct ice_pf *pf, bool locked) { } 135static inline void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi) { } 136static inline void ice_update_dcb_stats(struct ice_pf *pf) { } 137static inline void 138ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, struct ice_rq_event_info *event) { } 139static inline void ice_set_cgd_num(struct ice_tlan_ctx *tlan_ctx, u8 dcb_tc) { } 140static inline void 141ice_setup_dcb_qos_info(struct ice_pf *pf, struct iidc_rdma_qos_params *qos_info) 142{ 143 qos_info->num_tc = 1; 144 qos_info->tc_info[0].rel_bw = 100; 145} 146#endif /* CONFIG_DCB */ 147#endif /* _ICE_DCB_LIB_H_ */
~/
Read-only file preview.