201 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/* Copyright (c) 2019, Intel Corporation. */3 4#ifndef _ICE_DCB_H_5#define _ICE_DCB_H_6 7#include "ice_type.h"8#include <scsi/iscsi_proto.h>9 10#define ICE_DCBX_STATUS_NOT_STARTED 011#define ICE_DCBX_STATUS_IN_PROGRESS 112#define ICE_DCBX_STATUS_DONE 213#define ICE_DCBX_STATUS_DIS 714 15#define ICE_TLV_TYPE_END 016#define ICE_TLV_TYPE_ORG 12717 18#define ICE_IEEE_8021QAZ_OUI 0x0080C219#define ICE_IEEE_SUBTYPE_ETS_CFG 920#define ICE_IEEE_SUBTYPE_ETS_REC 1021#define ICE_IEEE_SUBTYPE_PFC_CFG 1122#define ICE_IEEE_SUBTYPE_APP_PRI 1223 24#define ICE_CEE_DCBX_OUI 0x001B2125#define ICE_CEE_DCBX_TYPE 226 27#define ICE_DSCP_OUI 0xFFFFFF28#define ICE_DSCP_SUBTYPE_DSCP2UP 0x4129#define ICE_DSCP_SUBTYPE_ENFORCE 0x4230#define ICE_DSCP_SUBTYPE_TCBW 0x4331#define ICE_DSCP_SUBTYPE_PFC 0x4432#define ICE_DSCP_IPV6_OFFSET 8033 34#define ICE_CEE_SUBTYPE_PG_CFG 235#define ICE_CEE_SUBTYPE_PFC_CFG 336#define ICE_CEE_SUBTYPE_APP_PRI 437#define ICE_CEE_MAX_FEAT_TYPE 338/* Defines for LLDP TLV header */39#define ICE_LLDP_TLV_LEN_S 040#define ICE_LLDP_TLV_LEN_M (0x01FF << ICE_LLDP_TLV_LEN_S)41#define ICE_LLDP_TLV_TYPE_S 942#define ICE_LLDP_TLV_TYPE_M (0x7F << ICE_LLDP_TLV_TYPE_S)43#define ICE_LLDP_TLV_SUBTYPE_S 044#define ICE_LLDP_TLV_SUBTYPE_M (0xFF << ICE_LLDP_TLV_SUBTYPE_S)45#define ICE_LLDP_TLV_OUI_S 846#define ICE_LLDP_TLV_OUI_M (0xFFFFFFUL << ICE_LLDP_TLV_OUI_S)47 48/* Defines for IEEE ETS TLV */49#define ICE_IEEE_ETS_MAXTC_S 050#define ICE_IEEE_ETS_MAXTC_M (0x7 << ICE_IEEE_ETS_MAXTC_S)51#define ICE_IEEE_ETS_CBS_S 652#define ICE_IEEE_ETS_CBS_M BIT(ICE_IEEE_ETS_CBS_S)53#define ICE_IEEE_ETS_WILLING_S 754#define ICE_IEEE_ETS_WILLING_M BIT(ICE_IEEE_ETS_WILLING_S)55#define ICE_IEEE_ETS_PRIO_0_S 056#define ICE_IEEE_ETS_PRIO_0_M (0x7 << ICE_IEEE_ETS_PRIO_0_S)57#define ICE_IEEE_ETS_PRIO_1_S 458#define ICE_IEEE_ETS_PRIO_1_M (0x7 << ICE_IEEE_ETS_PRIO_1_S)59#define ICE_CEE_PGID_PRIO_0_S 060#define ICE_CEE_PGID_PRIO_0_M (0xF << ICE_CEE_PGID_PRIO_0_S)61#define ICE_CEE_PGID_PRIO_1_S 462#define ICE_CEE_PGID_PRIO_1_M (0xF << ICE_CEE_PGID_PRIO_1_S)63#define ICE_CEE_PGID_STRICT 1564 65/* Defines for IEEE TSA types */66#define ICE_IEEE_TSA_STRICT 067#define ICE_IEEE_TSA_ETS 268 69/* Defines for IEEE PFC TLV */70#define ICE_IEEE_PFC_CAP_S 071#define ICE_IEEE_PFC_CAP_M (0xF << ICE_IEEE_PFC_CAP_S)72#define ICE_IEEE_PFC_MBC_S 673#define ICE_IEEE_PFC_MBC_M BIT(ICE_IEEE_PFC_MBC_S)74#define ICE_IEEE_PFC_WILLING_S 775#define ICE_IEEE_PFC_WILLING_M BIT(ICE_IEEE_PFC_WILLING_S)76 77/* Defines for IEEE APP TLV */78#define ICE_IEEE_APP_SEL_S 079#define ICE_IEEE_APP_SEL_M (0x7 << ICE_IEEE_APP_SEL_S)80#define ICE_IEEE_APP_PRIO_S 581#define ICE_IEEE_APP_PRIO_M (0x7 << ICE_IEEE_APP_PRIO_S)82 83/* TLV definitions for preparing MIB */84#define ICE_IEEE_TLV_ID_ETS_CFG 385#define ICE_IEEE_TLV_ID_ETS_REC 486#define ICE_IEEE_TLV_ID_PFC_CFG 587#define ICE_IEEE_TLV_ID_APP_PRI 688#define ICE_TLV_ID_END_OF_LLDPPDU 789#define ICE_TLV_ID_START ICE_IEEE_TLV_ID_ETS_CFG90#define ICE_TLV_ID_DSCP_UP 391#define ICE_TLV_ID_DSCP_ENF 492#define ICE_TLV_ID_DSCP_TC_BW 593#define ICE_TLV_ID_DSCP_TO_PFC 694 95#define ICE_IEEE_ETS_TLV_LEN 2596#define ICE_IEEE_PFC_TLV_LEN 697#define ICE_IEEE_APP_TLV_LEN 1198 99#define ICE_DSCP_UP_TLV_LEN 148100#define ICE_DSCP_ENF_TLV_LEN 132101#define ICE_DSCP_TC_BW_TLV_LEN 25102#define ICE_DSCP_PFC_TLV_LEN 6103 104/* IEEE 802.1AB LLDP Organization specific TLV */105struct ice_lldp_org_tlv {106 __be16 typelen;107 __be32 ouisubtype;108 u8 tlvinfo[];109} __packed;110 111struct ice_cee_tlv_hdr {112 __be16 typelen;113 u8 operver;114 u8 maxver;115};116 117struct ice_cee_ctrl_tlv {118 struct ice_cee_tlv_hdr hdr;119 __be32 seqno;120 __be32 ackno;121};122 123struct ice_cee_feat_tlv {124 struct ice_cee_tlv_hdr hdr;125 u8 en_will_err; /* Bits: |En|Will|Err|Reserved(5)| */126#define ICE_CEE_FEAT_TLV_ENA_M 0x80127#define ICE_CEE_FEAT_TLV_WILLING_M 0x40128#define ICE_CEE_FEAT_TLV_ERR_M 0x20129 u8 subtype;130 u8 tlvinfo[];131};132 133struct ice_cee_app_prio {134 __be16 protocol;135 u8 upper_oui_sel; /* Bits: |Upper OUI(6)|Selector(2)| */136#define ICE_CEE_APP_SELECTOR_M 0x03137 __be16 lower_oui;138 u8 prio_map;139} __packed;140 141int ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd);142int143ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,144 struct ice_dcbx_cfg *dcbcfg);145int ice_get_dcb_cfg(struct ice_port_info *pi);146int ice_set_dcb_cfg(struct ice_port_info *pi);147void ice_get_dcb_cfg_from_mib_change(struct ice_port_info *pi,148 struct ice_rq_event_info *event);149int ice_init_dcb(struct ice_hw *hw, bool enable_mib_change);150int151ice_query_port_ets(struct ice_port_info *pi,152 struct ice_aqc_port_ets_elem *buf, u16 buf_size,153 struct ice_sq_cd *cmd_details);154#ifdef CONFIG_DCB155int156ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,157 struct ice_sq_cd *cd);158int ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd);159int160ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,161 bool *dcbx_agent_status, struct ice_sq_cd *cd);162int ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib);163#else /* CONFIG_DCB */164static inline int165ice_aq_stop_lldp(struct ice_hw __always_unused *hw,166 bool __always_unused shutdown_lldp_agent,167 bool __always_unused persist,168 struct ice_sq_cd __always_unused *cd)169{170 return 0;171}172 173static inline int174ice_aq_start_lldp(struct ice_hw __always_unused *hw,175 bool __always_unused persist,176 struct ice_sq_cd __always_unused *cd)177{178 return 0;179}180 181static inline int182ice_aq_start_stop_dcbx(struct ice_hw __always_unused *hw,183 bool __always_unused start_dcbx_agent,184 bool *dcbx_agent_status,185 struct ice_sq_cd __always_unused *cd)186{187 *dcbx_agent_status = false;188 189 return 0;190}191 192static inline int193ice_cfg_lldp_mib_change(struct ice_hw __always_unused *hw,194 bool __always_unused ena_mib)195{196 return 0;197}198 199#endif /* CONFIG_DCB */200#endif /* _ICE_DCB_H_ */201