Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bnx2x_dcb.h
Go to the documentation of this file.
1 /* bnx2x_dcb.h: Broadcom Everest network driver.
2  *
3  * Copyright 2009-2012 Broadcom Corporation
4  *
5  * Unless you and Broadcom execute a separate written software license
6  * agreement governing use of this software, this software is licensed to you
7  * under the terms of the GNU General Public License version 2, available
8  * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL").
9  *
10  * Notwithstanding the above, under no circumstances may you combine this
11  * software in any way with any other Broadcom software provided under a
12  * license other than the GPL, without Broadcom's express prior written
13  * consent.
14  *
15  * Maintained by: Eilon Greenstein <[email protected]>
16  * Written by: Dmitry Kravkov
17  *
18  */
19 #ifndef BNX2X_DCB_H
20 #define BNX2X_DCB_H
21 
22 #include "bnx2x_hsi.h"
23 
24 #define LLFC_DRIVER_TRAFFIC_TYPE_MAX 3 /* NW, iSCSI, FCoE */
28 };
29 
30 #define DCBX_COS_MAX_NUM_E2 DCBX_E2E3_MAX_NUM_COS
31 /* bnx2x currently limits numbers of supported COSes to 3 to be extended to 6 */
32 #define BNX2X_MAX_COS_SUPPORT 3
33 #define DCBX_COS_MAX_NUM_E3B0 BNX2X_MAX_COS_SUPPORT
34 #define DCBX_COS_MAX_NUM BNX2X_MAX_COS_SUPPORT
35 
39  /*
40  * strict priority: valid values are 0..5; 0 is highest priority.
41  * There can't be two COSes with the same priority.
42  */
44 #define BNX2X_DCBX_STRICT_INVALID DCBX_COS_MAX_NUM
45 #define BNX2X_DCBX_STRICT_COS_HIGHEST 0
46 #define BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(sp) ((sp) + 1)
48 };
49 
52  u8 num_of_cos; /* valid COS entries */
54 };
55 
59 };
60 
65 };
66 
67 #define BNX2X_DCBX_CONFIG_INV_VALUE (0xFFFFFFFF)
68 #define BNX2X_DCBX_OVERWRITE_SETTINGS_DISABLE 0
69 #define BNX2X_DCBX_OVERWRITE_SETTINGS_ENABLE 1
70 #define BNX2X_DCBX_OVERWRITE_SETTINGS_INVALID (BNX2X_DCBX_CONFIG_INV_VALUE)
71 #define BNX2X_IS_ETS_ENABLED(bp) ((bp)->dcb_state == BNX2X_DCB_STATE_ON &&\
72  (bp)->dcbx_port_params.ets.enabled)
73 
81 };
82 
86 #define INVALID_TRAFFIC_TYPE_PRIORITY (0xFFFFFFFF)
88 #define TRAFFIC_TYPE_ETH 0
89 #define TRAFFIC_TYPE_PORT 1
91 };
92 
93 #define DCBX_CONFIG_MAX_APP_PROTOCOL 4
116 };
117 
118 #define GET_FLAGS(flags, bits) ((flags) & (bits))
119 #define SET_FLAGS(flags, bits) ((flags) |= (bits))
120 #define RESET_FLAGS(flags, bits) ((flags) &= ~(bits))
121 
122 enum {
125 };
126 
127 #define ETH_TYPE_FCOE (0x8906)
128 #define TCP_PORT_ISCSI (0xCBC)
129 
130 #define PFC_VALUE_FRAME_SIZE (512)
131 #define PFC_QUANTA_IN_NANOSEC_FROM_SPEED_MEGA(mega_speed) \
132  ((1000 * PFC_VALUE_FRAME_SIZE)/(mega_speed))
133 
134 #define PFC_BRB1_REG_HIGH_LLFC_LOW_THRESHOLD 130
135 #define PFC_BRB1_REG_HIGH_LLFC_HIGH_THRESHOLD 170
136 
137 
138 
143  bool pausable;
144 };
145 
149 };
150 
151 #define DCBX_ILLEGAL_PG (0xFF)
152 #define DCBX_PFC_PRI_MASK (0xFF)
153 #define DCBX_STRICT_PRIORITY (15)
154 #define DCBX_INVALID_COS_BW (0xFFFFFFFF)
155 #define DCBX_PFC_PRI_NON_PAUSE_MASK(bp) \
156  ((bp)->dcbx_port_params.pfc.priority_non_pauseable_mask)
157 #define DCBX_PFC_PRI_PAUSE_MASK(bp) \
158  ((u8)~DCBX_PFC_PRI_NON_PAUSE_MASK(bp))
159 #define DCBX_PFC_PRI_GET_PAUSE(bp, pg_pri) \
160  ((pg_pri) & (DCBX_PFC_PRI_PAUSE_MASK(bp)))
161 #define DCBX_PFC_PRI_GET_NON_PAUSE(bp, pg_pri) \
162  (DCBX_PFC_PRI_NON_PAUSE_MASK(bp) & (pg_pri))
163 #define DCBX_IS_PFC_PRI_SOME_PAUSE(bp, pg_pri) \
164  (0 != DCBX_PFC_PRI_GET_PAUSE(bp, pg_pri))
165 #define IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pg_pri) \
166  (pg_pri == DCBX_PFC_PRI_GET_PAUSE((bp), (pg_pri)))
167 #define IS_DCBX_PFC_PRI_ONLY_NON_PAUSE(bp, pg_pri)\
168  ((pg_pri) == DCBX_PFC_PRI_GET_NON_PAUSE((bp), (pg_pri)))
169 #define IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pg_pri) \
170  (!(IS_DCBX_PFC_PRI_ONLY_NON_PAUSE((bp), (pg_pri)) || \
171  IS_DCBX_PFC_PRI_ONLY_PAUSE((bp), (pg_pri))))
172 
173 
178 };
179 
180 struct pg_help_data {
183 };
184 
185 /* forward DCB/PFC related declarations */
186 struct bnx2x;
187 void bnx2x_dcbx_update(struct work_struct *work);
188 void bnx2x_dcbx_init_params(struct bnx2x *bp);
189 void bnx2x_dcbx_set_state(struct bnx2x *bp, bool dcb_on, u32 dcbx_enabled);
190 
191 enum {
195 };
196 
197 void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state);
198 void bnx2x_dcbx_pmf_update(struct bnx2x *bp);
199 /* DCB netlink */
200 #ifdef BCM_DCBNL
201 extern const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops;
202 int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall);
203 #endif /* BCM_DCBNL */
204 
205 #endif /* BNX2X_DCB_H */