diff options
author | Vladislav Zolotarov <vladz@broadcom.com> | 2010-12-13 00:44:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-16 16:15:55 -0500 |
commit | e4901dde12d92b70dd13fa8b3bbc9df7a6129aab (patch) | |
tree | da436a7a43cf5f212485cc9691592d90e01478db /drivers/net/bnx2x/bnx2x_dcb.h | |
parent | 8307fa3e86a83924dd7f8310ce1e051f34986fe8 (diff) |
bnx2x: add DCB support
Adding DCB initialization and handling on 57712 FW/HW
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Shmulik Ravid-Rabinovitz <shmulikr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_dcb.h')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_dcb.h | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/drivers/net/bnx2x/bnx2x_dcb.h b/drivers/net/bnx2x/bnx2x_dcb.h new file mode 100644 index 000000000000..8dea56b511f5 --- /dev/null +++ b/drivers/net/bnx2x/bnx2x_dcb.h | |||
@@ -0,0 +1,193 @@ | |||
1 | /* bnx2x_dcb.h: Broadcom Everest network driver. | ||
2 | * | ||
3 | * Copyright 2009-2010 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 <eilong@broadcom.com> | ||
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 */ | ||
25 | struct bnx2x_dcbx_app_params { | ||
26 | u32 enabled; | ||
27 | u32 traffic_type_priority[LLFC_DRIVER_TRAFFIC_TYPE_MAX]; | ||
28 | }; | ||
29 | |||
30 | #define E2_NUM_OF_COS 2 | ||
31 | #define BNX2X_DCBX_COS_NOT_STRICT 0 | ||
32 | #define BNX2X_DCBX_COS_LOW_STRICT 1 | ||
33 | #define BNX2X_DCBX_COS_HIGH_STRICT 2 | ||
34 | |||
35 | struct bnx2x_dcbx_cos_params { | ||
36 | u32 bw_tbl; | ||
37 | u32 pri_bitmask; | ||
38 | u8 strict; | ||
39 | u8 pauseable; | ||
40 | }; | ||
41 | |||
42 | struct bnx2x_dcbx_pg_params { | ||
43 | u32 enabled; | ||
44 | u8 num_of_cos; /* valid COS entries */ | ||
45 | struct bnx2x_dcbx_cos_params cos_params[E2_NUM_OF_COS]; | ||
46 | }; | ||
47 | |||
48 | struct bnx2x_dcbx_pfc_params { | ||
49 | u32 enabled; | ||
50 | u32 priority_non_pauseable_mask; | ||
51 | }; | ||
52 | |||
53 | struct bnx2x_dcbx_port_params { | ||
54 | u32 dcbx_enabled; | ||
55 | struct bnx2x_dcbx_pfc_params pfc; | ||
56 | struct bnx2x_dcbx_pg_params ets; | ||
57 | struct bnx2x_dcbx_app_params app; | ||
58 | }; | ||
59 | |||
60 | #define BNX2X_DCBX_CONFIG_INV_VALUE (0xFFFFFFFF) | ||
61 | #define BNX2X_DCBX_OVERWRITE_SETTINGS_DISABLE 0 | ||
62 | #define BNX2X_DCBX_OVERWRITE_SETTINGS_ENABLE 1 | ||
63 | #define BNX2X_DCBX_OVERWRITE_SETTINGS_INVALID (BNX2X_DCBX_CONFIG_INV_VALUE) | ||
64 | |||
65 | /******************************************************************************* | ||
66 | * LLDP protocol configuration parameters. | ||
67 | ******************************************************************************/ | ||
68 | struct bnx2x_config_lldp_params { | ||
69 | u32 overwrite_settings; | ||
70 | u32 msg_tx_hold; | ||
71 | u32 msg_fast_tx; | ||
72 | u32 tx_credit_max; | ||
73 | u32 msg_tx_interval; | ||
74 | u32 tx_fast; | ||
75 | }; | ||
76 | |||
77 | struct bnx2x_admin_priority_app_table { | ||
78 | u32 valid; | ||
79 | u32 priority; | ||
80 | #define INVALID_TRAFFIC_TYPE_PRIORITY (0xFFFFFFFF) | ||
81 | u32 traffic_type; | ||
82 | #define TRAFFIC_TYPE_ETH 0 | ||
83 | #define TRAFFIC_TYPE_PORT 1 | ||
84 | u32 app_id; | ||
85 | }; | ||
86 | |||
87 | /******************************************************************************* | ||
88 | * DCBX protocol configuration parameters. | ||
89 | ******************************************************************************/ | ||
90 | struct bnx2x_config_dcbx_params { | ||
91 | u32 dcb_enable; | ||
92 | u32 admin_dcbx_enable; | ||
93 | u32 overwrite_settings; | ||
94 | u32 admin_dcbx_version; | ||
95 | u32 admin_ets_enable; | ||
96 | u32 admin_pfc_enable; | ||
97 | u32 admin_tc_supported_tx_enable; | ||
98 | u32 admin_ets_configuration_tx_enable; | ||
99 | u32 admin_ets_recommendation_tx_enable; | ||
100 | u32 admin_pfc_tx_enable; | ||
101 | u32 admin_application_priority_tx_enable; | ||
102 | u32 admin_ets_willing; | ||
103 | u32 admin_ets_reco_valid; | ||
104 | u32 admin_pfc_willing; | ||
105 | u32 admin_app_priority_willing; | ||
106 | u32 admin_configuration_bw_precentage[8]; | ||
107 | u32 admin_configuration_ets_pg[8]; | ||
108 | u32 admin_recommendation_bw_precentage[8]; | ||
109 | u32 admin_recommendation_ets_pg[8]; | ||
110 | u32 admin_pfc_bitmap; | ||
111 | struct bnx2x_admin_priority_app_table admin_priority_app_table[4]; | ||
112 | u32 admin_default_priority; | ||
113 | }; | ||
114 | |||
115 | #define GET_FLAGS(flags, bits) ((flags) & (bits)) | ||
116 | #define SET_FLAGS(flags, bits) ((flags) |= (bits)) | ||
117 | #define RESET_FLAGS(flags, bits) ((flags) &= ~(bits)) | ||
118 | |||
119 | enum { | ||
120 | DCBX_READ_LOCAL_MIB, | ||
121 | DCBX_READ_REMOTE_MIB | ||
122 | }; | ||
123 | |||
124 | #define ETH_TYPE_FCOE (0x8906) | ||
125 | #define TCP_PORT_ISCSI (0xCBC) | ||
126 | |||
127 | #define PFC_VALUE_FRAME_SIZE (512) | ||
128 | #define PFC_QUANTA_IN_NANOSEC_FROM_SPEED_MEGA(mega_speed) \ | ||
129 | ((1000 * PFC_VALUE_FRAME_SIZE)/(mega_speed)) | ||
130 | |||
131 | #define PFC_BRB1_REG_HIGH_LLFC_LOW_THRESHOLD 130 | ||
132 | #define PFC_BRB1_REG_HIGH_LLFC_HIGH_THRESHOLD 170 | ||
133 | |||
134 | |||
135 | |||
136 | struct cos_entry_help_data { | ||
137 | u32 pri_join_mask; | ||
138 | u32 cos_bw; | ||
139 | u8 strict; | ||
140 | bool pausable; | ||
141 | }; | ||
142 | |||
143 | struct cos_help_data { | ||
144 | struct cos_entry_help_data data[E2_NUM_OF_COS]; | ||
145 | u8 num_of_cos; | ||
146 | }; | ||
147 | |||
148 | #define DCBX_ILLEGAL_PG (0xFF) | ||
149 | #define DCBX_PFC_PRI_MASK (0xFF) | ||
150 | #define DCBX_STRICT_PRIORITY (15) | ||
151 | #define DCBX_INVALID_COS_BW (0xFFFFFFFF) | ||
152 | #define DCBX_PFC_PRI_NON_PAUSE_MASK(bp) \ | ||
153 | ((bp)->dcbx_port_params.pfc.priority_non_pauseable_mask) | ||
154 | #define DCBX_PFC_PRI_PAUSE_MASK(bp) \ | ||
155 | ((u8)~DCBX_PFC_PRI_NON_PAUSE_MASK(bp)) | ||
156 | #define DCBX_PFC_PRI_GET_PAUSE(bp, pg_pri) \ | ||
157 | ((pg_pri) & (DCBX_PFC_PRI_PAUSE_MASK(bp))) | ||
158 | #define DCBX_PFC_PRI_GET_NON_PAUSE(bp, pg_pri) \ | ||
159 | (DCBX_PFC_PRI_NON_PAUSE_MASK(bp) & (pg_pri)) | ||
160 | #define IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pg_pri) \ | ||
161 | (pg_pri == DCBX_PFC_PRI_GET_PAUSE((bp), (pg_pri))) | ||
162 | #define IS_DCBX_PFC_PRI_ONLY_NON_PAUSE(bp, pg_pri)\ | ||
163 | ((pg_pri) == DCBX_PFC_PRI_GET_NON_PAUSE((bp), (pg_pri))) | ||
164 | #define IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pg_pri) \ | ||
165 | (!(IS_DCBX_PFC_PRI_ONLY_NON_PAUSE((bp), (pg_pri)) || \ | ||
166 | IS_DCBX_PFC_PRI_ONLY_PAUSE((bp), (pg_pri)))) | ||
167 | |||
168 | |||
169 | struct pg_entry_help_data { | ||
170 | u8 num_of_dif_pri; | ||
171 | u8 pg; | ||
172 | u32 pg_priority; | ||
173 | }; | ||
174 | |||
175 | struct pg_help_data { | ||
176 | struct pg_entry_help_data data[LLFC_DRIVER_TRAFFIC_TYPE_MAX]; | ||
177 | u8 num_of_pg; | ||
178 | }; | ||
179 | |||
180 | /* forward DCB/PFC related declarations */ | ||
181 | struct bnx2x; | ||
182 | void bnx2x_dcb_init_intmem_pfc(struct bnx2x *bp); | ||
183 | void bnx2x_dcbx_update(struct work_struct *work); | ||
184 | void bnx2x_dcbx_init_params(struct bnx2x *bp); | ||
185 | |||
186 | enum { | ||
187 | BNX2X_DCBX_STATE_NEG_RECEIVED = 0x1, | ||
188 | BNX2X_DCBX_STATE_TX_PAUSED = 0x2, | ||
189 | BNX2X_DCBX_STATE_TX_RELEASED = 0x4 | ||
190 | }; | ||
191 | void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state); | ||
192 | |||
193 | #endif /* BNX2X_DCB_H */ | ||