0001
0002
0003
0004 #ifndef _ICE_DCB_H_
0005 #define _ICE_DCB_H_
0006
0007 #include "ice_type.h"
0008 #include <scsi/iscsi_proto.h>
0009
0010 #define ICE_DCBX_STATUS_NOT_STARTED 0
0011 #define ICE_DCBX_STATUS_IN_PROGRESS 1
0012 #define ICE_DCBX_STATUS_DONE 2
0013 #define ICE_DCBX_STATUS_DIS 7
0014
0015 #define ICE_TLV_TYPE_END 0
0016 #define ICE_TLV_TYPE_ORG 127
0017
0018 #define ICE_IEEE_8021QAZ_OUI 0x0080C2
0019 #define ICE_IEEE_SUBTYPE_ETS_CFG 9
0020 #define ICE_IEEE_SUBTYPE_ETS_REC 10
0021 #define ICE_IEEE_SUBTYPE_PFC_CFG 11
0022 #define ICE_IEEE_SUBTYPE_APP_PRI 12
0023
0024 #define ICE_CEE_DCBX_OUI 0x001B21
0025 #define ICE_CEE_DCBX_TYPE 2
0026
0027 #define ICE_DSCP_OUI 0xFFFFFF
0028 #define ICE_DSCP_SUBTYPE_DSCP2UP 0x41
0029 #define ICE_DSCP_SUBTYPE_ENFORCE 0x42
0030 #define ICE_DSCP_SUBTYPE_TCBW 0x43
0031 #define ICE_DSCP_SUBTYPE_PFC 0x44
0032 #define ICE_DSCP_IPV6_OFFSET 80
0033
0034 #define ICE_CEE_SUBTYPE_PG_CFG 2
0035 #define ICE_CEE_SUBTYPE_PFC_CFG 3
0036 #define ICE_CEE_SUBTYPE_APP_PRI 4
0037 #define ICE_CEE_MAX_FEAT_TYPE 3
0038
0039 #define ICE_LLDP_TLV_LEN_S 0
0040 #define ICE_LLDP_TLV_LEN_M (0x01FF << ICE_LLDP_TLV_LEN_S)
0041 #define ICE_LLDP_TLV_TYPE_S 9
0042 #define ICE_LLDP_TLV_TYPE_M (0x7F << ICE_LLDP_TLV_TYPE_S)
0043 #define ICE_LLDP_TLV_SUBTYPE_S 0
0044 #define ICE_LLDP_TLV_SUBTYPE_M (0xFF << ICE_LLDP_TLV_SUBTYPE_S)
0045 #define ICE_LLDP_TLV_OUI_S 8
0046 #define ICE_LLDP_TLV_OUI_M (0xFFFFFFUL << ICE_LLDP_TLV_OUI_S)
0047
0048
0049 #define ICE_IEEE_ETS_MAXTC_S 0
0050 #define ICE_IEEE_ETS_MAXTC_M (0x7 << ICE_IEEE_ETS_MAXTC_S)
0051 #define ICE_IEEE_ETS_CBS_S 6
0052 #define ICE_IEEE_ETS_CBS_M BIT(ICE_IEEE_ETS_CBS_S)
0053 #define ICE_IEEE_ETS_WILLING_S 7
0054 #define ICE_IEEE_ETS_WILLING_M BIT(ICE_IEEE_ETS_WILLING_S)
0055 #define ICE_IEEE_ETS_PRIO_0_S 0
0056 #define ICE_IEEE_ETS_PRIO_0_M (0x7 << ICE_IEEE_ETS_PRIO_0_S)
0057 #define ICE_IEEE_ETS_PRIO_1_S 4
0058 #define ICE_IEEE_ETS_PRIO_1_M (0x7 << ICE_IEEE_ETS_PRIO_1_S)
0059 #define ICE_CEE_PGID_PRIO_0_S 0
0060 #define ICE_CEE_PGID_PRIO_0_M (0xF << ICE_CEE_PGID_PRIO_0_S)
0061 #define ICE_CEE_PGID_PRIO_1_S 4
0062 #define ICE_CEE_PGID_PRIO_1_M (0xF << ICE_CEE_PGID_PRIO_1_S)
0063 #define ICE_CEE_PGID_STRICT 15
0064
0065
0066 #define ICE_IEEE_TSA_STRICT 0
0067 #define ICE_IEEE_TSA_ETS 2
0068
0069
0070 #define ICE_IEEE_PFC_CAP_S 0
0071 #define ICE_IEEE_PFC_CAP_M (0xF << ICE_IEEE_PFC_CAP_S)
0072 #define ICE_IEEE_PFC_MBC_S 6
0073 #define ICE_IEEE_PFC_MBC_M BIT(ICE_IEEE_PFC_MBC_S)
0074 #define ICE_IEEE_PFC_WILLING_S 7
0075 #define ICE_IEEE_PFC_WILLING_M BIT(ICE_IEEE_PFC_WILLING_S)
0076
0077
0078 #define ICE_IEEE_APP_SEL_S 0
0079 #define ICE_IEEE_APP_SEL_M (0x7 << ICE_IEEE_APP_SEL_S)
0080 #define ICE_IEEE_APP_PRIO_S 5
0081 #define ICE_IEEE_APP_PRIO_M (0x7 << ICE_IEEE_APP_PRIO_S)
0082
0083
0084 #define ICE_IEEE_TLV_ID_ETS_CFG 3
0085 #define ICE_IEEE_TLV_ID_ETS_REC 4
0086 #define ICE_IEEE_TLV_ID_PFC_CFG 5
0087 #define ICE_IEEE_TLV_ID_APP_PRI 6
0088 #define ICE_TLV_ID_END_OF_LLDPPDU 7
0089 #define ICE_TLV_ID_START ICE_IEEE_TLV_ID_ETS_CFG
0090 #define ICE_TLV_ID_DSCP_UP 3
0091 #define ICE_TLV_ID_DSCP_ENF 4
0092 #define ICE_TLV_ID_DSCP_TC_BW 5
0093 #define ICE_TLV_ID_DSCP_TO_PFC 6
0094
0095 #define ICE_IEEE_ETS_TLV_LEN 25
0096 #define ICE_IEEE_PFC_TLV_LEN 6
0097 #define ICE_IEEE_APP_TLV_LEN 11
0098
0099 #define ICE_DSCP_UP_TLV_LEN 148
0100 #define ICE_DSCP_ENF_TLV_LEN 132
0101 #define ICE_DSCP_TC_BW_TLV_LEN 25
0102 #define ICE_DSCP_PFC_TLV_LEN 6
0103
0104
0105 struct ice_lldp_org_tlv {
0106 __be16 typelen;
0107 __be32 ouisubtype;
0108 u8 tlvinfo[];
0109 } __packed;
0110
0111 struct ice_cee_tlv_hdr {
0112 __be16 typelen;
0113 u8 operver;
0114 u8 maxver;
0115 };
0116
0117 struct ice_cee_ctrl_tlv {
0118 struct ice_cee_tlv_hdr hdr;
0119 __be32 seqno;
0120 __be32 ackno;
0121 };
0122
0123 struct ice_cee_feat_tlv {
0124 struct ice_cee_tlv_hdr hdr;
0125 u8 en_will_err;
0126 #define ICE_CEE_FEAT_TLV_ENA_M 0x80
0127 #define ICE_CEE_FEAT_TLV_WILLING_M 0x40
0128 #define ICE_CEE_FEAT_TLV_ERR_M 0x20
0129 u8 subtype;
0130 u8 tlvinfo[];
0131 };
0132
0133 struct ice_cee_app_prio {
0134 __be16 protocol;
0135 u8 upper_oui_sel;
0136 #define ICE_CEE_APP_SELECTOR_M 0x03
0137 __be16 lower_oui;
0138 u8 prio_map;
0139 } __packed;
0140
0141 int ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd);
0142 int
0143 ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
0144 struct ice_dcbx_cfg *dcbcfg);
0145 int ice_get_dcb_cfg(struct ice_port_info *pi);
0146 int ice_set_dcb_cfg(struct ice_port_info *pi);
0147 int ice_init_dcb(struct ice_hw *hw, bool enable_mib_change);
0148 int
0149 ice_query_port_ets(struct ice_port_info *pi,
0150 struct ice_aqc_port_ets_elem *buf, u16 buf_size,
0151 struct ice_sq_cd *cmd_details);
0152 #ifdef CONFIG_DCB
0153 int
0154 ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,
0155 struct ice_sq_cd *cd);
0156 int ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd);
0157 int
0158 ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
0159 bool *dcbx_agent_status, struct ice_sq_cd *cd);
0160 int ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib);
0161 #else
0162 static inline int
0163 ice_aq_stop_lldp(struct ice_hw __always_unused *hw,
0164 bool __always_unused shutdown_lldp_agent,
0165 bool __always_unused persist,
0166 struct ice_sq_cd __always_unused *cd)
0167 {
0168 return 0;
0169 }
0170
0171 static inline int
0172 ice_aq_start_lldp(struct ice_hw __always_unused *hw,
0173 bool __always_unused persist,
0174 struct ice_sq_cd __always_unused *cd)
0175 {
0176 return 0;
0177 }
0178
0179 static inline int
0180 ice_aq_start_stop_dcbx(struct ice_hw __always_unused *hw,
0181 bool __always_unused start_dcbx_agent,
0182 bool *dcbx_agent_status,
0183 struct ice_sq_cd __always_unused *cd)
0184 {
0185 *dcbx_agent_status = false;
0186
0187 return 0;
0188 }
0189
0190 static inline int
0191 ice_cfg_lldp_mib_change(struct ice_hw __always_unused *hw,
0192 bool __always_unused ena_mib)
0193 {
0194 return 0;
0195 }
0196
0197 #endif
0198 #endif