blob: 45cf3ceef144e3352f8e041fefa32d97a5829563 [file] [log] [blame]
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001/* bnx2x_dcb.c: Broadcom Everest network driver.
2 *
Dmitry Kravkov5de92402011-05-04 23:51:13 +00003 * Copyright 2009-2011 Broadcom Corporation
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00004 *
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#include <linux/netdevice.h>
20#include <linux/types.h>
21#include <linux/errno.h>
22
23#include "bnx2x.h"
24#include "bnx2x_cmn.h"
25#include "bnx2x_dcb.h"
26
Shmulik Ravid3c878d42011-07-07 05:11:30 -070027#ifdef BCM_DCBNL
28#include <linux/rtnetlink.h>
29#endif
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +000030
31/* forward declarations of dcbx related functions */
32static void bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp);
33static void bnx2x_pfc_set_pfc(struct bnx2x *bp);
34static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp);
35static void bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp);
36static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp,
37 u32 *set_configuration_ets_pg,
38 u32 *pri_pg_tbl);
39static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp,
40 u32 *pg_pri_orginal_spread,
41 struct pg_help_data *help_data);
42static void bnx2x_dcbx_fill_cos_params(struct bnx2x *bp,
43 struct pg_help_data *help_data,
44 struct dcbx_ets_feature *ets,
45 u32 *pg_pri_orginal_spread);
46static void bnx2x_dcbx_separate_pauseable_from_non(struct bnx2x *bp,
47 struct cos_help_data *cos_data,
48 u32 *pg_pri_orginal_spread,
49 struct dcbx_ets_feature *ets);
Dmitry Kravkovd1976b22011-06-14 01:34:42 +000050static void bnx2x_dcbx_fw_struct(struct bnx2x *bp);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +000051
52
53static void bnx2x_pfc_set(struct bnx2x *bp)
54{
55 struct bnx2x_nig_brb_pfc_port_params pfc_params = {0};
56 u32 pri_bit, val = 0;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +030057 int i;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +000058
Dmitry Kravkovd1976b22011-06-14 01:34:42 +000059 pfc_params.num_of_rx_cos_priority_mask =
60 bp->dcbx_port_params.ets.num_of_cos;
61
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +000062 /* Tx COS configuration */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +030063 for (i = 0; i < bp->dcbx_port_params.ets.num_of_cos; i++)
Dmitry Kravkovd1976b22011-06-14 01:34:42 +000064 /*
65 * We configure only the pauseable bits (non pauseable aren't
66 * configured at all) it's done to avoid false pauses from
67 * network
68 */
69 pfc_params.rx_cos_priority_mask[i] =
70 bp->dcbx_port_params.ets.cos_params[i].pri_bitmask
71 & DCBX_PFC_PRI_PAUSE_MASK(bp);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +000072
Dmitry Kravkovd1976b22011-06-14 01:34:42 +000073 /*
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +000074 * Rx COS configuration
75 * Changing PFC RX configuration .
76 * In RX COS0 will always be configured to lossy and COS1 to lossless
77 */
Dmitry Kravkovd1976b22011-06-14 01:34:42 +000078 for (i = 0 ; i < MAX_PFC_PRIORITIES ; i++) {
79 pri_bit = 1 << i;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +000080
81 if (pri_bit & DCBX_PFC_PRI_PAUSE_MASK(bp))
Dmitry Kravkovd1976b22011-06-14 01:34:42 +000082 val |= 1 << (i * 4);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +000083 }
84
85 pfc_params.pkt_priority_to_cos = val;
86
87 /* RX COS0 */
88 pfc_params.llfc_low_priority_classes = 0;
89 /* RX COS1 */
90 pfc_params.llfc_high_priority_classes = DCBX_PFC_PRI_PAUSE_MASK(bp);
91
92 /* BRB configuration */
93 pfc_params.cos0_pauseable = false;
94 pfc_params.cos1_pauseable = true;
95
96 bnx2x_acquire_phy_lock(bp);
97 bp->link_params.feature_config_flags |= FEATURE_CONFIG_PFC_ENABLED;
98 bnx2x_update_pfc(&bp->link_params, &bp->link_vars, &pfc_params);
99 bnx2x_release_phy_lock(bp);
100}
101
102static void bnx2x_pfc_clear(struct bnx2x *bp)
103{
104 struct bnx2x_nig_brb_pfc_port_params nig_params = {0};
105 nig_params.pause_enable = 1;
106#ifdef BNX2X_SAFC
107 if (bp->flags & SAFC_TX_FLAG) {
108 u32 high = 0, low = 0;
109 int i;
110
111 for (i = 0; i < BNX2X_MAX_PRIORITY; i++) {
112 if (bp->pri_map[i] == 1)
113 high |= (1 << i);
114 if (bp->pri_map[i] == 0)
115 low |= (1 << i);
116 }
117
118 nig_params.llfc_low_priority_classes = high;
119 nig_params.llfc_low_priority_classes = low;
120
121 nig_params.pause_enable = 0;
122 nig_params.llfc_enable = 1;
123 nig_params.llfc_out_en = 1;
124 }
125#endif /* BNX2X_SAFC */
126 bnx2x_acquire_phy_lock(bp);
127 bp->link_params.feature_config_flags &= ~FEATURE_CONFIG_PFC_ENABLED;
128 bnx2x_update_pfc(&bp->link_params, &bp->link_vars, &nig_params);
129 bnx2x_release_phy_lock(bp);
130}
131
132static void bnx2x_dump_dcbx_drv_param(struct bnx2x *bp,
133 struct dcbx_features *features,
134 u32 error)
135{
136 u8 i = 0;
137 DP(NETIF_MSG_LINK, "local_mib.error %x\n", error);
138
139 /* PG */
140 DP(NETIF_MSG_LINK,
141 "local_mib.features.ets.enabled %x\n", features->ets.enabled);
142 for (i = 0; i < DCBX_MAX_NUM_PG_BW_ENTRIES; i++)
143 DP(NETIF_MSG_LINK,
144 "local_mib.features.ets.pg_bw_tbl[%d] %d\n", i,
145 DCBX_PG_BW_GET(features->ets.pg_bw_tbl, i));
146 for (i = 0; i < DCBX_MAX_NUM_PRI_PG_ENTRIES; i++)
147 DP(NETIF_MSG_LINK,
148 "local_mib.features.ets.pri_pg_tbl[%d] %d\n", i,
149 DCBX_PRI_PG_GET(features->ets.pri_pg_tbl, i));
150
151 /* pfc */
152 DP(NETIF_MSG_LINK, "dcbx_features.pfc.pri_en_bitmap %x\n",
153 features->pfc.pri_en_bitmap);
154 DP(NETIF_MSG_LINK, "dcbx_features.pfc.pfc_caps %x\n",
155 features->pfc.pfc_caps);
156 DP(NETIF_MSG_LINK, "dcbx_features.pfc.enabled %x\n",
157 features->pfc.enabled);
158
159 DP(NETIF_MSG_LINK, "dcbx_features.app.default_pri %x\n",
160 features->app.default_pri);
161 DP(NETIF_MSG_LINK, "dcbx_features.app.tc_supported %x\n",
162 features->app.tc_supported);
163 DP(NETIF_MSG_LINK, "dcbx_features.app.enabled %x\n",
164 features->app.enabled);
165 for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) {
166 DP(NETIF_MSG_LINK,
167 "dcbx_features.app.app_pri_tbl[%x].app_id %x\n",
168 i, features->app.app_pri_tbl[i].app_id);
169 DP(NETIF_MSG_LINK,
170 "dcbx_features.app.app_pri_tbl[%x].pri_bitmap %x\n",
171 i, features->app.app_pri_tbl[i].pri_bitmap);
172 DP(NETIF_MSG_LINK,
173 "dcbx_features.app.app_pri_tbl[%x].appBitfield %x\n",
174 i, features->app.app_pri_tbl[i].appBitfield);
175 }
176}
177
178static void bnx2x_dcbx_get_ap_priority(struct bnx2x *bp,
179 u8 pri_bitmap,
180 u8 llfc_traf_type)
181{
182 u32 pri = MAX_PFC_PRIORITIES;
183 u32 index = MAX_PFC_PRIORITIES - 1;
184 u32 pri_mask;
185 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
186
187 /* Choose the highest priority */
188 while ((MAX_PFC_PRIORITIES == pri) && (0 != index)) {
189 pri_mask = 1 << index;
190 if (GET_FLAGS(pri_bitmap, pri_mask))
191 pri = index ;
192 index--;
193 }
194
195 if (pri < MAX_PFC_PRIORITIES)
196 ttp[llfc_traf_type] = max_t(u32, ttp[llfc_traf_type], pri);
197}
198
199static void bnx2x_dcbx_get_ap_feature(struct bnx2x *bp,
200 struct dcbx_app_priority_feature *app,
201 u32 error) {
202 u8 index;
203 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
204
205 if (GET_FLAGS(error, DCBX_LOCAL_APP_ERROR))
206 DP(NETIF_MSG_LINK, "DCBX_LOCAL_APP_ERROR\n");
207
208 if (app->enabled && !GET_FLAGS(error, DCBX_LOCAL_APP_ERROR)) {
209
210 bp->dcbx_port_params.app.enabled = true;
211
212 for (index = 0 ; index < LLFC_DRIVER_TRAFFIC_TYPE_MAX; index++)
213 ttp[index] = 0;
214
215 if (app->default_pri < MAX_PFC_PRIORITIES)
216 ttp[LLFC_TRAFFIC_TYPE_NW] = app->default_pri;
217
218 for (index = 0 ; index < DCBX_MAX_APP_PROTOCOL; index++) {
219 struct dcbx_app_priority_entry *entry =
220 app->app_pri_tbl;
221
222 if (GET_FLAGS(entry[index].appBitfield,
223 DCBX_APP_SF_ETH_TYPE) &&
224 ETH_TYPE_FCOE == entry[index].app_id)
225 bnx2x_dcbx_get_ap_priority(bp,
226 entry[index].pri_bitmap,
227 LLFC_TRAFFIC_TYPE_FCOE);
228
229 if (GET_FLAGS(entry[index].appBitfield,
230 DCBX_APP_SF_PORT) &&
231 TCP_PORT_ISCSI == entry[index].app_id)
232 bnx2x_dcbx_get_ap_priority(bp,
233 entry[index].pri_bitmap,
234 LLFC_TRAFFIC_TYPE_ISCSI);
235 }
236 } else {
237 DP(NETIF_MSG_LINK, "DCBX_LOCAL_APP_DISABLED\n");
238 bp->dcbx_port_params.app.enabled = false;
239 for (index = 0 ; index < LLFC_DRIVER_TRAFFIC_TYPE_MAX; index++)
240 ttp[index] = INVALID_TRAFFIC_TYPE_PRIORITY;
241 }
242}
243
244static void bnx2x_dcbx_get_ets_feature(struct bnx2x *bp,
245 struct dcbx_ets_feature *ets,
246 u32 error) {
247 int i = 0;
248 u32 pg_pri_orginal_spread[DCBX_MAX_NUM_PG_BW_ENTRIES] = {0};
249 struct pg_help_data pg_help_data;
250 struct bnx2x_dcbx_cos_params *cos_params =
251 bp->dcbx_port_params.ets.cos_params;
252
253 memset(&pg_help_data, 0, sizeof(struct pg_help_data));
254
255
256 if (GET_FLAGS(error, DCBX_LOCAL_ETS_ERROR))
257 DP(NETIF_MSG_LINK, "DCBX_LOCAL_ETS_ERROR\n");
258
259
260 /* Clean up old settings of ets on COS */
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000261 for (i = 0; i < ARRAY_SIZE(bp->dcbx_port_params.ets.cos_params) ; i++) {
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000262 cos_params[i].pauseable = false;
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000263 cos_params[i].strict = BNX2X_DCBX_STRICT_INVALID;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000264 cos_params[i].bw_tbl = DCBX_INVALID_COS_BW;
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000265 cos_params[i].pri_bitmask = 0;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000266 }
267
268 if (bp->dcbx_port_params.app.enabled &&
269 !GET_FLAGS(error, DCBX_LOCAL_ETS_ERROR) &&
270 ets->enabled) {
271 DP(NETIF_MSG_LINK, "DCBX_LOCAL_ETS_ENABLE\n");
272 bp->dcbx_port_params.ets.enabled = true;
273
274 bnx2x_dcbx_get_ets_pri_pg_tbl(bp,
275 pg_pri_orginal_spread,
276 ets->pri_pg_tbl);
277
278 bnx2x_dcbx_get_num_pg_traf_type(bp,
279 pg_pri_orginal_spread,
280 &pg_help_data);
281
282 bnx2x_dcbx_fill_cos_params(bp, &pg_help_data,
283 ets, pg_pri_orginal_spread);
284
285 } else {
286 DP(NETIF_MSG_LINK, "DCBX_LOCAL_ETS_DISABLED\n");
287 bp->dcbx_port_params.ets.enabled = false;
288 ets->pri_pg_tbl[0] = 0;
289
290 for (i = 0; i < DCBX_MAX_NUM_PRI_PG_ENTRIES ; i++)
291 DCBX_PG_BW_SET(ets->pg_bw_tbl, i, 1);
292 }
293}
294
295static void bnx2x_dcbx_get_pfc_feature(struct bnx2x *bp,
296 struct dcbx_pfc_feature *pfc, u32 error)
297{
298
299 if (GET_FLAGS(error, DCBX_LOCAL_PFC_ERROR))
300 DP(NETIF_MSG_LINK, "DCBX_LOCAL_PFC_ERROR\n");
301
302 if (bp->dcbx_port_params.app.enabled &&
303 !GET_FLAGS(error, DCBX_LOCAL_PFC_ERROR) &&
304 pfc->enabled) {
305 bp->dcbx_port_params.pfc.enabled = true;
306 bp->dcbx_port_params.pfc.priority_non_pauseable_mask =
307 ~(pfc->pri_en_bitmap);
308 } else {
309 DP(NETIF_MSG_LINK, "DCBX_LOCAL_PFC_DISABLED\n");
310 bp->dcbx_port_params.pfc.enabled = false;
311 bp->dcbx_port_params.pfc.priority_non_pauseable_mask = 0;
312 }
313}
314
315static void bnx2x_get_dcbx_drv_param(struct bnx2x *bp,
316 struct dcbx_features *features,
317 u32 error)
318{
319 bnx2x_dcbx_get_ap_feature(bp, &features->app, error);
320
321 bnx2x_dcbx_get_pfc_feature(bp, &features->pfc, error);
322
323 bnx2x_dcbx_get_ets_feature(bp, &features->ets, error);
324}
325
326#define DCBX_LOCAL_MIB_MAX_TRY_READ (100)
327static int bnx2x_dcbx_read_mib(struct bnx2x *bp,
328 u32 *base_mib_addr,
329 u32 offset,
330 int read_mib_type)
331{
332 int max_try_read = 0, i;
333 u32 *buff, mib_size, prefix_seq_num, suffix_seq_num;
334 struct lldp_remote_mib *remote_mib ;
335 struct lldp_local_mib *local_mib;
336
337
338 switch (read_mib_type) {
339 case DCBX_READ_LOCAL_MIB:
340 mib_size = sizeof(struct lldp_local_mib);
341 break;
342 case DCBX_READ_REMOTE_MIB:
343 mib_size = sizeof(struct lldp_remote_mib);
344 break;
345 default:
346 return 1; /*error*/
347 }
348
349 offset += BP_PORT(bp) * mib_size;
350
351 do {
352 buff = base_mib_addr;
353 for (i = 0; i < mib_size; i += 4, buff++)
354 *buff = REG_RD(bp, offset + i);
355
356 max_try_read++;
357
358 switch (read_mib_type) {
359 case DCBX_READ_LOCAL_MIB:
360 local_mib = (struct lldp_local_mib *) base_mib_addr;
361 prefix_seq_num = local_mib->prefix_seq_num;
362 suffix_seq_num = local_mib->suffix_seq_num;
363 break;
364 case DCBX_READ_REMOTE_MIB:
365 remote_mib = (struct lldp_remote_mib *) base_mib_addr;
366 prefix_seq_num = remote_mib->prefix_seq_num;
367 suffix_seq_num = remote_mib->suffix_seq_num;
368 break;
369 default:
370 return 1; /*error*/
371 }
372 } while ((prefix_seq_num != suffix_seq_num) &&
373 (max_try_read < DCBX_LOCAL_MIB_MAX_TRY_READ));
374
375 if (max_try_read >= DCBX_LOCAL_MIB_MAX_TRY_READ) {
376 BNX2X_ERR("MIB could not be read\n");
377 return 1;
378 }
379
380 return 0;
381}
382
383static void bnx2x_pfc_set_pfc(struct bnx2x *bp)
384{
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000385 if (BP_PORT(bp)) {
386 BNX2X_ERR("4 port mode is not supported");
387 return;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000388 }
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000389
390 if (bp->dcbx_port_params.pfc.enabled)
391 /*
392 * 1. Fills up common PFC structures if required
393 * 2. Configure NIG, MAC and BRB via the elink
394 */
395 bnx2x_pfc_set(bp);
396 else
397 bnx2x_pfc_clear(bp);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000398}
399
400static void bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp)
401{
402 DP(NETIF_MSG_LINK, "sending STOP TRAFFIC\n");
403 bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_STOP_TRAFFIC,
404 0 /* connectionless */,
405 0 /* dataHi is zero */,
406 0 /* dataLo is zero */,
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300407 NONE_CONNECTION_TYPE);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000408}
409
410static void bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp)
411{
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000412 bnx2x_dcbx_fw_struct(bp);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000413 DP(NETIF_MSG_LINK, "sending START TRAFFIC\n");
414 bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_START_TRAFFIC,
415 0, /* connectionless */
416 U64_HI(bnx2x_sp_mapping(bp, pfc_config)),
417 U64_LO(bnx2x_sp_mapping(bp, pfc_config)),
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300418 NONE_CONNECTION_TYPE);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000419}
420
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000421static void bnx2x_dcbx_2cos_limit_update_ets_config(struct bnx2x *bp)
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000422{
423 struct bnx2x_dcbx_pg_params *ets = &(bp->dcbx_port_params.ets);
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000424 int rc = 0;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000425
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000426 if (ets->num_of_cos == 0 || ets->num_of_cos > DCBX_COS_MAX_NUM_E2) {
427 BNX2X_ERR("Illegal number of COSes %d\n", ets->num_of_cos);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000428 return;
429 }
430
431 /* valid COS entries */
432 if (ets->num_of_cos == 1) /* no ETS */
433 return;
434
435 /* sanity */
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000436 if (((BNX2X_DCBX_STRICT_INVALID == ets->cos_params[0].strict) &&
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000437 (DCBX_INVALID_COS_BW == ets->cos_params[0].bw_tbl)) ||
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000438 ((BNX2X_DCBX_STRICT_INVALID == ets->cos_params[1].strict) &&
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000439 (DCBX_INVALID_COS_BW == ets->cos_params[1].bw_tbl))) {
440 BNX2X_ERR("all COS should have at least bw_limit or strict"
441 "ets->cos_params[0].strict= %x"
442 "ets->cos_params[0].bw_tbl= %x"
443 "ets->cos_params[1].strict= %x"
444 "ets->cos_params[1].bw_tbl= %x",
445 ets->cos_params[0].strict,
446 ets->cos_params[0].bw_tbl,
447 ets->cos_params[1].strict,
448 ets->cos_params[1].bw_tbl);
449 return;
450 }
451 /* If we join a group and there is bw_tbl and strict then bw rules */
452 if ((DCBX_INVALID_COS_BW != ets->cos_params[0].bw_tbl) &&
453 (DCBX_INVALID_COS_BW != ets->cos_params[1].bw_tbl)) {
454 u32 bw_tbl_0 = ets->cos_params[0].bw_tbl;
455 u32 bw_tbl_1 = ets->cos_params[1].bw_tbl;
456 /* Do not allow 0-100 configuration
457 * since PBF does not support it
458 * force 1-99 instead
459 */
460 if (bw_tbl_0 == 0) {
461 bw_tbl_0 = 1;
462 bw_tbl_1 = 99;
463 } else if (bw_tbl_1 == 0) {
464 bw_tbl_1 = 1;
465 bw_tbl_0 = 99;
466 }
467
468 bnx2x_ets_bw_limit(&bp->link_params, bw_tbl_0, bw_tbl_1);
469 } else {
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000470 if (ets->cos_params[0].strict == BNX2X_DCBX_STRICT_COS_HIGHEST)
471 rc = bnx2x_ets_strict(&bp->link_params, 0);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000472 else if (ets->cos_params[1].strict
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000473 == BNX2X_DCBX_STRICT_COS_HIGHEST)
474 rc = bnx2x_ets_strict(&bp->link_params, 1);
475 if (rc)
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000476 BNX2X_ERR("update_ets_params failed\n");
477 }
478}
479
Dmitry Kravkovd1976b22011-06-14 01:34:42 +0000480/*
481 * In E3B0 the configuration may have more than 2 COS.
482 */
483void bnx2x_dcbx_update_ets_config(struct bnx2x *bp)
484{
485 struct bnx2x_dcbx_pg_params *ets = &(bp->dcbx_port_params.ets);
486 struct bnx2x_ets_params ets_params = { 0 };
487 u8 i;
488
489 ets_params.num_of_cos = ets->num_of_cos;
490
491 for (i = 0; i < ets->num_of_cos; i++) {
492 /* COS is SP */
493 if (ets->cos_params[i].strict != BNX2X_DCBX_STRICT_INVALID) {
494 if (ets->cos_params[i].bw_tbl != DCBX_INVALID_COS_BW) {
495 BNX2X_ERR("COS can't be not BW and not SP\n");
496 return;
497 }
498
499 ets_params.cos[i].state = bnx2x_cos_state_strict;
500 ets_params.cos[i].params.sp_params.pri =
501 ets->cos_params[i].strict;
502 } else { /* COS is BW */
503 if (ets->cos_params[i].bw_tbl == DCBX_INVALID_COS_BW) {
504 BNX2X_ERR("COS can't be not BW and not SP\n");
505 return;
506 }
507 ets_params.cos[i].state = bnx2x_cos_state_bw;
508 ets_params.cos[i].params.bw_params.bw =
509 (u8)ets->cos_params[i].bw_tbl;
510 }
511 }
512
513 /* Configure the ETS in HW */
514 if (bnx2x_ets_e3b0_config(&bp->link_params, &bp->link_vars,
515 &ets_params)) {
516 BNX2X_ERR("bnx2x_ets_e3b0_config failed\n");
517 bnx2x_ets_disabled(&bp->link_params, &bp->link_vars);
518 }
519}
520
521static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp)
522{
523 bnx2x_ets_disabled(&bp->link_params, &bp->link_vars);
524
525 if (!bp->dcbx_port_params.ets.enabled)
526 return;
527
528 if (CHIP_IS_E3B0(bp))
529 bnx2x_dcbx_update_ets_config(bp);
530 else
531 bnx2x_dcbx_2cos_limit_update_ets_config(bp);
532}
533
Shmulik Ravid0be6bc62011-05-18 02:55:31 +0000534#ifdef BCM_DCBNL
535static int bnx2x_dcbx_read_shmem_remote_mib(struct bnx2x *bp)
536{
537 struct lldp_remote_mib remote_mib = {0};
538 u32 dcbx_remote_mib_offset = SHMEM2_RD(bp, dcbx_remote_mib_offset);
539 int rc;
540
541 DP(NETIF_MSG_LINK, "dcbx_remote_mib_offset 0x%x\n",
542 dcbx_remote_mib_offset);
543
544 if (SHMEM_DCBX_REMOTE_MIB_NONE == dcbx_remote_mib_offset) {
545 BNX2X_ERR("FW doesn't support dcbx_remote_mib_offset\n");
546 return -EINVAL;
547 }
548
549 rc = bnx2x_dcbx_read_mib(bp, (u32 *)&remote_mib, dcbx_remote_mib_offset,
550 DCBX_READ_REMOTE_MIB);
551
552 if (rc) {
553 BNX2X_ERR("Faild to read remote mib from FW\n");
554 return rc;
555 }
556
557 /* save features and flags */
558 bp->dcbx_remote_feat = remote_mib.features;
559 bp->dcbx_remote_flags = remote_mib.flags;
560 return 0;
561}
562#endif
563
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000564static int bnx2x_dcbx_read_shmem_neg_results(struct bnx2x *bp)
565{
566 struct lldp_local_mib local_mib = {0};
567 u32 dcbx_neg_res_offset = SHMEM2_RD(bp, dcbx_neg_res_offset);
568 int rc;
569
570 DP(NETIF_MSG_LINK, "dcbx_neg_res_offset 0x%x\n", dcbx_neg_res_offset);
571
572 if (SHMEM_DCBX_NEG_RES_NONE == dcbx_neg_res_offset) {
573 BNX2X_ERR("FW doesn't support dcbx_neg_res_offset\n");
574 return -EINVAL;
575 }
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300576
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000577 rc = bnx2x_dcbx_read_mib(bp, (u32 *)&local_mib, dcbx_neg_res_offset,
578 DCBX_READ_LOCAL_MIB);
579
580 if (rc) {
581 BNX2X_ERR("Faild to read local mib from FW\n");
582 return rc;
583 }
584
585 /* save features and error */
586 bp->dcbx_local_feat = local_mib.features;
587 bp->dcbx_error = local_mib.error;
588 return 0;
589}
590
Shmulik Ravid98507672011-02-28 12:19:55 -0800591
592#ifdef BCM_DCBNL
593static inline
594u8 bnx2x_dcbx_dcbnl_app_up(struct dcbx_app_priority_entry *ent)
595{
596 u8 pri;
597
598 /* Choose the highest priority */
599 for (pri = MAX_PFC_PRIORITIES - 1; pri > 0; pri--)
600 if (ent->pri_bitmap & (1 << pri))
601 break;
602 return pri;
603}
604
605static inline
606u8 bnx2x_dcbx_dcbnl_app_idtype(struct dcbx_app_priority_entry *ent)
607{
608 return ((ent->appBitfield & DCBX_APP_ENTRY_SF_MASK) ==
609 DCBX_APP_SF_PORT) ? DCB_APP_IDTYPE_PORTNUM :
610 DCB_APP_IDTYPE_ETHTYPE;
611}
612
Shmulik Ravid98507672011-02-28 12:19:55 -0800613int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall)
614{
615 int i, err = 0;
616
617 for (i = 0; i < DCBX_MAX_APP_PROTOCOL && err == 0; i++) {
618 struct dcbx_app_priority_entry *ent =
619 &bp->dcbx_local_feat.app.app_pri_tbl[i];
620
621 if (ent->appBitfield & DCBX_APP_ENTRY_VALID) {
622 u8 up = bnx2x_dcbx_dcbnl_app_up(ent);
623
624 /* avoid invalid user-priority */
625 if (up) {
626 struct dcb_app app;
627 app.selector = bnx2x_dcbx_dcbnl_app_idtype(ent);
628 app.protocol = ent->app_id;
629 app.priority = delall ? 0 : up;
630 err = dcb_setapp(bp->dev, &app);
631 }
632 }
633 }
634 return err;
635}
636#endif
637
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300638static inline void bnx2x_update_drv_flags(struct bnx2x *bp, u32 flags, u32 set)
639{
640 if (SHMEM2_HAS(bp, drv_flags)) {
641 u32 drv_flags;
642 bnx2x_acquire_hw_lock(bp, HW_LOCK_DRV_FLAGS);
643 drv_flags = SHMEM2_RD(bp, drv_flags);
644
645 if (set)
646 SET_FLAGS(drv_flags, flags);
647 else
648 RESET_FLAGS(drv_flags, flags);
649
650 SHMEM2_WR(bp, drv_flags, drv_flags);
651 DP(NETIF_MSG_HW, "drv_flags 0x%08x\n", drv_flags);
652 bnx2x_release_hw_lock(bp, HW_LOCK_DRV_FLAGS);
653 }
654}
655
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000656void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
657{
658 switch (state) {
659 case BNX2X_DCBX_STATE_NEG_RECEIVED:
660 {
661 DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_NEG_RECEIVED\n");
Shmulik Ravid98507672011-02-28 12:19:55 -0800662#ifdef BCM_DCBNL
663 /**
664 * Delete app tlvs from dcbnl before reading new
665 * negotiation results
666 */
667 bnx2x_dcbnl_update_applist(bp, true);
Shmulik Ravid0be6bc62011-05-18 02:55:31 +0000668
669 /* Read rmeote mib if dcbx is in the FW */
670 if (bnx2x_dcbx_read_shmem_remote_mib(bp))
671 return;
Shmulik Ravid98507672011-02-28 12:19:55 -0800672#endif
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000673 /* Read neg results if dcbx is in the FW */
674 if (bnx2x_dcbx_read_shmem_neg_results(bp))
675 return;
676
677 bnx2x_dump_dcbx_drv_param(bp, &bp->dcbx_local_feat,
678 bp->dcbx_error);
679
680 bnx2x_get_dcbx_drv_param(bp, &bp->dcbx_local_feat,
681 bp->dcbx_error);
682
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300683 /* mark DCBX result for PMF migration */
684 bnx2x_update_drv_flags(bp, DRV_FLAGS_DCB_CONFIGURED, 1);
Shmulik Ravid98507672011-02-28 12:19:55 -0800685#ifdef BCM_DCBNL
686 /**
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300687 * Add new app tlvs to dcbnl
Shmulik Ravid98507672011-02-28 12:19:55 -0800688 */
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300689 bnx2x_dcbnl_update_applist(bp, false);
Shmulik Ravid98507672011-02-28 12:19:55 -0800690#endif
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300691 bnx2x_dcbx_stop_hw_tx(bp);
692
693 return;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000694 }
695 case BNX2X_DCBX_STATE_TX_PAUSED:
696 DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_TX_PAUSED\n");
697 bnx2x_pfc_set_pfc(bp);
698
699 bnx2x_dcbx_update_ets_params(bp);
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300700 bnx2x_dcbx_resume_hw_tx(bp);
701 return;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000702 case BNX2X_DCBX_STATE_TX_RELEASED:
703 DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_TX_RELEASED\n");
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300704 bnx2x_fw_command(bp, DRV_MSG_CODE_DCBX_PMF_DRV_OK, 0);
Shmulik Ravid3c878d42011-07-07 05:11:30 -0700705#ifdef BCM_DCBNL
706 /**
707 * Send a notification for the new negotiated parameters
708 */
709 dcbnl_cee_notify(bp->dev, RTM_GETDCB, DCB_CMD_CEE_GET, 0, 0);
710#endif
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000711 return;
712 default:
713 BNX2X_ERR("Unknown DCBX_STATE\n");
714 }
715}
716
717
718#define LLDP_STATS_OFFSET(bp) (BP_PORT(bp)*\
719 sizeof(struct lldp_dcbx_stat))
720
721/* calculate struct offset in array according to chip information */
722#define LLDP_PARAMS_OFFSET(bp) (BP_PORT(bp)*sizeof(struct lldp_params))
723
724#define LLDP_ADMIN_MIB_OFFSET(bp) (PORT_MAX*sizeof(struct lldp_params) + \
725 BP_PORT(bp)*sizeof(struct lldp_admin_mib))
726
727static void bnx2x_dcbx_lldp_updated_params(struct bnx2x *bp,
728 u32 dcbx_lldp_params_offset)
729{
730 struct lldp_params lldp_params = {0};
731 u32 i = 0, *buff = NULL;
732 u32 offset = dcbx_lldp_params_offset + LLDP_PARAMS_OFFSET(bp);
733
734 DP(NETIF_MSG_LINK, "lldp_offset 0x%x\n", offset);
735
736 if ((bp->lldp_config_params.overwrite_settings ==
737 BNX2X_DCBX_OVERWRITE_SETTINGS_ENABLE)) {
738 /* Read the data first */
739 buff = (u32 *)&lldp_params;
740 for (i = 0; i < sizeof(struct lldp_params); i += 4, buff++)
741 *buff = REG_RD(bp, (offset + i));
742
743 lldp_params.msg_tx_hold =
744 (u8)bp->lldp_config_params.msg_tx_hold;
745 lldp_params.msg_fast_tx_interval =
746 (u8)bp->lldp_config_params.msg_fast_tx;
747 lldp_params.tx_crd_max =
748 (u8)bp->lldp_config_params.tx_credit_max;
749 lldp_params.msg_tx_interval =
750 (u8)bp->lldp_config_params.msg_tx_interval;
751 lldp_params.tx_fast =
752 (u8)bp->lldp_config_params.tx_fast;
753
754 /* Write the data.*/
755 buff = (u32 *)&lldp_params;
756 for (i = 0; i < sizeof(struct lldp_params); i += 4, buff++)
757 REG_WR(bp, (offset + i) , *buff);
758
759
760 } else if (BNX2X_DCBX_OVERWRITE_SETTINGS_ENABLE ==
761 bp->lldp_config_params.overwrite_settings)
762 bp->lldp_config_params.overwrite_settings =
763 BNX2X_DCBX_OVERWRITE_SETTINGS_INVALID;
764}
765
766static void bnx2x_dcbx_admin_mib_updated_params(struct bnx2x *bp,
767 u32 dcbx_lldp_params_offset)
768{
769 struct lldp_admin_mib admin_mib;
770 u32 i, other_traf_type = PREDEFINED_APP_IDX_MAX, traf_type = 0;
771 u32 *buff;
772 u32 offset = dcbx_lldp_params_offset + LLDP_ADMIN_MIB_OFFSET(bp);
773
774 /*shortcuts*/
775 struct dcbx_features *af = &admin_mib.features;
776 struct bnx2x_config_dcbx_params *dp = &bp->dcbx_config_params;
777
778 memset(&admin_mib, 0, sizeof(struct lldp_admin_mib));
779 buff = (u32 *)&admin_mib;
780 /* Read the data first */
781 for (i = 0; i < sizeof(struct lldp_admin_mib); i += 4, buff++)
782 *buff = REG_RD(bp, (offset + i));
783
Shmulik Ravid785b9b12010-12-30 06:27:03 +0000784 if (bp->dcbx_enabled == BNX2X_DCBX_ENABLED_ON_NEG_ON)
785 SET_FLAGS(admin_mib.ver_cfg_flags, DCBX_DCBX_ENABLED);
786 else
787 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_DCBX_ENABLED);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000788
789 if ((BNX2X_DCBX_OVERWRITE_SETTINGS_ENABLE ==
790 dp->overwrite_settings)) {
791 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_CEE_VERSION_MASK);
792 admin_mib.ver_cfg_flags |=
793 (dp->admin_dcbx_version << DCBX_CEE_VERSION_SHIFT) &
794 DCBX_CEE_VERSION_MASK;
795
796 af->ets.enabled = (u8)dp->admin_ets_enable;
797
798 af->pfc.enabled = (u8)dp->admin_pfc_enable;
799
800 /* FOR IEEE dp->admin_tc_supported_tx_enable */
801 if (dp->admin_ets_configuration_tx_enable)
802 SET_FLAGS(admin_mib.ver_cfg_flags,
803 DCBX_ETS_CONFIG_TX_ENABLED);
804 else
805 RESET_FLAGS(admin_mib.ver_cfg_flags,
806 DCBX_ETS_CONFIG_TX_ENABLED);
807 /* For IEEE admin_ets_recommendation_tx_enable */
808 if (dp->admin_pfc_tx_enable)
809 SET_FLAGS(admin_mib.ver_cfg_flags,
810 DCBX_PFC_CONFIG_TX_ENABLED);
811 else
812 RESET_FLAGS(admin_mib.ver_cfg_flags,
813 DCBX_PFC_CONFIG_TX_ENABLED);
814
815 if (dp->admin_application_priority_tx_enable)
816 SET_FLAGS(admin_mib.ver_cfg_flags,
817 DCBX_APP_CONFIG_TX_ENABLED);
818 else
819 RESET_FLAGS(admin_mib.ver_cfg_flags,
820 DCBX_APP_CONFIG_TX_ENABLED);
821
822 if (dp->admin_ets_willing)
823 SET_FLAGS(admin_mib.ver_cfg_flags, DCBX_ETS_WILLING);
824 else
825 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_ETS_WILLING);
826 /* For IEEE admin_ets_reco_valid */
827 if (dp->admin_pfc_willing)
828 SET_FLAGS(admin_mib.ver_cfg_flags, DCBX_PFC_WILLING);
829 else
830 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_PFC_WILLING);
831
832 if (dp->admin_app_priority_willing)
833 SET_FLAGS(admin_mib.ver_cfg_flags, DCBX_APP_WILLING);
834 else
835 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_APP_WILLING);
836
837 for (i = 0 ; i < DCBX_MAX_NUM_PG_BW_ENTRIES; i++) {
838 DCBX_PG_BW_SET(af->ets.pg_bw_tbl, i,
839 (u8)dp->admin_configuration_bw_precentage[i]);
840
841 DP(NETIF_MSG_LINK, "pg_bw_tbl[%d] = %02x\n",
842 i, DCBX_PG_BW_GET(af->ets.pg_bw_tbl, i));
843 }
844
845 for (i = 0; i < DCBX_MAX_NUM_PRI_PG_ENTRIES; i++) {
846 DCBX_PRI_PG_SET(af->ets.pri_pg_tbl, i,
847 (u8)dp->admin_configuration_ets_pg[i]);
848
849 DP(NETIF_MSG_LINK, "pri_pg_tbl[%d] = %02x\n",
850 i, DCBX_PRI_PG_GET(af->ets.pri_pg_tbl, i));
851 }
852
853 /*For IEEE admin_recommendation_bw_precentage
854 *For IEEE admin_recommendation_ets_pg */
855 af->pfc.pri_en_bitmap = (u8)dp->admin_pfc_bitmap;
856 for (i = 0; i < 4; i++) {
857 if (dp->admin_priority_app_table[i].valid) {
858 struct bnx2x_admin_priority_app_table *table =
859 dp->admin_priority_app_table;
860 if ((ETH_TYPE_FCOE == table[i].app_id) &&
861 (TRAFFIC_TYPE_ETH == table[i].traffic_type))
862 traf_type = FCOE_APP_IDX;
863 else if ((TCP_PORT_ISCSI == table[i].app_id) &&
864 (TRAFFIC_TYPE_PORT == table[i].traffic_type))
865 traf_type = ISCSI_APP_IDX;
866 else
867 traf_type = other_traf_type++;
868
869 af->app.app_pri_tbl[traf_type].app_id =
870 table[i].app_id;
871
872 af->app.app_pri_tbl[traf_type].pri_bitmap =
873 (u8)(1 << table[i].priority);
874
875 af->app.app_pri_tbl[traf_type].appBitfield =
876 (DCBX_APP_ENTRY_VALID);
877
878 af->app.app_pri_tbl[traf_type].appBitfield |=
879 (TRAFFIC_TYPE_ETH == table[i].traffic_type) ?
880 DCBX_APP_SF_ETH_TYPE : DCBX_APP_SF_PORT;
881 }
882 }
883
884 af->app.default_pri = (u8)dp->admin_default_priority;
885
886 } else if (BNX2X_DCBX_OVERWRITE_SETTINGS_ENABLE ==
887 dp->overwrite_settings)
888 dp->overwrite_settings = BNX2X_DCBX_OVERWRITE_SETTINGS_INVALID;
889
890 /* Write the data. */
891 buff = (u32 *)&admin_mib;
892 for (i = 0; i < sizeof(struct lldp_admin_mib); i += 4, buff++)
893 REG_WR(bp, (offset + i), *buff);
894}
895
Shmulik Ravid785b9b12010-12-30 06:27:03 +0000896void bnx2x_dcbx_set_state(struct bnx2x *bp, bool dcb_on, u32 dcbx_enabled)
897{
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300898 if (!CHIP_IS_E1x(bp) && !CHIP_MODE_IS_4_PORT(bp)) {
Shmulik Ravid785b9b12010-12-30 06:27:03 +0000899 bp->dcb_state = dcb_on;
900 bp->dcbx_enabled = dcbx_enabled;
901 } else {
902 bp->dcb_state = false;
903 bp->dcbx_enabled = BNX2X_DCBX_ENABLED_INVALID;
904 }
905 DP(NETIF_MSG_LINK, "DCB state [%s:%s]\n",
906 dcb_on ? "ON" : "OFF",
907 dcbx_enabled == BNX2X_DCBX_ENABLED_OFF ? "user-mode" :
908 dcbx_enabled == BNX2X_DCBX_ENABLED_ON_NEG_OFF ? "on-chip static" :
909 dcbx_enabled == BNX2X_DCBX_ENABLED_ON_NEG_ON ?
910 "on-chip with negotiation" : "invalid");
911}
912
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000913void bnx2x_dcbx_init_params(struct bnx2x *bp)
914{
915 bp->dcbx_config_params.admin_dcbx_version = 0x0; /* 0 - CEE; 1 - IEEE */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000916 bp->dcbx_config_params.admin_ets_willing = 1;
917 bp->dcbx_config_params.admin_pfc_willing = 1;
918 bp->dcbx_config_params.overwrite_settings = 1;
919 bp->dcbx_config_params.admin_ets_enable = 1;
920 bp->dcbx_config_params.admin_pfc_enable = 1;
921 bp->dcbx_config_params.admin_tc_supported_tx_enable = 1;
922 bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1;
923 bp->dcbx_config_params.admin_pfc_tx_enable = 1;
924 bp->dcbx_config_params.admin_application_priority_tx_enable = 1;
925 bp->dcbx_config_params.admin_ets_reco_valid = 1;
926 bp->dcbx_config_params.admin_app_priority_willing = 1;
927 bp->dcbx_config_params.admin_configuration_bw_precentage[0] = 00;
928 bp->dcbx_config_params.admin_configuration_bw_precentage[1] = 50;
929 bp->dcbx_config_params.admin_configuration_bw_precentage[2] = 50;
930 bp->dcbx_config_params.admin_configuration_bw_precentage[3] = 0;
931 bp->dcbx_config_params.admin_configuration_bw_precentage[4] = 0;
932 bp->dcbx_config_params.admin_configuration_bw_precentage[5] = 0;
933 bp->dcbx_config_params.admin_configuration_bw_precentage[6] = 0;
934 bp->dcbx_config_params.admin_configuration_bw_precentage[7] = 0;
935 bp->dcbx_config_params.admin_configuration_ets_pg[0] = 1;
936 bp->dcbx_config_params.admin_configuration_ets_pg[1] = 0;
937 bp->dcbx_config_params.admin_configuration_ets_pg[2] = 0;
938 bp->dcbx_config_params.admin_configuration_ets_pg[3] = 2;
939 bp->dcbx_config_params.admin_configuration_ets_pg[4] = 0;
940 bp->dcbx_config_params.admin_configuration_ets_pg[5] = 0;
941 bp->dcbx_config_params.admin_configuration_ets_pg[6] = 0;
942 bp->dcbx_config_params.admin_configuration_ets_pg[7] = 0;
943 bp->dcbx_config_params.admin_recommendation_bw_precentage[0] = 0;
944 bp->dcbx_config_params.admin_recommendation_bw_precentage[1] = 1;
945 bp->dcbx_config_params.admin_recommendation_bw_precentage[2] = 2;
946 bp->dcbx_config_params.admin_recommendation_bw_precentage[3] = 0;
947 bp->dcbx_config_params.admin_recommendation_bw_precentage[4] = 7;
948 bp->dcbx_config_params.admin_recommendation_bw_precentage[5] = 5;
949 bp->dcbx_config_params.admin_recommendation_bw_precentage[6] = 6;
950 bp->dcbx_config_params.admin_recommendation_bw_precentage[7] = 7;
951 bp->dcbx_config_params.admin_recommendation_ets_pg[0] = 0;
952 bp->dcbx_config_params.admin_recommendation_ets_pg[1] = 1;
953 bp->dcbx_config_params.admin_recommendation_ets_pg[2] = 2;
954 bp->dcbx_config_params.admin_recommendation_ets_pg[3] = 3;
955 bp->dcbx_config_params.admin_recommendation_ets_pg[4] = 4;
956 bp->dcbx_config_params.admin_recommendation_ets_pg[5] = 5;
957 bp->dcbx_config_params.admin_recommendation_ets_pg[6] = 6;
958 bp->dcbx_config_params.admin_recommendation_ets_pg[7] = 7;
959 bp->dcbx_config_params.admin_pfc_bitmap = 0x8; /* FCoE(3) enable */
960 bp->dcbx_config_params.admin_priority_app_table[0].valid = 1;
961 bp->dcbx_config_params.admin_priority_app_table[1].valid = 1;
962 bp->dcbx_config_params.admin_priority_app_table[2].valid = 0;
963 bp->dcbx_config_params.admin_priority_app_table[3].valid = 0;
964 bp->dcbx_config_params.admin_priority_app_table[0].priority = 3;
965 bp->dcbx_config_params.admin_priority_app_table[1].priority = 0;
966 bp->dcbx_config_params.admin_priority_app_table[2].priority = 0;
967 bp->dcbx_config_params.admin_priority_app_table[3].priority = 0;
968 bp->dcbx_config_params.admin_priority_app_table[0].traffic_type = 0;
969 bp->dcbx_config_params.admin_priority_app_table[1].traffic_type = 1;
970 bp->dcbx_config_params.admin_priority_app_table[2].traffic_type = 0;
971 bp->dcbx_config_params.admin_priority_app_table[3].traffic_type = 0;
972 bp->dcbx_config_params.admin_priority_app_table[0].app_id = 0x8906;
973 bp->dcbx_config_params.admin_priority_app_table[1].app_id = 3260;
974 bp->dcbx_config_params.admin_priority_app_table[2].app_id = 0;
975 bp->dcbx_config_params.admin_priority_app_table[3].app_id = 0;
976 bp->dcbx_config_params.admin_default_priority =
977 bp->dcbx_config_params.admin_priority_app_table[1].priority;
978}
979
980void bnx2x_dcbx_init(struct bnx2x *bp)
981{
982 u32 dcbx_lldp_params_offset = SHMEM_LLDP_DCBX_PARAMS_NONE;
Shmulik Ravid785b9b12010-12-30 06:27:03 +0000983
984 if (bp->dcbx_enabled <= 0)
985 return;
986
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000987 /* validate:
988 * chip of good for dcbx version,
989 * dcb is wanted
990 * the function is pmf
991 * shmem2 contains DCBX support fields
992 */
Shmulik Ravid785b9b12010-12-30 06:27:03 +0000993 DP(NETIF_MSG_LINK, "dcb_state %d bp->port.pmf %d\n",
994 bp->dcb_state, bp->port.pmf);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000995
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +0300996 if (bp->dcb_state == BNX2X_DCB_STATE_ON && bp->port.pmf &&
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +0000997 SHMEM2_HAS(bp, dcbx_lldp_params_offset)) {
Shmulik Ravid785b9b12010-12-30 06:27:03 +0000998 dcbx_lldp_params_offset =
999 SHMEM2_RD(bp, dcbx_lldp_params_offset);
1000
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001001 DP(NETIF_MSG_LINK, "dcbx_lldp_params_offset 0x%x\n",
1002 dcbx_lldp_params_offset);
Shmulik Ravid785b9b12010-12-30 06:27:03 +00001003
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001004 bnx2x_update_drv_flags(bp, DRV_FLAGS_DCB_CONFIGURED, 0);
1005
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001006 if (SHMEM_LLDP_DCBX_PARAMS_NONE != dcbx_lldp_params_offset) {
1007 bnx2x_dcbx_lldp_updated_params(bp,
1008 dcbx_lldp_params_offset);
1009
1010 bnx2x_dcbx_admin_mib_updated_params(bp,
1011 dcbx_lldp_params_offset);
1012
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001013 /* Let HW start negotiation */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001014 bnx2x_fw_command(bp,
1015 DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG, 0);
1016 }
1017 }
1018}
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001019static void
1020bnx2x_dcbx_print_cos_params(struct bnx2x *bp,
1021 struct flow_control_configuration *pfc_fw_cfg)
1022{
1023 u8 pri = 0;
1024 u8 cos = 0;
1025
1026 DP(NETIF_MSG_LINK,
1027 "pfc_fw_cfg->dcb_version %x\n", pfc_fw_cfg->dcb_version);
1028 DP(NETIF_MSG_LINK,
1029 "pdev->params.dcbx_port_params.pfc."
1030 "priority_non_pauseable_mask %x\n",
1031 bp->dcbx_port_params.pfc.priority_non_pauseable_mask);
1032
1033 for (cos = 0 ; cos < bp->dcbx_port_params.ets.num_of_cos ; cos++) {
1034 DP(NETIF_MSG_LINK, "pdev->params.dcbx_port_params.ets."
1035 "cos_params[%d].pri_bitmask %x\n", cos,
1036 bp->dcbx_port_params.ets.cos_params[cos].pri_bitmask);
1037
1038 DP(NETIF_MSG_LINK, "pdev->params.dcbx_port_params.ets."
1039 "cos_params[%d].bw_tbl %x\n", cos,
1040 bp->dcbx_port_params.ets.cos_params[cos].bw_tbl);
1041
1042 DP(NETIF_MSG_LINK, "pdev->params.dcbx_port_params.ets."
1043 "cos_params[%d].strict %x\n", cos,
1044 bp->dcbx_port_params.ets.cos_params[cos].strict);
1045
1046 DP(NETIF_MSG_LINK, "pdev->params.dcbx_port_params.ets."
1047 "cos_params[%d].pauseable %x\n", cos,
1048 bp->dcbx_port_params.ets.cos_params[cos].pauseable);
1049 }
1050
1051 for (pri = 0; pri < LLFC_DRIVER_TRAFFIC_TYPE_MAX; pri++) {
1052 DP(NETIF_MSG_LINK,
1053 "pfc_fw_cfg->traffic_type_to_priority_cos[%d]."
1054 "priority %x\n", pri,
1055 pfc_fw_cfg->traffic_type_to_priority_cos[pri].priority);
1056
1057 DP(NETIF_MSG_LINK,
1058 "pfc_fw_cfg->traffic_type_to_priority_cos[%d].cos %x\n",
1059 pri, pfc_fw_cfg->traffic_type_to_priority_cos[pri].cos);
1060 }
1061}
1062
1063/* fills help_data according to pg_info */
1064static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp,
1065 u32 *pg_pri_orginal_spread,
1066 struct pg_help_data *help_data)
1067{
1068 bool pg_found = false;
1069 u32 i, traf_type, add_traf_type, add_pg;
1070 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
1071 struct pg_entry_help_data *data = help_data->data; /*shotcut*/
1072
1073 /* Set to invalid */
1074 for (i = 0; i < LLFC_DRIVER_TRAFFIC_TYPE_MAX; i++)
1075 data[i].pg = DCBX_ILLEGAL_PG;
1076
1077 for (add_traf_type = 0;
1078 add_traf_type < LLFC_DRIVER_TRAFFIC_TYPE_MAX; add_traf_type++) {
1079 pg_found = false;
1080 if (ttp[add_traf_type] < MAX_PFC_PRIORITIES) {
1081 add_pg = (u8)pg_pri_orginal_spread[ttp[add_traf_type]];
1082 for (traf_type = 0;
1083 traf_type < LLFC_DRIVER_TRAFFIC_TYPE_MAX;
1084 traf_type++) {
1085 if (data[traf_type].pg == add_pg) {
1086 if (!(data[traf_type].pg_priority &
1087 (1 << ttp[add_traf_type])))
1088 data[traf_type].
1089 num_of_dif_pri++;
1090 data[traf_type].pg_priority |=
1091 (1 << ttp[add_traf_type]);
1092 pg_found = true;
1093 break;
1094 }
1095 }
1096 if (false == pg_found) {
1097 data[help_data->num_of_pg].pg = add_pg;
1098 data[help_data->num_of_pg].pg_priority =
1099 (1 << ttp[add_traf_type]);
1100 data[help_data->num_of_pg].num_of_dif_pri = 1;
1101 help_data->num_of_pg++;
1102 }
1103 }
1104 DP(NETIF_MSG_LINK,
1105 "add_traf_type %d pg_found %s num_of_pg %d\n",
1106 add_traf_type, (false == pg_found) ? "NO" : "YES",
1107 help_data->num_of_pg);
1108 }
1109}
1110
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001111static void bnx2x_dcbx_ets_disabled_entry_data(struct bnx2x *bp,
1112 struct cos_help_data *cos_data,
1113 u32 pri_join_mask)
1114{
1115 /* Only one priority than only one COS */
1116 cos_data->data[0].pausable =
1117 IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask);
1118 cos_data->data[0].pri_join_mask = pri_join_mask;
1119 cos_data->data[0].cos_bw = 100;
1120 cos_data->num_of_cos = 1;
1121}
1122
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001123static inline void bnx2x_dcbx_add_to_cos_bw(struct bnx2x *bp,
1124 struct cos_entry_help_data *data,
1125 u8 pg_bw)
1126{
1127 if (data->cos_bw == DCBX_INVALID_COS_BW)
1128 data->cos_bw = pg_bw;
1129 else
1130 data->cos_bw += pg_bw;
1131}
1132
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001133static void bnx2x_dcbx_separate_pauseable_from_non(struct bnx2x *bp,
1134 struct cos_help_data *cos_data,
1135 u32 *pg_pri_orginal_spread,
1136 struct dcbx_ets_feature *ets)
1137{
1138 u32 pri_tested = 0;
1139 u8 i = 0;
1140 u8 entry = 0;
1141 u8 pg_entry = 0;
1142 u8 num_of_pri = LLFC_DRIVER_TRAFFIC_TYPE_MAX;
1143
1144 cos_data->data[0].pausable = true;
1145 cos_data->data[1].pausable = false;
1146 cos_data->data[0].pri_join_mask = cos_data->data[1].pri_join_mask = 0;
1147
1148 for (i = 0 ; i < num_of_pri ; i++) {
1149 pri_tested = 1 << bp->dcbx_port_params.
1150 app.traffic_type_priority[i];
1151
1152 if (pri_tested & DCBX_PFC_PRI_NON_PAUSE_MASK(bp)) {
1153 cos_data->data[1].pri_join_mask |= pri_tested;
1154 entry = 1;
1155 } else {
1156 cos_data->data[0].pri_join_mask |= pri_tested;
1157 entry = 0;
1158 }
1159 pg_entry = (u8)pg_pri_orginal_spread[bp->dcbx_port_params.
1160 app.traffic_type_priority[i]];
1161 /* There can be only one strict pg */
1162 if (pg_entry < DCBX_MAX_NUM_PG_BW_ENTRIES)
1163 bnx2x_dcbx_add_to_cos_bw(bp, &cos_data->data[entry],
1164 DCBX_PG_BW_GET(ets->pg_bw_tbl, pg_entry));
1165 else
1166 /* If we join a group and one is strict
1167 * than the bw rulls */
1168 cos_data->data[entry].strict =
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001169 BNX2X_DCBX_STRICT_COS_HIGHEST;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001170 }
1171 if ((0 == cos_data->data[0].pri_join_mask) &&
1172 (0 == cos_data->data[1].pri_join_mask))
1173 BNX2X_ERR("dcbx error: Both groups must have priorities\n");
1174}
1175
1176
1177#ifndef POWER_OF_2
1178#define POWER_OF_2(x) ((0 != x) && (0 == (x & (x-1))))
1179#endif
1180
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001181static void bnx2x_dcbx_2cos_limit_cee_single_pg_to_cos_params(struct bnx2x *bp,
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001182 struct pg_help_data *pg_help_data,
1183 struct cos_help_data *cos_data,
1184 u32 pri_join_mask,
1185 u8 num_of_dif_pri)
1186{
1187 u8 i = 0;
1188 u32 pri_tested = 0;
1189 u32 pri_mask_without_pri = 0;
1190 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
1191 /*debug*/
1192 if (num_of_dif_pri == 1) {
1193 bnx2x_dcbx_ets_disabled_entry_data(bp, cos_data, pri_join_mask);
1194 return;
1195 }
1196 /* single priority group */
1197 if (pg_help_data->data[0].pg < DCBX_MAX_NUM_PG_BW_ENTRIES) {
1198 /* If there are both pauseable and non-pauseable priorities,
1199 * the pauseable priorities go to the first queue and
1200 * the non-pauseable priorities go to the second queue.
1201 */
1202 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pri_join_mask)) {
1203 /* Pauseable */
1204 cos_data->data[0].pausable = true;
1205 /* Non pauseable.*/
1206 cos_data->data[1].pausable = false;
1207
1208 if (2 == num_of_dif_pri) {
1209 cos_data->data[0].cos_bw = 50;
1210 cos_data->data[1].cos_bw = 50;
1211 }
1212
1213 if (3 == num_of_dif_pri) {
1214 if (POWER_OF_2(DCBX_PFC_PRI_GET_PAUSE(bp,
1215 pri_join_mask))) {
1216 cos_data->data[0].cos_bw = 33;
1217 cos_data->data[1].cos_bw = 67;
1218 } else {
1219 cos_data->data[0].cos_bw = 67;
1220 cos_data->data[1].cos_bw = 33;
1221 }
1222 }
1223
1224 } else if (IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask)) {
1225 /* If there are only pauseable priorities,
1226 * then one/two priorities go to the first queue
1227 * and one priority goes to the second queue.
1228 */
1229 if (2 == num_of_dif_pri) {
1230 cos_data->data[0].cos_bw = 50;
1231 cos_data->data[1].cos_bw = 50;
1232 } else {
1233 cos_data->data[0].cos_bw = 67;
1234 cos_data->data[1].cos_bw = 33;
1235 }
1236 cos_data->data[1].pausable = true;
1237 cos_data->data[0].pausable = true;
1238 /* All priorities except FCOE */
1239 cos_data->data[0].pri_join_mask = (pri_join_mask &
1240 ((u8)~(1 << ttp[LLFC_TRAFFIC_TYPE_FCOE])));
1241 /* Only FCOE priority.*/
1242 cos_data->data[1].pri_join_mask =
1243 (1 << ttp[LLFC_TRAFFIC_TYPE_FCOE]);
1244 } else
1245 /* If there are only non-pauseable priorities,
1246 * they will all go to the same queue.
1247 */
1248 bnx2x_dcbx_ets_disabled_entry_data(bp,
1249 cos_data, pri_join_mask);
1250 } else {
1251 /* priority group which is not BW limited (PG#15):*/
1252 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pri_join_mask)) {
1253 /* If there are both pauseable and non-pauseable
1254 * priorities, the pauseable priorities go to the first
1255 * queue and the non-pauseable priorities
1256 * go to the second queue.
1257 */
1258 if (DCBX_PFC_PRI_GET_PAUSE(bp, pri_join_mask) >
1259 DCBX_PFC_PRI_GET_NON_PAUSE(bp, pri_join_mask)) {
1260 cos_data->data[0].strict =
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001261 BNX2X_DCBX_STRICT_COS_HIGHEST;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001262 cos_data->data[1].strict =
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001263 BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(
1264 BNX2X_DCBX_STRICT_COS_HIGHEST);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001265 } else {
1266 cos_data->data[0].strict =
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001267 BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(
1268 BNX2X_DCBX_STRICT_COS_HIGHEST);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001269 cos_data->data[1].strict =
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001270 BNX2X_DCBX_STRICT_COS_HIGHEST;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001271 }
1272 /* Pauseable */
1273 cos_data->data[0].pausable = true;
1274 /* Non pause-able.*/
1275 cos_data->data[1].pausable = false;
1276 } else {
1277 /* If there are only pauseable priorities or
1278 * only non-pauseable,* the lower priorities go
1279 * to the first queue and the higherpriorities go
1280 * to the second queue.
1281 */
1282 cos_data->data[0].pausable =
1283 cos_data->data[1].pausable =
1284 IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask);
1285
1286 for (i = 0 ; i < LLFC_DRIVER_TRAFFIC_TYPE_MAX; i++) {
1287 pri_tested = 1 << bp->dcbx_port_params.
1288 app.traffic_type_priority[i];
1289 /* Remove priority tested */
1290 pri_mask_without_pri =
1291 (pri_join_mask & ((u8)(~pri_tested)));
1292 if (pri_mask_without_pri < pri_tested)
1293 break;
1294 }
1295
1296 if (i == LLFC_DRIVER_TRAFFIC_TYPE_MAX)
1297 BNX2X_ERR("Invalid value for pri_join_mask -"
1298 " could not find a priority\n");
1299
1300 cos_data->data[0].pri_join_mask = pri_mask_without_pri;
1301 cos_data->data[1].pri_join_mask = pri_tested;
1302 /* Both queues are strict priority,
1303 * and that with the highest priority
1304 * gets the highest strict priority in the arbiter.
1305 */
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001306 cos_data->data[0].strict =
1307 BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(
1308 BNX2X_DCBX_STRICT_COS_HIGHEST);
1309 cos_data->data[1].strict =
1310 BNX2X_DCBX_STRICT_COS_HIGHEST;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001311 }
1312 }
1313}
1314
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001315static void bnx2x_dcbx_2cos_limit_cee_two_pg_to_cos_params(
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001316 struct bnx2x *bp,
1317 struct pg_help_data *pg_help_data,
1318 struct dcbx_ets_feature *ets,
1319 struct cos_help_data *cos_data,
1320 u32 *pg_pri_orginal_spread,
1321 u32 pri_join_mask,
1322 u8 num_of_dif_pri)
1323{
1324 u8 i = 0;
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001325 u8 pg[DCBX_COS_MAX_NUM_E2] = { 0 };
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001326
1327 /* If there are both pauseable and non-pauseable priorities,
1328 * the pauseable priorities go to the first queue and
1329 * the non-pauseable priorities go to the second queue.
1330 */
1331 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pri_join_mask)) {
1332 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp,
1333 pg_help_data->data[0].pg_priority) ||
1334 IS_DCBX_PFC_PRI_MIX_PAUSE(bp,
1335 pg_help_data->data[1].pg_priority)) {
1336 /* If one PG contains both pauseable and
1337 * non-pauseable priorities then ETS is disabled.
1338 */
1339 bnx2x_dcbx_separate_pauseable_from_non(bp, cos_data,
1340 pg_pri_orginal_spread, ets);
1341 bp->dcbx_port_params.ets.enabled = false;
1342 return;
1343 }
1344
1345 /* Pauseable */
1346 cos_data->data[0].pausable = true;
1347 /* Non pauseable. */
1348 cos_data->data[1].pausable = false;
1349 if (IS_DCBX_PFC_PRI_ONLY_PAUSE(bp,
1350 pg_help_data->data[0].pg_priority)) {
1351 /* 0 is pauseable */
1352 cos_data->data[0].pri_join_mask =
1353 pg_help_data->data[0].pg_priority;
1354 pg[0] = pg_help_data->data[0].pg;
1355 cos_data->data[1].pri_join_mask =
1356 pg_help_data->data[1].pg_priority;
1357 pg[1] = pg_help_data->data[1].pg;
1358 } else {/* 1 is pauseable */
1359 cos_data->data[0].pri_join_mask =
1360 pg_help_data->data[1].pg_priority;
1361 pg[0] = pg_help_data->data[1].pg;
1362 cos_data->data[1].pri_join_mask =
1363 pg_help_data->data[0].pg_priority;
1364 pg[1] = pg_help_data->data[0].pg;
1365 }
1366 } else {
1367 /* If there are only pauseable priorities or
1368 * only non-pauseable, each PG goes to a queue.
1369 */
1370 cos_data->data[0].pausable = cos_data->data[1].pausable =
1371 IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask);
1372 cos_data->data[0].pri_join_mask =
1373 pg_help_data->data[0].pg_priority;
1374 pg[0] = pg_help_data->data[0].pg;
1375 cos_data->data[1].pri_join_mask =
1376 pg_help_data->data[1].pg_priority;
1377 pg[1] = pg_help_data->data[1].pg;
1378 }
1379
1380 /* There can be only one strict pg */
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001381 for (i = 0 ; i < ARRAY_SIZE(pg); i++) {
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001382 if (pg[i] < DCBX_MAX_NUM_PG_BW_ENTRIES)
1383 cos_data->data[i].cos_bw =
1384 DCBX_PG_BW_GET(ets->pg_bw_tbl, pg[i]);
1385 else
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001386 cos_data->data[i].strict =
1387 BNX2X_DCBX_STRICT_COS_HIGHEST;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001388 }
1389}
1390
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001391static int bnx2x_dcbx_join_pgs(
1392 struct bnx2x *bp,
1393 struct dcbx_ets_feature *ets,
1394 struct pg_help_data *pg_help_data,
1395 u8 required_num_of_pg)
1396{
1397 u8 entry_joined = pg_help_data->num_of_pg - 1;
1398 u8 entry_removed = entry_joined + 1;
1399 u8 pg_joined = 0;
1400
1401 if (required_num_of_pg == 0 || ARRAY_SIZE(pg_help_data->data)
1402 <= pg_help_data->num_of_pg) {
1403
1404 BNX2X_ERR("required_num_of_pg can't be zero\n");
1405 return -EINVAL;
1406 }
1407
1408 while (required_num_of_pg < pg_help_data->num_of_pg) {
1409 entry_joined = pg_help_data->num_of_pg - 2;
1410 entry_removed = entry_joined + 1;
1411 /* protect index */
1412 entry_removed %= ARRAY_SIZE(pg_help_data->data);
1413
1414 pg_help_data->data[entry_joined].pg_priority |=
1415 pg_help_data->data[entry_removed].pg_priority;
1416
1417 pg_help_data->data[entry_joined].num_of_dif_pri +=
1418 pg_help_data->data[entry_removed].num_of_dif_pri;
1419
1420 if (pg_help_data->data[entry_joined].pg == DCBX_STRICT_PRI_PG ||
1421 pg_help_data->data[entry_removed].pg == DCBX_STRICT_PRI_PG)
1422 /* Entries joined strict priority rules */
1423 pg_help_data->data[entry_joined].pg =
1424 DCBX_STRICT_PRI_PG;
1425 else {
1426 /* Entries can be joined join BW */
1427 pg_joined = DCBX_PG_BW_GET(ets->pg_bw_tbl,
1428 pg_help_data->data[entry_joined].pg) +
1429 DCBX_PG_BW_GET(ets->pg_bw_tbl,
1430 pg_help_data->data[entry_removed].pg);
1431
1432 DCBX_PG_BW_SET(ets->pg_bw_tbl,
1433 pg_help_data->data[entry_joined].pg, pg_joined);
1434 }
1435 /* Joined the entries */
1436 pg_help_data->num_of_pg--;
1437 }
1438
1439 return 0;
1440}
1441
1442static void bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params(
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001443 struct bnx2x *bp,
1444 struct pg_help_data *pg_help_data,
1445 struct dcbx_ets_feature *ets,
1446 struct cos_help_data *cos_data,
1447 u32 *pg_pri_orginal_spread,
1448 u32 pri_join_mask,
1449 u8 num_of_dif_pri)
1450{
1451 u8 i = 0;
1452 u32 pri_tested = 0;
1453 u8 entry = 0;
1454 u8 pg_entry = 0;
1455 bool b_found_strict = false;
1456 u8 num_of_pri = LLFC_DRIVER_TRAFFIC_TYPE_MAX;
1457
1458 cos_data->data[0].pri_join_mask = cos_data->data[1].pri_join_mask = 0;
1459 /* If there are both pauseable and non-pauseable priorities,
1460 * the pauseable priorities go to the first queue and the
1461 * non-pauseable priorities go to the second queue.
1462 */
1463 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pri_join_mask))
1464 bnx2x_dcbx_separate_pauseable_from_non(bp,
1465 cos_data, pg_pri_orginal_spread, ets);
1466 else {
1467 /* If two BW-limited PG-s were combined to one queue,
1468 * the BW is their sum.
1469 *
1470 * If there are only pauseable priorities or only non-pauseable,
1471 * and there are both BW-limited and non-BW-limited PG-s,
1472 * the BW-limited PG/s go to one queue and the non-BW-limited
1473 * PG/s go to the second queue.
1474 *
1475 * If there are only pauseable priorities or only non-pauseable
1476 * and all are BW limited, then two priorities go to the first
1477 * queue and one priority goes to the second queue.
1478 *
1479 * We will join this two cases:
1480 * if one is BW limited it will go to the secoend queue
1481 * otherwise the last priority will get it
1482 */
1483
1484 cos_data->data[0].pausable = cos_data->data[1].pausable =
1485 IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask);
1486
1487 for (i = 0 ; i < num_of_pri; i++) {
1488 pri_tested = 1 << bp->dcbx_port_params.
1489 app.traffic_type_priority[i];
1490 pg_entry = (u8)pg_pri_orginal_spread[bp->
1491 dcbx_port_params.app.traffic_type_priority[i]];
1492
1493 if (pg_entry < DCBX_MAX_NUM_PG_BW_ENTRIES) {
1494 entry = 0;
1495
1496 if (i == (num_of_pri-1) &&
1497 false == b_found_strict)
1498 /* last entry will be handled separately
1499 * If no priority is strict than last
1500 * enty goes to last queue.*/
1501 entry = 1;
1502 cos_data->data[entry].pri_join_mask |=
1503 pri_tested;
1504 bnx2x_dcbx_add_to_cos_bw(bp,
1505 &cos_data->data[entry],
1506 DCBX_PG_BW_GET(ets->pg_bw_tbl,
1507 pg_entry));
1508 } else {
1509 b_found_strict = true;
1510 cos_data->data[1].pri_join_mask |= pri_tested;
1511 /* If we join a group and one is strict
1512 * than the bw rulls */
1513 cos_data->data[1].strict =
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001514 BNX2X_DCBX_STRICT_COS_HIGHEST;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001515 }
1516 }
1517 }
1518}
1519
1520
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001521static void bnx2x_dcbx_2cos_limit_cee_fill_cos_params(struct bnx2x *bp,
1522 struct pg_help_data *help_data,
1523 struct dcbx_ets_feature *ets,
1524 struct cos_help_data *cos_data,
1525 u32 *pg_pri_orginal_spread,
1526 u32 pri_join_mask,
1527 u8 num_of_dif_pri)
1528{
1529
1530 /* default E2 settings */
1531 cos_data->num_of_cos = DCBX_COS_MAX_NUM_E2;
1532
1533 switch (help_data->num_of_pg) {
1534 case 1:
1535 bnx2x_dcbx_2cos_limit_cee_single_pg_to_cos_params(
1536 bp,
1537 help_data,
1538 cos_data,
1539 pri_join_mask,
1540 num_of_dif_pri);
1541 break;
1542 case 2:
1543 bnx2x_dcbx_2cos_limit_cee_two_pg_to_cos_params(
1544 bp,
1545 help_data,
1546 ets,
1547 cos_data,
1548 pg_pri_orginal_spread,
1549 pri_join_mask,
1550 num_of_dif_pri);
1551 break;
1552
1553 case 3:
1554 bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params(
1555 bp,
1556 help_data,
1557 ets,
1558 cos_data,
1559 pg_pri_orginal_spread,
1560 pri_join_mask,
1561 num_of_dif_pri);
1562 break;
1563 default:
1564 BNX2X_ERR("Wrong pg_help_data.num_of_pg\n");
1565 bnx2x_dcbx_ets_disabled_entry_data(bp,
1566 cos_data, pri_join_mask);
1567 }
1568}
1569
1570static int bnx2x_dcbx_spread_strict_pri(struct bnx2x *bp,
1571 struct cos_help_data *cos_data,
1572 u8 entry,
1573 u8 num_spread_of_entries,
1574 u8 strict_app_pris)
1575{
1576 u8 strict_pri = BNX2X_DCBX_STRICT_COS_HIGHEST;
1577 u8 num_of_app_pri = MAX_PFC_PRIORITIES;
1578 u8 app_pri_bit = 0;
1579
1580 while (num_spread_of_entries && num_of_app_pri > 0) {
1581 app_pri_bit = 1 << (num_of_app_pri - 1);
1582 if (app_pri_bit & strict_app_pris) {
1583 struct cos_entry_help_data *data = &cos_data->
1584 data[entry];
1585 num_spread_of_entries--;
1586 if (num_spread_of_entries == 0) {
1587 /* last entry needed put all the entries left */
1588 data->cos_bw = DCBX_INVALID_COS_BW;
1589 data->strict = strict_pri;
1590 data->pri_join_mask = strict_app_pris;
1591 data->pausable = DCBX_IS_PFC_PRI_SOME_PAUSE(bp,
1592 data->pri_join_mask);
1593 } else {
1594 strict_app_pris &= ~app_pri_bit;
1595
1596 data->cos_bw = DCBX_INVALID_COS_BW;
1597 data->strict = strict_pri;
1598 data->pri_join_mask = app_pri_bit;
1599 data->pausable = DCBX_IS_PFC_PRI_SOME_PAUSE(bp,
1600 data->pri_join_mask);
1601 }
1602
1603 strict_pri =
1604 BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(strict_pri);
1605 entry++;
1606 }
1607
1608 num_of_app_pri--;
1609 }
1610
1611 if (num_spread_of_entries)
1612 return -EINVAL;
1613
1614 return 0;
1615}
1616
1617static u8 bnx2x_dcbx_cee_fill_strict_pri(struct bnx2x *bp,
1618 struct cos_help_data *cos_data,
1619 u8 entry,
1620 u8 num_spread_of_entries,
1621 u8 strict_app_pris)
1622{
1623
1624 if (bnx2x_dcbx_spread_strict_pri(bp, cos_data, entry,
1625 num_spread_of_entries,
1626 strict_app_pris)) {
1627 struct cos_entry_help_data *data = &cos_data->
1628 data[entry];
1629 /* Fill BW entry */
1630 data->cos_bw = DCBX_INVALID_COS_BW;
1631 data->strict = BNX2X_DCBX_STRICT_COS_HIGHEST;
1632 data->pri_join_mask = strict_app_pris;
1633 data->pausable = DCBX_IS_PFC_PRI_SOME_PAUSE(bp,
1634 data->pri_join_mask);
1635 return 1;
1636 }
1637
1638 return num_spread_of_entries;
1639}
1640
1641static void bnx2x_dcbx_cee_fill_cos_params(struct bnx2x *bp,
1642 struct pg_help_data *help_data,
1643 struct dcbx_ets_feature *ets,
1644 struct cos_help_data *cos_data,
1645 u32 pri_join_mask)
1646
1647{
1648 u8 need_num_of_entries = 0;
1649 u8 i = 0;
1650 u8 entry = 0;
1651
1652 /*
1653 * if the number of requested PG-s in CEE is greater than 3
1654 * then the results are not determined since this is a violation
1655 * of the standard.
1656 */
1657 if (help_data->num_of_pg > DCBX_COS_MAX_NUM_E3B0) {
1658 if (bnx2x_dcbx_join_pgs(bp, ets, help_data,
1659 DCBX_COS_MAX_NUM_E3B0)) {
1660 BNX2X_ERR("Unable to reduce the number of PGs -"
1661 "we will disables ETS\n");
1662 bnx2x_dcbx_ets_disabled_entry_data(bp, cos_data,
1663 pri_join_mask);
1664 return;
1665 }
1666 }
1667
1668 for (i = 0 ; i < help_data->num_of_pg; i++) {
1669 struct pg_entry_help_data *pg = &help_data->data[i];
1670 if (pg->pg < DCBX_MAX_NUM_PG_BW_ENTRIES) {
1671 struct cos_entry_help_data *data = &cos_data->
1672 data[entry];
1673 /* Fill BW entry */
1674 data->cos_bw = DCBX_PG_BW_GET(ets->pg_bw_tbl, pg->pg);
1675 data->strict = BNX2X_DCBX_STRICT_INVALID;
1676 data->pri_join_mask = pg->pg_priority;
1677 data->pausable = DCBX_IS_PFC_PRI_SOME_PAUSE(bp,
1678 data->pri_join_mask);
1679
1680 entry++;
1681 } else {
1682 need_num_of_entries = min_t(u8,
1683 (u8)pg->num_of_dif_pri,
1684 (u8)DCBX_COS_MAX_NUM_E3B0 -
1685 help_data->num_of_pg + 1);
1686 /*
1687 * If there are still VOQ-s which have no associated PG,
1688 * then associate these VOQ-s to PG15. These PG-s will
1689 * be used for SP between priorities on PG15.
1690 */
1691 entry += bnx2x_dcbx_cee_fill_strict_pri(bp, cos_data,
1692 entry, need_num_of_entries, pg->pg_priority);
1693 }
1694 }
1695
1696 /* the entry will represent the number of COSes used */
1697 cos_data->num_of_cos = entry;
1698}
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001699static void bnx2x_dcbx_fill_cos_params(struct bnx2x *bp,
1700 struct pg_help_data *help_data,
1701 struct dcbx_ets_feature *ets,
1702 u32 *pg_pri_orginal_spread)
1703{
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001704 struct cos_help_data cos_data;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001705 u8 i = 0;
1706 u32 pri_join_mask = 0;
1707 u8 num_of_dif_pri = 0;
1708
1709 memset(&cos_data, 0, sizeof(cos_data));
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001710
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001711 /* Validate the pg value */
1712 for (i = 0; i < help_data->num_of_pg ; i++) {
1713 if (DCBX_STRICT_PRIORITY != help_data->data[i].pg &&
1714 DCBX_MAX_NUM_PG_BW_ENTRIES <= help_data->data[i].pg)
1715 BNX2X_ERR("Invalid pg[%d] data %x\n", i,
1716 help_data->data[i].pg);
1717 pri_join_mask |= help_data->data[i].pg_priority;
1718 num_of_dif_pri += help_data->data[i].num_of_dif_pri;
1719 }
1720
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001721 /* defaults */
1722 cos_data.num_of_cos = 1;
1723 for (i = 0; i < ARRAY_SIZE(cos_data.data); i++) {
1724 cos_data.data[i].pri_join_mask = 0;
1725 cos_data.data[i].pausable = false;
1726 cos_data.data[i].strict = BNX2X_DCBX_STRICT_INVALID;
1727 cos_data.data[i].cos_bw = DCBX_INVALID_COS_BW;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001728 }
1729
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001730 if (CHIP_IS_E3B0(bp))
1731 bnx2x_dcbx_cee_fill_cos_params(bp, help_data, ets,
1732 &cos_data, pri_join_mask);
1733 else /* E2 + E3A0 */
1734 bnx2x_dcbx_2cos_limit_cee_fill_cos_params(bp,
1735 help_data, ets,
1736 &cos_data,
1737 pg_pri_orginal_spread,
1738 pri_join_mask,
1739 num_of_dif_pri);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001740
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001741
1742 for (i = 0; i < cos_data.num_of_cos ; i++) {
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001743 struct bnx2x_dcbx_cos_params *p =
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001744 &bp->dcbx_port_params.ets.cos_params[i];
1745
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001746 p->strict = cos_data.data[i].strict;
1747 p->bw_tbl = cos_data.data[i].cos_bw;
1748 p->pri_bitmask = cos_data.data[i].pri_join_mask;
1749 p->pauseable = cos_data.data[i].pausable;
1750
1751 /* sanity */
1752 if (p->bw_tbl != DCBX_INVALID_COS_BW ||
1753 p->strict != BNX2X_DCBX_STRICT_INVALID) {
1754 if (p->pri_bitmask == 0)
1755 BNX2X_ERR("Invalid pri_bitmask for %d\n", i);
1756
1757 if (CHIP_IS_E2(bp) || CHIP_IS_E3A0(bp)) {
1758
1759 if (p->pauseable &&
1760 DCBX_PFC_PRI_GET_NON_PAUSE(bp,
1761 p->pri_bitmask) != 0)
1762 BNX2X_ERR("Inconsistent config for "
1763 "pausable COS %d\n", i);
1764
1765 if (!p->pauseable &&
1766 DCBX_PFC_PRI_GET_PAUSE(bp,
1767 p->pri_bitmask) != 0)
1768 BNX2X_ERR("Inconsistent config for "
1769 "nonpausable COS %d\n", i);
1770 }
1771 }
1772
1773 if (p->pauseable)
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001774 DP(NETIF_MSG_LINK, "COS %d PAUSABLE prijoinmask 0x%x\n",
1775 i, cos_data.data[i].pri_join_mask);
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001776 else
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001777 DP(NETIF_MSG_LINK, "COS %d NONPAUSABLE prijoinmask "
1778 "0x%x\n",
1779 i, cos_data.data[i].pri_join_mask);
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001780 }
1781
1782 bp->dcbx_port_params.ets.num_of_cos = cos_data.num_of_cos ;
1783}
1784
1785static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp,
1786 u32 *set_configuration_ets_pg,
1787 u32 *pri_pg_tbl)
1788{
1789 int i;
1790
1791 for (i = 0; i < DCBX_MAX_NUM_PRI_PG_ENTRIES; i++) {
1792 set_configuration_ets_pg[i] = DCBX_PRI_PG_GET(pri_pg_tbl, i);
1793
1794 DP(NETIF_MSG_LINK, "set_configuration_ets_pg[%d] = 0x%x\n",
1795 i, set_configuration_ets_pg[i]);
1796 }
1797}
1798
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00001799static void bnx2x_dcbx_fw_struct(struct bnx2x *bp)
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001800{
Shmulik Ravid785b9b12010-12-30 06:27:03 +00001801 struct flow_control_configuration *pfc_fw_cfg = NULL;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001802 u16 pri_bit = 0;
1803 u8 cos = 0, pri = 0;
1804 struct priority_cos *tt2cos;
1805 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
1806
1807 pfc_fw_cfg = (struct flow_control_configuration *)
1808 bnx2x_sp(bp, pfc_config);
1809 memset(pfc_fw_cfg, 0, sizeof(struct flow_control_configuration));
1810
1811 /*shortcut*/
1812 tt2cos = pfc_fw_cfg->traffic_type_to_priority_cos;
1813
1814 /* Fw version should be incremented each update */
1815 pfc_fw_cfg->dcb_version = ++bp->dcb_version;
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001816 pfc_fw_cfg->dcb_enabled = 1;
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001817
1818 /* Fill priority parameters */
1819 for (pri = 0; pri < LLFC_DRIVER_TRAFFIC_TYPE_MAX; pri++) {
1820 tt2cos[pri].priority = ttp[pri];
1821 pri_bit = 1 << tt2cos[pri].priority;
1822
1823 /* Fill COS parameters based on COS calculated to
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001824 * make it more general for future use */
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001825 for (cos = 0; cos < bp->dcbx_port_params.ets.num_of_cos; cos++)
1826 if (bp->dcbx_port_params.ets.cos_params[cos].
1827 pri_bitmask & pri_bit)
1828 tt2cos[pri].cos = cos;
1829 }
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001830
1831 /* we never want the FW to add a 0 vlan tag */
1832 pfc_fw_cfg->dont_add_pri_0_en = 1;
1833
Vladislav Zolotarove4901dd2010-12-13 05:44:18 +00001834 bnx2x_dcbx_print_cos_params(bp, pfc_fw_cfg);
1835}
Vlad Zolotarov619c5cb2011-06-14 14:33:44 +03001836
1837void bnx2x_dcbx_pmf_update(struct bnx2x *bp)
1838{
1839 /* if we need to syncronize DCBX result from prev PMF
1840 * read it from shmem and update bp accordingly
1841 */
1842 if (SHMEM2_HAS(bp, drv_flags) &&
1843 GET_FLAGS(SHMEM2_RD(bp, drv_flags), DRV_FLAGS_DCB_CONFIGURED)) {
1844 /* Read neg results if dcbx is in the FW */
1845 if (bnx2x_dcbx_read_shmem_neg_results(bp))
1846 return;
1847
1848 bnx2x_dump_dcbx_drv_param(bp, &bp->dcbx_local_feat,
1849 bp->dcbx_error);
1850 bnx2x_get_dcbx_drv_param(bp, &bp->dcbx_local_feat,
1851 bp->dcbx_error);
1852 }
1853}
1854
Shmulik Ravid785b9b12010-12-30 06:27:03 +00001855/* DCB netlink */
Shmulik Ravid98507672011-02-28 12:19:55 -08001856#ifdef BCM_DCBNL
Shmulik Ravid785b9b12010-12-30 06:27:03 +00001857
1858#define BNX2X_DCBX_CAPS (DCB_CAP_DCBX_LLD_MANAGED | \
1859 DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_STATIC)
1860
1861static inline bool bnx2x_dcbnl_set_valid(struct bnx2x *bp)
1862{
1863 /* validate dcbnl call that may change HW state:
1864 * DCB is on and DCBX mode was SUCCESSFULLY set by the user.
1865 */
1866 return bp->dcb_state && bp->dcbx_mode_uset;
1867}
1868
1869static u8 bnx2x_dcbnl_get_state(struct net_device *netdev)
1870{
1871 struct bnx2x *bp = netdev_priv(netdev);
1872 DP(NETIF_MSG_LINK, "state = %d\n", bp->dcb_state);
1873 return bp->dcb_state;
1874}
1875
1876static u8 bnx2x_dcbnl_set_state(struct net_device *netdev, u8 state)
1877{
1878 struct bnx2x *bp = netdev_priv(netdev);
1879 DP(NETIF_MSG_LINK, "state = %s\n", state ? "on" : "off");
1880
1881 bnx2x_dcbx_set_state(bp, (state ? true : false), bp->dcbx_enabled);
1882 return 0;
1883}
1884
1885static void bnx2x_dcbnl_get_perm_hw_addr(struct net_device *netdev,
1886 u8 *perm_addr)
1887{
1888 struct bnx2x *bp = netdev_priv(netdev);
1889 DP(NETIF_MSG_LINK, "GET-PERM-ADDR\n");
1890
1891 /* first the HW mac address */
1892 memcpy(perm_addr, netdev->dev_addr, netdev->addr_len);
1893
1894#ifdef BCM_CNIC
1895 /* second SAN address */
1896 memcpy(perm_addr+netdev->addr_len, bp->fip_mac, netdev->addr_len);
1897#endif
1898}
1899
1900static void bnx2x_dcbnl_set_pg_tccfg_tx(struct net_device *netdev, int prio,
1901 u8 prio_type, u8 pgid, u8 bw_pct,
1902 u8 up_map)
1903{
1904 struct bnx2x *bp = netdev_priv(netdev);
1905
1906 DP(NETIF_MSG_LINK, "prio[%d] = %d\n", prio, pgid);
1907 if (!bnx2x_dcbnl_set_valid(bp) || prio >= DCBX_MAX_NUM_PRI_PG_ENTRIES)
1908 return;
1909
1910 /**
1911 * bw_pct ingnored - band-width percentage devision between user
1912 * priorities within the same group is not
1913 * standard and hence not supported
1914 *
1915 * prio_type igonred - priority levels within the same group are not
1916 * standard and hence are not supported. According
1917 * to the standard pgid 15 is dedicated to strict
1918 * prioirty traffic (on the port level).
1919 *
1920 * up_map ignored
1921 */
1922
1923 bp->dcbx_config_params.admin_configuration_ets_pg[prio] = pgid;
1924 bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1;
1925}
1926
1927static void bnx2x_dcbnl_set_pg_bwgcfg_tx(struct net_device *netdev,
1928 int pgid, u8 bw_pct)
1929{
1930 struct bnx2x *bp = netdev_priv(netdev);
1931 DP(NETIF_MSG_LINK, "pgid[%d] = %d\n", pgid, bw_pct);
1932
1933 if (!bnx2x_dcbnl_set_valid(bp) || pgid >= DCBX_MAX_NUM_PG_BW_ENTRIES)
1934 return;
1935
1936 bp->dcbx_config_params.admin_configuration_bw_precentage[pgid] = bw_pct;
1937 bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1;
1938}
1939
1940static void bnx2x_dcbnl_set_pg_tccfg_rx(struct net_device *netdev, int prio,
1941 u8 prio_type, u8 pgid, u8 bw_pct,
1942 u8 up_map)
1943{
1944 struct bnx2x *bp = netdev_priv(netdev);
1945 DP(NETIF_MSG_LINK, "Nothing to set; No RX support\n");
1946}
1947
1948static void bnx2x_dcbnl_set_pg_bwgcfg_rx(struct net_device *netdev,
1949 int pgid, u8 bw_pct)
1950{
1951 struct bnx2x *bp = netdev_priv(netdev);
1952 DP(NETIF_MSG_LINK, "Nothing to set; No RX support\n");
1953}
1954
1955static void bnx2x_dcbnl_get_pg_tccfg_tx(struct net_device *netdev, int prio,
1956 u8 *prio_type, u8 *pgid, u8 *bw_pct,
1957 u8 *up_map)
1958{
1959 struct bnx2x *bp = netdev_priv(netdev);
1960 DP(NETIF_MSG_LINK, "prio = %d\n", prio);
1961
1962 /**
1963 * bw_pct ingnored - band-width percentage devision between user
1964 * priorities within the same group is not
1965 * standard and hence not supported
1966 *
1967 * prio_type igonred - priority levels within the same group are not
1968 * standard and hence are not supported. According
1969 * to the standard pgid 15 is dedicated to strict
1970 * prioirty traffic (on the port level).
1971 *
1972 * up_map ignored
1973 */
1974 *up_map = *bw_pct = *prio_type = *pgid = 0;
1975
1976 if (!bp->dcb_state || prio >= DCBX_MAX_NUM_PRI_PG_ENTRIES)
1977 return;
1978
1979 *pgid = DCBX_PRI_PG_GET(bp->dcbx_local_feat.ets.pri_pg_tbl, prio);
1980}
1981
1982static void bnx2x_dcbnl_get_pg_bwgcfg_tx(struct net_device *netdev,
1983 int pgid, u8 *bw_pct)
1984{
1985 struct bnx2x *bp = netdev_priv(netdev);
1986 DP(NETIF_MSG_LINK, "pgid = %d\n", pgid);
1987
1988 *bw_pct = 0;
1989
1990 if (!bp->dcb_state || pgid >= DCBX_MAX_NUM_PG_BW_ENTRIES)
1991 return;
1992
1993 *bw_pct = DCBX_PG_BW_GET(bp->dcbx_local_feat.ets.pg_bw_tbl, pgid);
1994}
1995
1996static void bnx2x_dcbnl_get_pg_tccfg_rx(struct net_device *netdev, int prio,
1997 u8 *prio_type, u8 *pgid, u8 *bw_pct,
1998 u8 *up_map)
1999{
2000 struct bnx2x *bp = netdev_priv(netdev);
2001 DP(NETIF_MSG_LINK, "Nothing to get; No RX support\n");
2002
2003 *prio_type = *pgid = *bw_pct = *up_map = 0;
2004}
2005
2006static void bnx2x_dcbnl_get_pg_bwgcfg_rx(struct net_device *netdev,
2007 int pgid, u8 *bw_pct)
2008{
2009 struct bnx2x *bp = netdev_priv(netdev);
2010 DP(NETIF_MSG_LINK, "Nothing to get; No RX support\n");
2011
2012 *bw_pct = 0;
2013}
2014
2015static void bnx2x_dcbnl_set_pfc_cfg(struct net_device *netdev, int prio,
2016 u8 setting)
2017{
2018 struct bnx2x *bp = netdev_priv(netdev);
2019 DP(NETIF_MSG_LINK, "prio[%d] = %d\n", prio, setting);
2020
2021 if (!bnx2x_dcbnl_set_valid(bp) || prio >= MAX_PFC_PRIORITIES)
2022 return;
2023
2024 bp->dcbx_config_params.admin_pfc_bitmap |= ((setting ? 1 : 0) << prio);
2025
2026 if (setting)
2027 bp->dcbx_config_params.admin_pfc_tx_enable = 1;
2028}
2029
2030static void bnx2x_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio,
2031 u8 *setting)
2032{
2033 struct bnx2x *bp = netdev_priv(netdev);
2034 DP(NETIF_MSG_LINK, "prio = %d\n", prio);
2035
2036 *setting = 0;
2037
2038 if (!bp->dcb_state || prio >= MAX_PFC_PRIORITIES)
2039 return;
2040
2041 *setting = (bp->dcbx_local_feat.pfc.pri_en_bitmap >> prio) & 0x1;
2042}
2043
2044static u8 bnx2x_dcbnl_set_all(struct net_device *netdev)
2045{
2046 struct bnx2x *bp = netdev_priv(netdev);
2047 int rc = 0;
2048
2049 DP(NETIF_MSG_LINK, "SET-ALL\n");
2050
2051 if (!bnx2x_dcbnl_set_valid(bp))
2052 return 1;
2053
2054 if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
2055 netdev_err(bp->dev, "Handling parity error recovery. "
2056 "Try again later\n");
2057 return 1;
2058 }
2059 if (netif_running(bp->dev)) {
2060 bnx2x_nic_unload(bp, UNLOAD_NORMAL);
2061 rc = bnx2x_nic_load(bp, LOAD_NORMAL);
2062 }
2063 DP(NETIF_MSG_LINK, "set_dcbx_params done (%d)\n", rc);
2064 if (rc)
2065 return 1;
2066
2067 return 0;
2068}
2069
2070static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap)
2071{
2072 struct bnx2x *bp = netdev_priv(netdev);
2073 u8 rval = 0;
2074
2075 if (bp->dcb_state) {
2076 switch (capid) {
2077 case DCB_CAP_ATTR_PG:
2078 *cap = true;
2079 break;
2080 case DCB_CAP_ATTR_PFC:
2081 *cap = true;
2082 break;
2083 case DCB_CAP_ATTR_UP2TC:
2084 *cap = false;
2085 break;
2086 case DCB_CAP_ATTR_PG_TCS:
2087 *cap = 0x80; /* 8 priorities for PGs */
2088 break;
2089 case DCB_CAP_ATTR_PFC_TCS:
2090 *cap = 0x80; /* 8 priorities for PFC */
2091 break;
2092 case DCB_CAP_ATTR_GSP:
2093 *cap = true;
2094 break;
2095 case DCB_CAP_ATTR_BCN:
2096 *cap = false;
2097 break;
2098 case DCB_CAP_ATTR_DCBX:
2099 *cap = BNX2X_DCBX_CAPS;
2100 default:
2101 rval = -EINVAL;
2102 break;
2103 }
2104 } else
2105 rval = -EINVAL;
2106
2107 DP(NETIF_MSG_LINK, "capid %d:%x\n", capid, *cap);
2108 return rval;
2109}
2110
2111static u8 bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num)
2112{
2113 struct bnx2x *bp = netdev_priv(netdev);
2114 u8 rval = 0;
2115
2116 DP(NETIF_MSG_LINK, "tcid %d\n", tcid);
2117
2118 if (bp->dcb_state) {
2119 switch (tcid) {
2120 case DCB_NUMTCS_ATTR_PG:
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00002121 *num = CHIP_IS_E3B0(bp) ? DCBX_COS_MAX_NUM_E3B0 :
2122 DCBX_COS_MAX_NUM_E2;
Shmulik Ravid785b9b12010-12-30 06:27:03 +00002123 break;
2124 case DCB_NUMTCS_ATTR_PFC:
Dmitry Kravkovd1976b22011-06-14 01:34:42 +00002125 *num = CHIP_IS_E3B0(bp) ? DCBX_COS_MAX_NUM_E3B0 :
2126 DCBX_COS_MAX_NUM_E2;
Shmulik Ravid785b9b12010-12-30 06:27:03 +00002127 break;
2128 default:
2129 rval = -EINVAL;
2130 break;
2131 }
2132 } else
2133 rval = -EINVAL;
2134
2135 return rval;
2136}
2137
2138static u8 bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num)
2139{
2140 struct bnx2x *bp = netdev_priv(netdev);
2141 DP(NETIF_MSG_LINK, "num tcs = %d; Not supported\n", num);
2142 return -EINVAL;
2143}
2144
2145static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev)
2146{
2147 struct bnx2x *bp = netdev_priv(netdev);
2148 DP(NETIF_MSG_LINK, "state = %d\n", bp->dcbx_local_feat.pfc.enabled);
2149
2150 if (!bp->dcb_state)
2151 return 0;
2152
2153 return bp->dcbx_local_feat.pfc.enabled;
2154}
2155
2156static void bnx2x_dcbnl_set_pfc_state(struct net_device *netdev, u8 state)
2157{
2158 struct bnx2x *bp = netdev_priv(netdev);
2159 DP(NETIF_MSG_LINK, "state = %s\n", state ? "on" : "off");
2160
2161 if (!bnx2x_dcbnl_set_valid(bp))
2162 return;
2163
2164 bp->dcbx_config_params.admin_pfc_tx_enable =
2165 bp->dcbx_config_params.admin_pfc_enable = (state ? 1 : 0);
2166}
2167
Shmulik Ravid785b9b12010-12-30 06:27:03 +00002168static void bnx2x_admin_app_set_ent(
2169 struct bnx2x_admin_priority_app_table *app_ent,
2170 u8 idtype, u16 idval, u8 up)
2171{
2172 app_ent->valid = 1;
2173
2174 switch (idtype) {
2175 case DCB_APP_IDTYPE_ETHTYPE:
2176 app_ent->traffic_type = TRAFFIC_TYPE_ETH;
2177 break;
2178 case DCB_APP_IDTYPE_PORTNUM:
2179 app_ent->traffic_type = TRAFFIC_TYPE_PORT;
2180 break;
2181 default:
2182 break; /* never gets here */
2183 }
2184 app_ent->app_id = idval;
2185 app_ent->priority = up;
2186}
2187
2188static bool bnx2x_admin_app_is_equal(
2189 struct bnx2x_admin_priority_app_table *app_ent,
2190 u8 idtype, u16 idval)
2191{
2192 if (!app_ent->valid)
2193 return false;
2194
2195 switch (idtype) {
2196 case DCB_APP_IDTYPE_ETHTYPE:
2197 if (app_ent->traffic_type != TRAFFIC_TYPE_ETH)
2198 return false;
2199 break;
2200 case DCB_APP_IDTYPE_PORTNUM:
2201 if (app_ent->traffic_type != TRAFFIC_TYPE_PORT)
2202 return false;
2203 break;
2204 default:
2205 return false;
2206 }
2207 if (app_ent->app_id != idval)
2208 return false;
2209
2210 return true;
2211}
2212
2213static int bnx2x_set_admin_app_up(struct bnx2x *bp, u8 idtype, u16 idval, u8 up)
2214{
2215 int i, ff;
2216
2217 /* iterate over the app entries looking for idtype and idval */
2218 for (i = 0, ff = -1; i < 4; i++) {
2219 struct bnx2x_admin_priority_app_table *app_ent =
2220 &bp->dcbx_config_params.admin_priority_app_table[i];
2221 if (bnx2x_admin_app_is_equal(app_ent, idtype, idval))
2222 break;
2223
2224 if (ff < 0 && !app_ent->valid)
2225 ff = i;
2226 }
2227 if (i < 4)
2228 /* if found overwrite up */
2229 bp->dcbx_config_params.
2230 admin_priority_app_table[i].priority = up;
2231 else if (ff >= 0)
2232 /* not found use first-free */
2233 bnx2x_admin_app_set_ent(
2234 &bp->dcbx_config_params.admin_priority_app_table[ff],
2235 idtype, idval, up);
2236 else
2237 /* app table is full */
2238 return -EBUSY;
2239
2240 /* up configured, if not 0 make sure feature is enabled */
2241 if (up)
2242 bp->dcbx_config_params.admin_application_priority_tx_enable = 1;
2243
2244 return 0;
2245}
2246
2247static u8 bnx2x_dcbnl_set_app_up(struct net_device *netdev, u8 idtype,
2248 u16 idval, u8 up)
2249{
2250 struct bnx2x *bp = netdev_priv(netdev);
2251
2252 DP(NETIF_MSG_LINK, "app_type %d, app_id %x, prio bitmap %d\n",
2253 idtype, idval, up);
2254
2255 if (!bnx2x_dcbnl_set_valid(bp))
2256 return -EINVAL;
2257
2258 /* verify idtype */
2259 switch (idtype) {
2260 case DCB_APP_IDTYPE_ETHTYPE:
2261 case DCB_APP_IDTYPE_PORTNUM:
2262 break;
2263 default:
2264 return -EINVAL;
2265 }
2266 return bnx2x_set_admin_app_up(bp, idtype, idval, up);
2267}
2268
Shmulik Ravid785b9b12010-12-30 06:27:03 +00002269static u8 bnx2x_dcbnl_get_dcbx(struct net_device *netdev)
2270{
2271 struct bnx2x *bp = netdev_priv(netdev);
2272 u8 state;
2273
2274 state = DCB_CAP_DCBX_LLD_MANAGED | DCB_CAP_DCBX_VER_CEE;
2275
2276 if (bp->dcbx_enabled == BNX2X_DCBX_ENABLED_ON_NEG_OFF)
2277 state |= DCB_CAP_DCBX_STATIC;
2278
2279 return state;
2280}
2281
2282static u8 bnx2x_dcbnl_set_dcbx(struct net_device *netdev, u8 state)
2283{
2284 struct bnx2x *bp = netdev_priv(netdev);
2285 DP(NETIF_MSG_LINK, "state = %02x\n", state);
2286
2287 /* set dcbx mode */
2288
2289 if ((state & BNX2X_DCBX_CAPS) != state) {
2290 BNX2X_ERR("Requested DCBX mode %x is beyond advertised "
2291 "capabilities\n", state);
2292 return 1;
2293 }
2294
2295 if (bp->dcb_state != BNX2X_DCB_STATE_ON) {
2296 BNX2X_ERR("DCB turned off, DCBX configuration is invalid\n");
2297 return 1;
2298 }
2299
2300 if (state & DCB_CAP_DCBX_STATIC)
2301 bp->dcbx_enabled = BNX2X_DCBX_ENABLED_ON_NEG_OFF;
2302 else
2303 bp->dcbx_enabled = BNX2X_DCBX_ENABLED_ON_NEG_ON;
2304
2305 bp->dcbx_mode_uset = true;
2306 return 0;
2307}
2308
Shmulik Ravid785b9b12010-12-30 06:27:03 +00002309static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid,
2310 u8 *flags)
2311{
2312 struct bnx2x *bp = netdev_priv(netdev);
2313 u8 rval = 0;
2314
2315 DP(NETIF_MSG_LINK, "featid %d\n", featid);
2316
2317 if (bp->dcb_state) {
2318 *flags = 0;
2319 switch (featid) {
2320 case DCB_FEATCFG_ATTR_PG:
2321 if (bp->dcbx_local_feat.ets.enabled)
2322 *flags |= DCB_FEATCFG_ENABLE;
2323 if (bp->dcbx_error & DCBX_LOCAL_ETS_ERROR)
2324 *flags |= DCB_FEATCFG_ERROR;
2325 break;
2326 case DCB_FEATCFG_ATTR_PFC:
2327 if (bp->dcbx_local_feat.pfc.enabled)
2328 *flags |= DCB_FEATCFG_ENABLE;
2329 if (bp->dcbx_error & (DCBX_LOCAL_PFC_ERROR |
2330 DCBX_LOCAL_PFC_MISMATCH))
2331 *flags |= DCB_FEATCFG_ERROR;
2332 break;
2333 case DCB_FEATCFG_ATTR_APP:
2334 if (bp->dcbx_local_feat.app.enabled)
2335 *flags |= DCB_FEATCFG_ENABLE;
2336 if (bp->dcbx_error & (DCBX_LOCAL_APP_ERROR |
2337 DCBX_LOCAL_APP_MISMATCH))
2338 *flags |= DCB_FEATCFG_ERROR;
2339 break;
2340 default:
2341 rval = -EINVAL;
2342 break;
2343 }
2344 } else
2345 rval = -EINVAL;
2346
2347 return rval;
2348}
2349
2350static u8 bnx2x_dcbnl_set_featcfg(struct net_device *netdev, int featid,
2351 u8 flags)
2352{
2353 struct bnx2x *bp = netdev_priv(netdev);
2354 u8 rval = 0;
2355
2356 DP(NETIF_MSG_LINK, "featid = %d flags = %02x\n", featid, flags);
2357
2358 /* ignore the 'advertise' flag */
2359 if (bnx2x_dcbnl_set_valid(bp)) {
2360 switch (featid) {
2361 case DCB_FEATCFG_ATTR_PG:
2362 bp->dcbx_config_params.admin_ets_enable =
2363 flags & DCB_FEATCFG_ENABLE ? 1 : 0;
2364 bp->dcbx_config_params.admin_ets_willing =
2365 flags & DCB_FEATCFG_WILLING ? 1 : 0;
2366 break;
2367 case DCB_FEATCFG_ATTR_PFC:
2368 bp->dcbx_config_params.admin_pfc_enable =
2369 flags & DCB_FEATCFG_ENABLE ? 1 : 0;
2370 bp->dcbx_config_params.admin_pfc_willing =
2371 flags & DCB_FEATCFG_WILLING ? 1 : 0;
2372 break;
2373 case DCB_FEATCFG_ATTR_APP:
2374 /* ignore enable, always enabled */
2375 bp->dcbx_config_params.admin_app_priority_willing =
2376 flags & DCB_FEATCFG_WILLING ? 1 : 0;
2377 break;
2378 default:
2379 rval = -EINVAL;
2380 break;
2381 }
2382 } else
2383 rval = -EINVAL;
2384
2385 return rval;
2386}
2387
Shmulik Ravid0be6bc62011-05-18 02:55:31 +00002388static int bnx2x_peer_appinfo(struct net_device *netdev,
2389 struct dcb_peer_app_info *info, u16* app_count)
2390{
2391 int i;
2392 struct bnx2x *bp = netdev_priv(netdev);
2393
2394 DP(NETIF_MSG_LINK, "APP-INFO\n");
2395
2396 info->willing = (bp->dcbx_remote_flags & DCBX_APP_REM_WILLING) ?: 0;
2397 info->error = (bp->dcbx_remote_flags & DCBX_APP_RX_ERROR) ?: 0;
2398 *app_count = 0;
2399
2400 for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++)
2401 if (bp->dcbx_remote_feat.app.app_pri_tbl[i].appBitfield &
2402 DCBX_APP_ENTRY_VALID)
2403 (*app_count)++;
2404 return 0;
2405}
2406
2407static int bnx2x_peer_apptable(struct net_device *netdev,
2408 struct dcb_app *table)
2409{
2410 int i, j;
2411 struct bnx2x *bp = netdev_priv(netdev);
2412
2413 DP(NETIF_MSG_LINK, "APP-TABLE\n");
2414
2415 for (i = 0, j = 0; i < DCBX_MAX_APP_PROTOCOL; i++) {
2416 struct dcbx_app_priority_entry *ent =
2417 &bp->dcbx_remote_feat.app.app_pri_tbl[i];
2418
2419 if (ent->appBitfield & DCBX_APP_ENTRY_VALID) {
2420 table[j].selector = bnx2x_dcbx_dcbnl_app_idtype(ent);
2421 table[j].priority = bnx2x_dcbx_dcbnl_app_up(ent);
2422 table[j++].protocol = ent->app_id;
2423 }
2424 }
2425 return 0;
2426}
2427
2428static int bnx2x_cee_peer_getpg(struct net_device *netdev, struct cee_pg *pg)
2429{
2430 int i;
2431 struct bnx2x *bp = netdev_priv(netdev);
2432
2433 pg->willing = (bp->dcbx_remote_flags & DCBX_ETS_REM_WILLING) ?: 0;
2434
2435 for (i = 0; i < CEE_DCBX_MAX_PGS; i++) {
2436 pg->pg_bw[i] =
2437 DCBX_PG_BW_GET(bp->dcbx_remote_feat.ets.pg_bw_tbl, i);
2438 pg->prio_pg[i] =
2439 DCBX_PRI_PG_GET(bp->dcbx_remote_feat.ets.pri_pg_tbl, i);
2440 }
2441 return 0;
2442}
2443
2444static int bnx2x_cee_peer_getpfc(struct net_device *netdev,
2445 struct cee_pfc *pfc)
2446{
2447 struct bnx2x *bp = netdev_priv(netdev);
2448 pfc->tcs_supported = bp->dcbx_remote_feat.pfc.pfc_caps;
2449 pfc->pfc_en = bp->dcbx_remote_feat.pfc.pri_en_bitmap;
2450 return 0;
2451}
2452
Shmulik Ravid785b9b12010-12-30 06:27:03 +00002453const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops = {
Shmulik Ravid0be6bc62011-05-18 02:55:31 +00002454 .getstate = bnx2x_dcbnl_get_state,
2455 .setstate = bnx2x_dcbnl_set_state,
2456 .getpermhwaddr = bnx2x_dcbnl_get_perm_hw_addr,
2457 .setpgtccfgtx = bnx2x_dcbnl_set_pg_tccfg_tx,
2458 .setpgbwgcfgtx = bnx2x_dcbnl_set_pg_bwgcfg_tx,
2459 .setpgtccfgrx = bnx2x_dcbnl_set_pg_tccfg_rx,
2460 .setpgbwgcfgrx = bnx2x_dcbnl_set_pg_bwgcfg_rx,
2461 .getpgtccfgtx = bnx2x_dcbnl_get_pg_tccfg_tx,
2462 .getpgbwgcfgtx = bnx2x_dcbnl_get_pg_bwgcfg_tx,
2463 .getpgtccfgrx = bnx2x_dcbnl_get_pg_tccfg_rx,
2464 .getpgbwgcfgrx = bnx2x_dcbnl_get_pg_bwgcfg_rx,
2465 .setpfccfg = bnx2x_dcbnl_set_pfc_cfg,
2466 .getpfccfg = bnx2x_dcbnl_get_pfc_cfg,
2467 .setall = bnx2x_dcbnl_set_all,
2468 .getcap = bnx2x_dcbnl_get_cap,
2469 .getnumtcs = bnx2x_dcbnl_get_numtcs,
2470 .setnumtcs = bnx2x_dcbnl_set_numtcs,
2471 .getpfcstate = bnx2x_dcbnl_get_pfc_state,
2472 .setpfcstate = bnx2x_dcbnl_set_pfc_state,
2473 .setapp = bnx2x_dcbnl_set_app_up,
2474 .getdcbx = bnx2x_dcbnl_get_dcbx,
2475 .setdcbx = bnx2x_dcbnl_set_dcbx,
2476 .getfeatcfg = bnx2x_dcbnl_get_featcfg,
2477 .setfeatcfg = bnx2x_dcbnl_set_featcfg,
2478 .peer_getappinfo = bnx2x_peer_appinfo,
2479 .peer_getapptable = bnx2x_peer_apptable,
2480 .cee_peer_getpg = bnx2x_cee_peer_getpg,
2481 .cee_peer_getpfc = bnx2x_cee_peer_getpfc,
Shmulik Ravid785b9b12010-12-30 06:27:03 +00002482};
2483
Shmulik Ravid98507672011-02-28 12:19:55 -08002484#endif /* BCM_DCBNL */