1 /*******************************************************************************
3 Copyright (c) 2013 - 2015, Intel Corporation
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
32 ***************************************************************************/
37 #include "i40e_type.h"
39 #define I40E_DCBX_OFFLOAD_DISABLED 0
40 #define I40E_DCBX_OFFLOAD_ENABLED 1
42 #define I40E_DCBX_STATUS_NOT_STARTED 0
43 #define I40E_DCBX_STATUS_IN_PROGRESS 1
44 #define I40E_DCBX_STATUS_DONE 2
45 #define I40E_DCBX_STATUS_MULTIPLE_PEERS 3
46 #define I40E_DCBX_STATUS_DISABLED 7
48 #define I40E_TLV_TYPE_END 0
49 #define I40E_TLV_TYPE_ORG 127
51 #define I40E_IEEE_8021QAZ_OUI 0x0080C2
52 #define I40E_IEEE_SUBTYPE_ETS_CFG 9
53 #define I40E_IEEE_SUBTYPE_ETS_REC 10
54 #define I40E_IEEE_SUBTYPE_PFC_CFG 11
55 #define I40E_IEEE_SUBTYPE_APP_PRI 12
57 #define I40E_LLDP_ADMINSTATUS_DISABLED 0
58 #define I40E_LLDP_ADMINSTATUS_ENABLED_RX 1
59 #define I40E_LLDP_ADMINSTATUS_ENABLED_TX 2
60 #define I40E_LLDP_ADMINSTATUS_ENABLED_RXTX 3
62 /* Defines for LLDP TLV header */
63 #define I40E_LLDP_MIB_HLEN 14
64 #define I40E_LLDP_TLV_LEN_SHIFT 0
65 #define I40E_LLDP_TLV_LEN_MASK (0x01FF << I40E_LLDP_TLV_LEN_SHIFT)
66 #define I40E_LLDP_TLV_TYPE_SHIFT 9
67 #define I40E_LLDP_TLV_TYPE_MASK (0x7F << I40E_LLDP_TLV_TYPE_SHIFT)
68 #define I40E_LLDP_TLV_SUBTYPE_SHIFT 0
69 #define I40E_LLDP_TLV_SUBTYPE_MASK (0xFF << I40E_LLDP_TLV_SUBTYPE_SHIFT)
70 #define I40E_LLDP_TLV_OUI_SHIFT 8
71 #define I40E_LLDP_TLV_OUI_MASK (0xFFFFFF << I40E_LLDP_TLV_OUI_SHIFT)
73 /* Defines for IEEE ETS TLV */
74 #define I40E_IEEE_ETS_MAXTC_SHIFT 0
75 #define I40E_IEEE_ETS_MAXTC_MASK (0x7 << I40E_IEEE_ETS_MAXTC_SHIFT)
76 #define I40E_IEEE_ETS_CBS_SHIFT 6
77 #define I40E_IEEE_ETS_CBS_MASK (0x1 << I40E_IEEE_ETS_CBS_SHIFT)
78 #define I40E_IEEE_ETS_WILLING_SHIFT 7
79 #define I40E_IEEE_ETS_WILLING_MASK (0x1 << I40E_IEEE_ETS_WILLING_SHIFT)
80 #define I40E_IEEE_ETS_PRIO_0_SHIFT 0
81 #define I40E_IEEE_ETS_PRIO_0_MASK (0x7 << I40E_IEEE_ETS_PRIO_0_SHIFT)
82 #define I40E_IEEE_ETS_PRIO_1_SHIFT 4
83 #define I40E_IEEE_ETS_PRIO_1_MASK (0x7 << I40E_IEEE_ETS_PRIO_1_SHIFT)
84 #define I40E_CEE_PGID_PRIO_0_SHIFT 0
85 #define I40E_CEE_PGID_PRIO_0_MASK (0xF << I40E_CEE_PGID_PRIO_0_SHIFT)
86 #define I40E_CEE_PGID_PRIO_1_SHIFT 4
87 #define I40E_CEE_PGID_PRIO_1_MASK (0xF << I40E_CEE_PGID_PRIO_1_SHIFT)
88 #define I40E_CEE_PGID_STRICT 15
90 /* Defines for IEEE TSA types */
91 #define I40E_IEEE_TSA_STRICT 0
92 #define I40E_IEEE_TSA_CBS 1
93 #define I40E_IEEE_TSA_ETS 2
94 #define I40E_IEEE_TSA_VENDOR 255
96 /* Defines for IEEE PFC TLV */
97 #define I40E_IEEE_PFC_CAP_SHIFT 0
98 #define I40E_IEEE_PFC_CAP_MASK (0xF << I40E_IEEE_PFC_CAP_SHIFT)
99 #define I40E_IEEE_PFC_MBC_SHIFT 6
100 #define I40E_IEEE_PFC_MBC_MASK (0x1 << I40E_IEEE_PFC_MBC_SHIFT)
101 #define I40E_IEEE_PFC_WILLING_SHIFT 7
102 #define I40E_IEEE_PFC_WILLING_MASK (0x1 << I40E_IEEE_PFC_WILLING_SHIFT)
104 /* Defines for IEEE APP TLV */
105 #define I40E_IEEE_APP_SEL_SHIFT 0
106 #define I40E_IEEE_APP_SEL_MASK (0x7 << I40E_IEEE_APP_SEL_SHIFT)
107 #define I40E_IEEE_APP_PRIO_SHIFT 5
108 #define I40E_IEEE_APP_PRIO_MASK (0x7 << I40E_IEEE_APP_PRIO_SHIFT)
110 /* TLV definitions for preparing MIB */
111 #define I40E_TLV_ID_CHASSIS_ID 0
112 #define I40E_TLV_ID_PORT_ID 1
113 #define I40E_TLV_ID_TIME_TO_LIVE 2
114 #define I40E_IEEE_TLV_ID_ETS_CFG 3
115 #define I40E_IEEE_TLV_ID_ETS_REC 4
116 #define I40E_IEEE_TLV_ID_PFC_CFG 5
117 #define I40E_IEEE_TLV_ID_APP_PRI 6
118 #define I40E_TLV_ID_END_OF_LLDPPDU 7
119 #define I40E_TLV_ID_START I40E_IEEE_TLV_ID_ETS_CFG
121 #define I40E_IEEE_ETS_TLV_LENGTH 25
122 #define I40E_IEEE_PFC_TLV_LENGTH 6
123 #define I40E_IEEE_APP_TLV_LENGTH 11
127 /* IEEE 802.1AB LLDP TLV structure */
128 struct i40e_lldp_generic_tlv {
133 /* IEEE 802.1AB LLDP Organization specific TLV */
134 struct i40e_lldp_org_tlv {
142 * TODO: The below structures related LLDP/DCBX variables
143 * and statistics are defined but need to find how to get
144 * the required information from the Firmware to use them
147 /* IEEE 802.1AB LLDP Agent Statistics */
148 struct i40e_lldp_stats {
149 u64 remtablelastchangetime;
155 u64 rxframesdiscarded;
156 u64 rxportframeerrors;
157 u64 rxportframestotal;
158 u64 rxporttlvsdiscardedtotal;
159 u64 rxporttlvsunrecognizedtotal;
160 u64 remtoomanyneighbors;
163 /* IEEE 802.1Qaz DCBX variables */
164 struct i40e_dcbx_variables {
165 u32 defmaxtrafficclasses;
166 u32 defprioritytcmapping;
168 u32 deftsaassignment;
171 enum i40e_status_code i40e_get_dcbx_status(struct i40e_hw *hw,
173 enum i40e_status_code i40e_lldp_to_dcb_config(u8 *lldpmib,
174 struct i40e_dcbx_config *dcbcfg);
175 enum i40e_status_code i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
177 struct i40e_dcbx_config *dcbcfg);
178 enum i40e_status_code i40e_get_dcb_config(struct i40e_hw *hw);
179 enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw);
181 #endif /* _I40E_DCB_H_ */