// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2021 Intel Corporation. */ #include <linux/bitfield.h> #include "i40e_adminq.h" #include "i40e_alloc.h" #include "i40e_dcb.h" #include "i40e_prototype.h" /** * i40e_get_dcbx_status * @hw: pointer to the hw struct * @status: Embedded DCBX Engine Status * * Get the DCBX status from the Firmware **/ int i40e_get_dcbx_status(struct i40e_hw *hw, u16 *status) { … } /** * i40e_parse_ieee_etscfg_tlv * @tlv: IEEE 802.1Qaz ETS CFG TLV * @dcbcfg: Local store to update ETS CFG data * * Parses IEEE 802.1Qaz ETS CFG TLV **/ static void i40e_parse_ieee_etscfg_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_ieee_etsrec_tlv * @tlv: IEEE 802.1Qaz ETS REC TLV * @dcbcfg: Local store to update ETS REC data * * Parses IEEE 802.1Qaz ETS REC TLV **/ static void i40e_parse_ieee_etsrec_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_ieee_pfccfg_tlv * @tlv: IEEE 802.1Qaz PFC CFG TLV * @dcbcfg: Local store to update PFC CFG data * * Parses IEEE 802.1Qaz PFC CFG TLV **/ static void i40e_parse_ieee_pfccfg_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_ieee_app_tlv * @tlv: IEEE 802.1Qaz APP TLV * @dcbcfg: Local store to update APP PRIO data * * Parses IEEE 802.1Qaz APP PRIO TLV **/ static void i40e_parse_ieee_app_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_ieee_tlv * @tlv: IEEE 802.1Qaz TLV * @dcbcfg: Local store to update ETS REC data * * Get the TLV subtype and send it to parsing function * based on the subtype value **/ static void i40e_parse_ieee_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_cee_pgcfg_tlv * @tlv: CEE DCBX PG CFG TLV * @dcbcfg: Local store to update ETS CFG data * * Parses CEE DCBX PG CFG TLV **/ static void i40e_parse_cee_pgcfg_tlv(struct i40e_cee_feat_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_cee_pfccfg_tlv * @tlv: CEE DCBX PFC CFG TLV * @dcbcfg: Local store to update PFC CFG data * * Parses CEE DCBX PFC CFG TLV **/ static void i40e_parse_cee_pfccfg_tlv(struct i40e_cee_feat_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_cee_app_tlv * @tlv: CEE DCBX APP TLV * @dcbcfg: Local store to update APP PRIO data * * Parses CEE DCBX APP PRIO TLV **/ static void i40e_parse_cee_app_tlv(struct i40e_cee_feat_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_cee_tlv * @tlv: CEE DCBX TLV * @dcbcfg: Local store to update DCBX config data * * Get the TLV subtype and send it to parsing function * based on the subtype value **/ static void i40e_parse_cee_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_parse_org_tlv * @tlv: Organization specific TLV * @dcbcfg: Local store to update ETS REC data * * Currently only IEEE 802.1Qaz TLV is supported, all others * will be returned **/ static void i40e_parse_org_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_lldp_to_dcb_config * @lldpmib: LLDPDU to be parsed * @dcbcfg: store for LLDPDU data * * Parse DCB configuration from the LLDPDU **/ int i40e_lldp_to_dcb_config(u8 *lldpmib, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_aq_get_dcb_config * @hw: pointer to the hw struct * @mib_type: mib type for the query * @bridgetype: bridge type for the query (remote) * @dcbcfg: store for LLDPDU data * * Query DCB configuration from the Firmware **/ int i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type, u8 bridgetype, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_cee_to_dcb_v1_config * @cee_cfg: pointer to CEE v1 response configuration struct * @dcbcfg: DCB configuration struct * * Convert CEE v1 configuration from firmware to DCB configuration **/ static void i40e_cee_to_dcb_v1_config( struct i40e_aqc_get_cee_dcb_cfg_v1_resp *cee_cfg, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_cee_to_dcb_config * @cee_cfg: pointer to CEE configuration struct * @dcbcfg: DCB configuration struct * * Convert CEE configuration from firmware to DCB configuration **/ static void i40e_cee_to_dcb_config( struct i40e_aqc_get_cee_dcb_cfg_resp *cee_cfg, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_get_ieee_dcb_config * @hw: pointer to the hw struct * * Get IEEE mode DCB configuration from the Firmware **/ static int i40e_get_ieee_dcb_config(struct i40e_hw *hw) { … } /** * i40e_get_dcb_config * @hw: pointer to the hw struct * * Get DCB configuration from the Firmware **/ int i40e_get_dcb_config(struct i40e_hw *hw) { … } /** * i40e_init_dcb * @hw: pointer to the hw struct * @enable_mib_change: enable mib change event * * Update DCB configuration from the Firmware **/ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) { … } /** * i40e_get_fw_lldp_status * @hw: pointer to the hw struct * @lldp_status: pointer to the status enum * * Get status of FW Link Layer Discovery Protocol (LLDP) Agent. * Status of agent is reported via @lldp_status parameter. **/ int i40e_get_fw_lldp_status(struct i40e_hw *hw, enum i40e_get_fw_lldp_status_resp *lldp_status) { … } /** * i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format * @tlv: Fill the ETS config data in IEEE format * @dcbcfg: Local store which holds the DCB Config * * Prepare IEEE 802.1Qaz ETS CFG TLV **/ static void i40e_add_ieee_ets_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_add_ieee_etsrec_tlv - Prepare ETS Recommended TLV in IEEE format * @tlv: Fill ETS Recommended TLV in IEEE format * @dcbcfg: Local store which holds the DCB Config * * Prepare IEEE 802.1Qaz ETS REC TLV **/ static void i40e_add_ieee_etsrec_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_add_ieee_pfc_tlv - Prepare PFC TLV in IEEE format * @tlv: Fill PFC TLV in IEEE format * @dcbcfg: Local store to get PFC CFG data * * Prepare IEEE 802.1Qaz PFC CFG TLV **/ static void i40e_add_ieee_pfc_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_add_ieee_app_pri_tlv - Prepare APP TLV in IEEE format * @tlv: Fill APP TLV in IEEE format * @dcbcfg: Local store to get APP CFG data * * Prepare IEEE 802.1Qaz APP CFG TLV **/ static void i40e_add_ieee_app_pri_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_add_dcb_tlv - Add all IEEE TLVs * @tlv: pointer to org tlv * @dcbcfg: pointer to modified dcbx config structure * * @tlvid: tlv id to be added * add tlv information **/ static void i40e_add_dcb_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg, u16 tlvid) { … } /** * i40e_set_dcb_config - Set the local LLDP MIB to FW * @hw: pointer to the hw struct * * Set DCB configuration to the Firmware **/ int i40e_set_dcb_config(struct i40e_hw *hw) { … } /** * i40e_dcb_config_to_lldp - Convert Dcbconfig to MIB format * @lldpmib: pointer to mib to be output * @miblen: pointer to u16 for length of lldpmib * @dcbcfg: store for LLDPDU data * * send DCB configuration to FW **/ int i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen, struct i40e_dcbx_config *dcbcfg) { … } /** * i40e_dcb_hw_rx_fifo_config * @hw: pointer to the hw struct * @ets_mode: Strict Priority or Round Robin mode * @non_ets_mode: Strict Priority or Round Robin * @max_exponent: Exponent to calculate max refill credits * @lltc_map: Low latency TC bitmap * * Configure HW Rx FIFO as part of DCB configuration. **/ void i40e_dcb_hw_rx_fifo_config(struct i40e_hw *hw, enum i40e_dcb_arbiter_mode ets_mode, enum i40e_dcb_arbiter_mode non_ets_mode, u32 max_exponent, u8 lltc_map) { … } /** * i40e_dcb_hw_rx_cmd_monitor_config * @hw: pointer to the hw struct * @num_tc: Total number of traffic class * @num_ports: Total number of ports on device * * Configure HW Rx command monitor as part of DCB configuration. **/ void i40e_dcb_hw_rx_cmd_monitor_config(struct i40e_hw *hw, u8 num_tc, u8 num_ports) { … } /** * i40e_dcb_hw_pfc_config * @hw: pointer to the hw struct * @pfc_en: Bitmap of PFC enabled priorities * @prio_tc: priority to tc assignment indexed by priority * * Configure HW Priority Flow Controller as part of DCB configuration. **/ void i40e_dcb_hw_pfc_config(struct i40e_hw *hw, u8 pfc_en, u8 *prio_tc) { … } /** * i40e_dcb_hw_set_num_tc * @hw: pointer to the hw struct * @num_tc: number of traffic classes * * Configure number of traffic classes in HW **/ void i40e_dcb_hw_set_num_tc(struct i40e_hw *hw, u8 num_tc) { … } /** * i40e_dcb_hw_get_num_tc * @hw: pointer to the hw struct * * Returns number of traffic classes configured in HW **/ u8 i40e_dcb_hw_get_num_tc(struct i40e_hw *hw) { … } /** * i40e_dcb_hw_rx_ets_bw_config * @hw: pointer to the hw struct * @bw_share: Bandwidth share indexed per traffic class * @mode: Strict Priority or Round Robin mode between UP sharing same * traffic class * @prio_type: TC is ETS enabled or strict priority * * Configure HW Rx ETS bandwidth as part of DCB configuration. **/ void i40e_dcb_hw_rx_ets_bw_config(struct i40e_hw *hw, u8 *bw_share, u8 *mode, u8 *prio_type) { … } /** * i40e_dcb_hw_rx_up2tc_config * @hw: pointer to the hw struct * @prio_tc: priority to tc assignment indexed by priority * * Configure HW Rx UP2TC map as part of DCB configuration. **/ void i40e_dcb_hw_rx_up2tc_config(struct i40e_hw *hw, u8 *prio_tc) { … } /** * i40e_dcb_hw_calculate_pool_sizes - configure dcb pool sizes * @hw: pointer to the hw struct * @num_ports: Number of available ports on the device * @eee_enabled: EEE enabled for the given port * @pfc_en: Bit map of PFC enabled traffic classes * @mfs_tc: Array of max frame size for each traffic class * @pb_cfg: pointer to packet buffer configuration * * Calculate the shared and dedicated per TC pool sizes, * watermarks and threshold values. **/ void i40e_dcb_hw_calculate_pool_sizes(struct i40e_hw *hw, u8 num_ports, bool eee_enabled, u8 pfc_en, u32 *mfs_tc, struct i40e_rx_pb_config *pb_cfg) { … } /** * i40e_dcb_hw_rx_pb_config * @hw: pointer to the hw struct * @old_pb_cfg: Existing Rx Packet buffer configuration * @new_pb_cfg: New Rx Packet buffer configuration * * Program the Rx Packet Buffer registers. **/ void i40e_dcb_hw_rx_pb_config(struct i40e_hw *hw, struct i40e_rx_pb_config *old_pb_cfg, struct i40e_rx_pb_config *new_pb_cfg) { … } /** * _i40e_read_lldp_cfg - generic read of LLDP Configuration data from NVM * @hw: pointer to the HW structure * @lldp_cfg: pointer to hold lldp configuration variables * @module: address of the module pointer * @word_offset: offset of LLDP configuration * * Reads the LLDP configuration data from NVM using passed addresses **/ static int _i40e_read_lldp_cfg(struct i40e_hw *hw, struct i40e_lldp_variables *lldp_cfg, u8 module, u32 word_offset) { … } /** * i40e_read_lldp_cfg - read LLDP Configuration data from NVM * @hw: pointer to the HW structure * @lldp_cfg: pointer to hold lldp configuration variables * * Reads the LLDP configuration data from NVM **/ int i40e_read_lldp_cfg(struct i40e_hw *hw, struct i40e_lldp_variables *lldp_cfg) { … }